http://stackoverflow.com/comment/35008019
type: Comment
score: 0
type: QuestionComment
has text: @blalasaadri tried, any exception type I throw by `stop()` will trigger the operation alpha since all of them inherited by `Throwable`
comment on: http://stackoverflow.com/q/22933218

http://stackoverflow.com/a/22898753
has comment: http://stackoverflow.com/comment/34946056
has comment: http://stackoverflow.com/comment/34945949
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34946273
accepted answer of: http://stackoverflow.com/q/22898662
has comment: http://stackoverflow.com/comment/34946355
has comment: http://stackoverflow.com/comment/34945921
has comment: http://stackoverflow.com/comment/34946606
has comment: http://stackoverflow.com/comment/34946473
answers question: http://stackoverflow.com/q/22898662
has body: To check for null, since Java 7, all you have to do is Objects.requireNonNull(someVariable); or use the overloaded method where you can specify a message. The method will throw an exception if the argument passed is null. For any other custom logic, you'll have to write your own validator. Something like public interface Validator&lt;T&gt; { public void validate(T object, Errors errors); } public class RaceInfoValidator implements Validator&lt;RaceInfo&gt; { public void validate(RaceInfo raceInfo, Error errors) { if (raceInfo.getRaceName() == null) { errors.addError("Must provide a race name."; } else if (raceInfo.getRaceName().isEmpty()) { errors.addError("The race name must not be empty."; } // etc. } } ... String race_name = ...; ... RaceInfo raceInfo = new RaceInfo(race_name, ...); RaceInfoValidator validator = ...; Errors errors = ...; // write some implementation validator.validate(raceInfo, errors); if (errors.hasErrors()) { // show user the errors } Alternatively, you could put this validation in the database table schemas, but I don't recommend it.
has comment: http://stackoverflow.com/comment/34946134
has comment: http://stackoverflow.com/comment/34946384
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34945903
type: AcceptedAnswer

http://stackoverflow.com/q/22942368
has title: Type mismatch: cannot convert from Integer to int
tagged with: integer
has comment: http://stackoverflow.com/comment/35031252
has comment: http://stackoverflow.com/comment/35031379
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35024625
upvote count: 1
has comment: http://stackoverflow.com/comment/35025503
type: Question
tagged with: session
tagged with: eclipse
has body: Thank you for the replies so far. The exception stack trace is below. As for the java compiler being used, it is whatever is running in Websphere Application Server v6.1 within this version of the tool. And adding _b resolved the error on some of the lines but not all of them. I'm not sure that that would be the correct logic to use here. But I won't know that until I actually get it running again. set.Attribute("rowcount",rowcount); also has the first error before and after changing it to set.Attribute("rowcount",rowcount_b); So for this variable your solution had no effect. Strange. The whole problem is just strange to me. Integer rowcount_b = (Integer) session.getAttribute("rowcount"); if (rowcount_b == null) { session.setAttribute("rowcount",rowcount_b); } // else { // rowcount = rowcount_b; // } I had to do the commenting out of these three lines with all of the if statements of this flavor when attempting to apply your suggestion. But it did not matter with rowcount. at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:571) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:444) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:306) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:148) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:295) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3673) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannel…
tagged with: int
has answer: http://stackoverflow.com/a/23255061
has comment: http://stackoverflow.com/comment/35025560
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35024624
favorite count: 0

http://stackoverflow.com/a/22961826
has body: You've first to check which TextField is owning the focus, then, request the focus on the next field. In this approach, you are requesting the focus on lName, then on sNumber, then you will end up with lResult owning the focus. public void actionPerformed(ActionEvent e) { //creates a file for the next button output final File file = new File("NextOutput.txt"); //creates a printwriter to output to file everytime next button is clicked (overwrite) boolean lNameFocus = lName.isFocusOwner(); boolean sNumberFocus = sNumber.isFocusOwner(); boolean fNameFocus = fName.isFocusOwner(); boolean lResultsFocus = lResults.isFocusOwner(); try (PrintWriter output = new PrintWriter(new FileWriter(file))) { //If none of the fields is owning the focus then lName requests the focus if (!(lNameFocus &amp;&amp; sNumberFocus &amp;&amp; fNameFocus &amp;&amp; lResultsFocus)) { String s = fName.getText(); output.print(s + " "); lName.requestFocus(); //if lName is owning the focus then sNumber should be next to request } else if (lNameFocus) { String s1 = lName.getText(); output.append(s1 + " "); sNumber.requestFocus(); // and so on } else if (sNumberFocus) { String s2 = sNumber.getText(); output.append(s2 + " "); lResults.requestFocus(); String s3 = lResults.getText(); output.append(s3 + " "); } } catch (IOException ex) { Logger.getLogger(MyProgram.class.getName()).log(Level.SEVERE, null, ex); } }
answers question: http://stackoverflow.com/q/22961286
score: 0
type: Answer

http://stackoverflow.com/comment/34817537
score: 0
has text: I just tried on solr 3.4, still the same issue
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22826295

http://stackoverflow.com/a/22952209
type: Answer
accepted answer of: http://stackoverflow.com/q/22952145
has body: You need to use a android.support.v4.view.PagerTabStrip inside a android.support.v4.view.ViewPager: PagerTabStrip inside ViewPager. There are plenty of examples online, here is one: https://gist.github.com/pboos/4535406
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22952145
score: 0

http://stackoverflow.com/a/22962249
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35060747
accepted answer of: http://stackoverflow.com/q/22960974
type: Answer
downvote count: 0
score: 1
has body: I spent some time on it and wrote some code using a library for combinations https://code.google.com/p/combinatoricslib/#3._Simple_combinations It prints out the combinations you need. I hope it helps. public class Test { static List&lt;Integer&gt; list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); static int[] groups = new int[] { 3, 4, 2, 3 }; public static void main(String[] args) throws Exception { print("", 0, list); } private static void print(String previousVector, int groupIndex, List&lt;Integer&gt; aList) { if (groupIndex == groups.length) { // last group System.out.println(previousVector); return; } ICombinatoricsVector&lt;Integer&gt; vector = Factory.createVector(aList.toArray(new Integer[0])); Generator&lt;Integer&gt; generator = Factory.createSimpleCombinationGenerator(vector, groups[groupIndex]); for (ICombinatoricsVector&lt;Integer&gt; combination : generator) { String vectorString = previousVector + combination.getVector().toString(); List&lt;Integer&gt; copy = new LinkedList&lt;&gt;(aList); copy.removeAll(combination.getVector()); print(vectorString, groupIndex + 1, copy); } } }
upvote count: 1
answers question: http://stackoverflow.com/q/22960974

http://stackoverflow.com/comment/34914681
score: 0
type: AnswerComment
type: Comment
has text: Good points regarding the super-class and return types. I'm curious why you mention the sun classes, as I've not heard of them as an alternative to java.lang.reflect, until reading it in your answer.
comment on: http://stackoverflow.com/a/22876613

http://stackoverflow.com/comment/34926151
score: 0
type: Comment
type: QuestionComment
has text: Please show your full code, for both the native part and the Java part.
comment on: http://stackoverflow.com/q/22887779

http://stackoverflow.com/q/22930480
has title: how to implement client and server code in jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/35022333
has comment: http://stackoverflow.com/comment/35003514
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22930601
has body: I have a small chatting App in Java SE for Desktop, I want to implement the same for Web as well, I have ChatServer as : public class ChatServer extends Thread { public static final int DEFAULT_PORT = 6035; public static String initServer() { String msg = ""; int port = DEFAULT_PORT; ServerSocket serverSocket = null; Socket socket = null; try { serverSocket = new ServerSocket(port); msg = "Listening on port " + port; while (true) { socket = serverSocket.accept(); /*System.out.println("Connection receive from " + socket.getRemoteSocketAddress());*/ ChatHandler handler = new ChatHandler(socket); handler.start(); } } catch (IOException ioe) { System.err.println("Usage: java ChatServer [port]"); System.err.println("Where options include:"); System.err.println("\tport the port on which to listen."); msg = "Usage: java ChatServer [port]"; System.exit(0); } finally { try { serverSocket.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } return msg; } } Now to call this in index.jsp, I have : <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> Insert title here <%=pkj.com.lenvel.ChatServer.initServer() %> the above code is not showing any message and I'm still confused, where to implement code for Client?
downvote count: 0
answer count: 1
tagged with: jsp

http://stackoverflow.com/comment/64949756
has text: That is simple, indeed! Thank you! :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/38789604
type: AnswerComment

http://stackoverflow.com/q/22927714
has body: I am using SchemaCrawler 8.17 for Oracle and MSSQL. The code is implemented in Java. I have following issues : Taking too much time for Oracle database. Unable to find schema for MSSQL database. I tried using INFORMATION SCHEMA VIEWS also to boost performance but I doubt SchemaCrawler is not able to use INFORMATION SCHEMA VIEWS for Oracle. Here is the code snippet : DataSource dataSource = new DatabaseConnectionOptions("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@xx.xx.xx.xx:orcl"); Connection connection = dataSource.getConnection("xxx", "xxx"); Config config = getSchemaCrawlerConfig(RDBMSType.ORACLE); SchemaCrawlerOptions options = new SchemaCrawlerOptions(config); // SchemaCrawlerOptions options = new SchemaCrawlerOptions(config); SchemaInfoLevel schemaInfoLevel = new SchemaInfoLevel(); schemaInfoLevel.setTag("Custom Info Level"); schemaInfoLevel.setRetrieveTables(true); schemaInfoLevel.setRetrieveTableColumns(true); schemaInfoLevel.setRetrieveForeignKeys(true); schemaInfoLevel.setRetrieveColumnDataTypes(true); options.setSchemaInfoLevel(schemaInfoLevel); options.setProcedureInclusionRule(new InclusionRule(InclusionRule.NONE, InclusionRule.ALL)); options.setSchemaInclusionRule(new InclusionRule("XXX",InclusionRule.NONE)); For creating the config I am using the below code snippet : Properties prop = new Properties(); FileInputStream fs = new FileInputStream(new File("D:\\schemacrawler-oracle.config.properties")); //InputStream in = ApiExample.class.getResourceAsStream("D:\\schemacrawler-oracle.config.properties"); try { prop.load(fs); fs.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Config config = new Config(prop); How can I validate whether SchemaCrawler is using INFORMATION SCHEMA VIEWS??
tagged with: jdbc
has answer: http://stackoverflow.com/a/23087451
tagged with: schemacrawler
tagged with: java
type: Question
score: 0
answer count: 1
type: UnansweredQuestion
has title: Schema Crawler slow performance

http://stackoverflow.com/q/22958552
accepted answer: http://stackoverflow.com/a/22958829
upvote count: 2
has answer: http://stackoverflow.com/a/22958829
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22959353
has body: I'm having trouble with hibernate, i'm getting constraint violation exception on call, where I just want to call a 'select'. return getHibernateTemplate().execute(new HibernateCallback&lt;List&lt;HibernateObject&gt;&gt;() { @Override public List&lt;HibernateObject&gt; doInHibernate(Session session) { Criteria criteria = session .createCriteria(HibernateObject.class) .add(eq("myobject.id", id)); return criteria.list(); } }); Also update call happens for not HibernateObject, just for related object. How can I find out why update is happening there without my explicit calls?
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
downvote count: 0
has title: Hibernate: executes update on select call
has answer: http://stackoverflow.com/a/22959353
favorite count: 0

http://stackoverflow.com/comment/34879625
type: Comment
type: QuestionComment
has text: That's why I only commented and didn't answer. Maybe someone has done it before and can give you an answer but I can't without research right now.
comment on: http://stackoverflow.com/q/22862040
score: 0

http://stackoverflow.com/comment/35068708
comment on: http://stackoverflow.com/q/22965661
score: 0
has text: you can iterate over the list any way you want, you don't have to get an instance of the iterator and call next()
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22928812
type: Question
has body: in my servlet, I am passing a file path using cookies and downloading a file as below protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String b = null; Cookie[] cookies = request.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (cookie.getName().equals("thecookie")) { b = cookie.getValue(); } } } BufferedReader br = new BufferedReader(new FileReader(b+"/logs.txt")); String path = br.readLine(); br.close(); File file = new File(path+"/Results.xlsx"); FileInputStream fileIn = new FileInputStream(file); ServletOutputStream out = response.getOutputStream(); byte[] outputByte = new byte[4096]; //copy binary contect to output stream while(fileIn.read(outputByte, 0, 4096) != -1) { out.write(outputByte, 0, 4096); } fileIn.close(); out.flush(); out.close(); } Everything works fine and the file is getting downloaded but, I want to download Results.xlsx and the file that is being downloaded is download.zip and this download.zip is same size as my Results.xlsx file but is not getting opened by excel. How do I do this right??
answer count: 1
score: 0
has title: Error while file download
tagged with: download
has answer: http://stackoverflow.com/a/22928926
tagged with: excel
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35000477
accepted answer: http://stackoverflow.com/a/22928926

http://stackoverflow.com/comment/34979496
has text: I did just that (see update in my OP) and the static block still wouldn't execute. Any idea why?
comment on: http://stackoverflow.com/a/22916090
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22919054
answers question: http://stackoverflow.com/q/22918630
has body: The new file API has all the tools you need: it has a method accepting globs as arguments; it has a FileVisitor interface which you can use to perform recursive file deletion (see here for an example). Feel free to salvage the recursive deletion example, and note that it can be improved. In particular, this one will stop at the first deletion error, but it is trivial to modify so that it continues in this case instead.
accepted answer of: http://stackoverflow.com/q/22918630
has comment: http://stackoverflow.com/comment/34982483
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34982849
has comment: http://stackoverflow.com/comment/34982548
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34985236
has comment: http://stackoverflow.com/comment/34982779
has comment: http://stackoverflow.com/comment/34984090

http://stackoverflow.com/a/22820369
type: Answer
score: 4
upvote count: 4
has body: With assertBinaryEquals. public static void assertBinaryEquals(java.io.File expected, java.io.File actual) http://junit-addons.sourceforge.net/junitx/framework/FileAssert.html
answers question: http://stackoverflow.com/q/22818590
downvote count: 0

iterator
tags question: http://stackoverflow.com/q/22844747
tag name: iterator
tags question: http://stackoverflow.com/q/22852512
tags question: http://stackoverflow.com/q/22878604
tags question: http://stackoverflow.com/q/22965661
tags question: http://stackoverflow.com/q/22884335
tags question: http://stackoverflow.com/q/22825933
tags question: http://stackoverflow.com/q/22925268
type: Tag

http://stackoverflow.com/comment/35066745
comment on: http://stackoverflow.com/a/22900368
type: AnswerComment
score: 0
type: Comment
has text: It was not me Mark. I am still working on the script with my program.

http://stackoverflow.com/q/22810809
type: Question
has comment: http://stackoverflow.com/comment/34786810
has comment: http://stackoverflow.com/comment/34786856
tagged with: java
has body: i have a text file containing binary numbers how do i delete a column from the text file 1 0 1 1 0 0 1 1 0 1 1 1 1 0 1 0 1 0 0 1 for e.g. i want to delete the second column(0 1 1 1).Is there any way it can be done?
linked to: http://stackoverflow.com/q/3174201
has comment: http://stackoverflow.com/comment/34787169
has title: deleting columns from a text file in java
answer count: 1
has answer: http://stackoverflow.com/a/22810957
favorite count: 0
has comment: http://stackoverflow.com/comment/34786870
score: -1
tagged with: text
upvote count: 2
type: UnansweredQuestion
downvote count: 3

http://stackoverflow.com/comment/34954475
type: Comment
has text: Did you check if COMPLETEDATE is null or just "" (empty string)? It is more likely it is an empty string.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22903465

http://stackoverflow.com/q/22964287
tagged with: java
type: Question
downvote count: 0
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/35064176
answer count: 0
type: UnansweredQuestion
tagged with: drawable
upvote count: 1
has comment: http://stackoverflow.com/comment/35065086
has body: d = Drawable.createFromPath(Environment.getExternalStorageDirectory().toString()+"/"+filenameString); System.err.println(Environment.getExternalStorageDirectory().toString()+"/"+filenameString+" - "+d); image.setImageDrawable(d); this above is the code i'm using to get the drawable and below the Logcat: 04-09 15:34:44.005: I/System.out(20814): Not a DRM File, opening notmally 04-09 15:34:44.010: I/System.out(20814): buffer returned 04-09 15:34:44.010: D/skia(20814): --- SkImageDecoder::Factory returned null 04-09 15:34:44.010: W/System.err(20814): /storage/sdcard0/1396850896.482724.png 04-09 15:34:44.010: W/System.err(20814): - null i checked and the file exists. i've set WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE.
has comment: http://stackoverflow.com/comment/35064503
has title: Drawable createFromPath returns null even though file exists
score: 1

http://stackoverflow.com/comment/34816187
score: 0
comment on: http://stackoverflow.com/q/22826785
has text: Maybe look at [this](http://stackoverflow.com/a/11666046/2587435)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22834949
answers question: http://stackoverflow.com/q/22834769
type: Answer
has body: convert it to an Arraylist and then use the overridden toArray() method Arraylist&lt;String&gt; newList = new Arraylist(yourStringList); String [] stringArray = new String[newList.size()]; stringArray = newList.toArray();
downvote count: 1
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/34831058
has comment: http://stackoverflow.com/comment/80295868

http://stackoverflow.com/comment/34823614
comment on: http://stackoverflow.com/a/22821755
has text: I don't want my classes to be instantiated publicly I will instantiate them at application startup and will put the object in servlet context to be used. Also the classes that I have are immutable. The class objects are costly to instantiate and will take up to much resources.
type: AnswerComment
score: 0
type: Comment

eclipse
tags question: http://stackoverflow.com/q/22949514
tags question: http://stackoverflow.com/q/22840845
tags question: http://stackoverflow.com/q/22819547
tags question: http://stackoverflow.com/q/22914927
tags question: http://stackoverflow.com/q/22919106
tags question: http://stackoverflow.com/q/22965087
tag name: eclipse
tags question: http://stackoverflow.com/q/22878809
tags question: http://stackoverflow.com/q/22905622
tags question: http://stackoverflow.com/q/22856998
tags question: http://stackoverflow.com/q/22893750
tags question: http://stackoverflow.com/q/22888173
tags question: http://stackoverflow.com/q/22909052
tags question: http://stackoverflow.com/q/22857669
tags question: http://stackoverflow.com/q/22932453
tags question: http://stackoverflow.com/q/22923798
tags question: http://stackoverflow.com/q/22862157
tags question: http://stackoverflow.com/q/22861957
tags question: http://stackoverflow.com/q/22942368
tags question: http://stackoverflow.com/q/22894535
tags question: http://stackoverflow.com/q/22809331
tags question: http://stackoverflow.com/q/22885917
tags question: http://stackoverflow.com/q/22822132
tags question: http://stackoverflow.com/q/22961634
tags question: http://stackoverflow.com/q/22951201
tags question: http://stackoverflow.com/q/22938962
tags question: http://stackoverflow.com/q/22959100
tags question: http://stackoverflow.com/q/22942199
tags question: http://stackoverflow.com/q/22954904
tags question: http://stackoverflow.com/q/22816526
tags question: http://stackoverflow.com/q/22962807
tags question: http://stackoverflow.com/q/22913663
tags question: http://stackoverflow.com/q/22883091
tags question: http://stackoverflow.com/q/22854282
tags question: http://stackoverflow.com/q/22913668
tags question: http://stackoverflow.com/q/22931498
tags question: http://stackoverflow.com/q/22820500
tags question: http://stackoverflow.com/q/22942245
tags question: http://stackoverflow.com/q/22816770
tags question: http://stackoverflow.com/q/22812054
tags question: http://stackoverflow.com/q/22834107
tags question: http://stackoverflow.com/q/22898801
tags question: http://stackoverflow.com/q/22868179
tags question: http://stackoverflow.com/q/22939218
tags question: http://stackoverflow.com/q/22951012
tags question: http://stackoverflow.com/q/22896554
tags question: http://stackoverflow.com/q/22841218
tags question: http://stackoverflow.com/q/22856150
tags question: http://stackoverflow.com/q/22822264
tags question: http://stackoverflow.com/q/22885128
tags question: http://stackoverflow.com/q/22893156
tags question: http://stackoverflow.com/q/22918822
tags question: http://stackoverflow.com/q/22902228
tags question: http://stackoverflow.com/q/22967558
tags question: http://stackoverflow.com/q/22941286
tags question: http://stackoverflow.com/q/22922116
tags question: http://stackoverflow.com/q/22967110
tags question: http://stackoverflow.com/q/22881209
tags question: http://stackoverflow.com/q/22907294
tags question: http://stackoverflow.com/q/22894035
tags question: http://stackoverflow.com/q/22813848
tags question: http://stackoverflow.com/q/22937127
tags question: http://stackoverflow.com/q/22909433
tags question: http://stackoverflow.com/q/22925894
tags question: http://stackoverflow.com/q/22941204
tags question: http://stackoverflow.com/q/22865857
tags question: http://stackoverflow.com/q/22895162
tags question: http://stackoverflow.com/q/22939515
tags question: http://stackoverflow.com/q/22931322
tags question: http://stackoverflow.com/q/22907877
tags question: http://stackoverflow.com/q/22958470
tags question: http://stackoverflow.com/q/22954463
tags question: http://stackoverflow.com/q/22900205
tags question: http://stackoverflow.com/q/22930026
tags question: http://stackoverflow.com/q/22883951
tags question: http://stackoverflow.com/q/22954830
tags question: http://stackoverflow.com/q/22930811
tags question: http://stackoverflow.com/q/22888853
tags question: http://stackoverflow.com/q/22847455
tags question: http://stackoverflow.com/q/22830344

http://stackoverflow.com/q/22854622
has comment: http://stackoverflow.com/comment/34872116
has comment: http://stackoverflow.com/comment/34866385
has comment: http://stackoverflow.com/comment/34868346
has comment: http://stackoverflow.com/comment/34866463
has answer: http://stackoverflow.com/a/22860344
has comment: http://stackoverflow.com/comment/34868516
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34867967
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34867286
upvote count: 5
has comment: http://stackoverflow.com/comment/34868438
score: 4
tagged with: concurrency
answer count: 1
has comment: http://stackoverflow.com/comment/34866588
favorite count: 0
has comment: http://stackoverflow.com/comment/34866515
has comment: http://stackoverflow.com/comment/34866944
has title: What's the difference between ConcurrentHashMap and Collections.synchronizedMap(Map) in term of performance?
has body: I am trying to evaluate those concepts by using code. This is what I ended up with public void runCWith3Threads() { // mesure add with 3 threads for (int i = 0; i &lt; 10; i++) { Map&lt;Integer, Person&gt; shm = Collections.synchronizedMap(new HashMap&lt;Integer, Person&gt;()); Map&lt;Integer, Person&gt; chm = new ConcurrentHashMap&lt;Integer, Person&gt;(); MapThread sm1 = new MapThread(shm, 0, 20000, "sm1"); MapThread sm2 = new MapThread(shm, 20000, 30000, "sm2"); MapThread sm3 = new MapThread(shm, 30000, 50000, "sm3"); sm1.start();sm2.start();sm3.start(); while (true) { try { sm1.join(); sm2.join(); sm3.join(); break; } catch (InterruptedException e) { e.printStackTrace(); } } long secondMax = sm1.time &gt; sm2.time ? sm1.time : sm2.time; long firstMax = secondMax &gt; sm3.time ? secondMax : sm3.time; System.out.println("Millisec of SynchronizedMap cost: " + firstMax); MapThread m1 = new MapThread(chm, 0, 20000, "m1"); MapThread m2 = new MapThread(chm, 20000, 30000, "m2"); MapThread m3 = new MapThread(chm, 30000, 50000, "m3"); m1.start();m2.start();m3.start(); while (true) { try { m1.join(); m2.join(); m3.join(); break; } catch (InterruptedException e) { e.printStackTrace(); } } secondMax = m1.time &gt; m2.time ? m1.time : m2.time; firstMax = secondMax &gt; m3.time ? secondMax : m3.time; System.out.println("Millisec of ConcurrentHashMap cost: " + firstMax); System.out.println(); } } public class MapThread extends Thread { Map&lt;Integer, Person&gt; map; int from; int to; long time; String name; public MapThread(Map&lt;Integer, Person&gt; map, int from, int to, String name) { this.map = map; this.from = from; this.to = to; this.name = name; } public void run() { long start = System.currentTimeMillis(); for (int i = from; i &lt; to; i++) { map.put(i, new Person()); } long end = System.currentTimeMillis(); time = end - start; return; } } What I expect is, after the code runs, the ConcurrentHashMap 's result will be faster, since it allows multiple insertion into the …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34866021

final
tags question: http://stackoverflow.com/q/22873977
type: Tag
tags question: http://stackoverflow.com/q/22905453
tags question: http://stackoverflow.com/q/22942572
tag name: final
tags question: http://stackoverflow.com/q/22949718

http://stackoverflow.com/a/22838523
score: 0
has body: Lets look at your sourcecode, because the regexp itself was already well explained in the other answers. //compiles a regexp pattern, kind of make it useable Pattern p = Pattern.compile("[a-c][abc][bca]"); //creates a matcher for your regexp pattern. This one is used to find this regexp pattern //in your actual string name. Matcher m = p.matcher(name); //loop while the matcher finds a next substring in name that matches your pattern while(m.find()) { //print out the index of the found substring and the substring itself System.out.println(m.start()+"\t"+m.group()); }
type: Answer
answers question: http://stackoverflow.com/q/22838011

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/22942493
tags question: http://stackoverflow.com/q/22945684
tags question: http://stackoverflow.com/q/22824711
tags question: http://stackoverflow.com/q/22816323
tags question: http://stackoverflow.com/q/22885896
tag name: jfreechart
tags question: http://stackoverflow.com/q/22968351
tags question: http://stackoverflow.com/q/22829082

http://stackoverflow.com/comment/34983062
type: Comment
comment on: http://stackoverflow.com/a/22890899
has text: I realize now that the name attribute was superfluous. Trying to teach myself java and I don't realize things like all string arrays have their own indices (which begin at 0). Thank you for the comment and the link. It was very helpful.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22898562
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/34949597
tagged with: java
has answer: http://stackoverflow.com/a/22908522
has body: My question is - Can I autowire an instance of a class in multiple classes? My application uses Spring MVC to communicate between the JSP front end pages and my MongoDB back end. I am using MongoDB for my repository. I have created a service which performs the CRUD methods for MongoDB. This can be seen below with one of the CRUD methods (not all are shown as they are not needed). It uses the Mongo template. import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.stereotype.Repository; @Repository public class SensorReadingService { @Autowired private MongoTemplate mongoTemplate; /** * Create a unique mongo id and insert the document into * the collection specified. If collection doesn't exist, * create it. * @param sensor */ public void addSensorReadingIntoCollection(SensorReading sensor, String collection) { if (!mongoTemplate.collectionExists(SensorReading.class)) { mongoTemplate.createCollection(SensorReading.class); } String id = UUID.randomUUID().toString(); String[] ids = id.split("-"); String noHyphens = ""; for(int i = 0; i&lt;ids.length; i++) { noHyphens = noHyphens.concat(ids[i]); } sensor.setId(noHyphens); mongoTemplate.insert(sensor, collection); } As can be seen, the MongoTemplate is autowired. In my Dispatcher-Servlet I have the following code for MongoDB: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-contex…
has comment: http://stackoverflow.com/comment/34945739
type: Question
tagged with: mongodb
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34968670
has comment: http://stackoverflow.com/comment/34949725
has title: Can I use Spring @Autowired in multiple classes?
has comment: http://stackoverflow.com/comment/34945834
favorite count: 0
accepted answer: http://stackoverflow.com/a/22908522
linked to: http://stackoverflow.com/q/7414794
has comment: http://stackoverflow.com/comment/34956698
has comment: http://stackoverflow.com/comment/34960736
upvote count: 1
tagged with: spring-annotations
tagged with: autowired

http://stackoverflow.com/comment/115379846
has text: What do you set JAVA_HOME to in this case, please? `export JAVA_HOME="/usr/libexec/java_home"` ?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/64232876

http://stackoverflow.com/q/22811601
type: AnsweredQuestion
tagged with: java
score: -4
type: Question
has answer: http://stackoverflow.com/a/22811723
has comment: http://stackoverflow.com/comment/34788399
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/34788102
answer count: 1
favorite count: 0
has body: I am Using Regular Expression to break the string, I am trying to break the string but In reqular Expressions I am missing some format. Can any one please let me know where i went wrong. String betweenstring="['Sheet 1$'].[DEPTNO] AS [DEPTNO]"; System.out.println("betweenstring: "+betweenstring); Pattern pattern = Pattern.compile("\\w+[.]\\w+"); Matcher matchers=pattern.matcher(betweenstring); while(matchers.find()) { String filtereddata=matchers.group(0); System.out.println("filtereddata: "+filtereddata); } I need to break like this: ['Sheet 1$'] [DEPTNO] AS [DEPTNO]
accepted answer: http://stackoverflow.com/a/22811723
has title: REgular Expression using Java
duplicate of: http://stackoverflow.com/q/14833008
tagged with: regex

jakarta-ee
tags question: http://stackoverflow.com/q/22845699
tags question: http://stackoverflow.com/q/22878449
tags question: http://stackoverflow.com/q/22846576
tags question: http://stackoverflow.com/q/22854666
tags question: http://stackoverflow.com/q/22846361
tags question: http://stackoverflow.com/q/22821905
tags question: http://stackoverflow.com/q/22861161
tags question: http://stackoverflow.com/q/22935073
type: Tag
tags question: http://stackoverflow.com/q/22910826
tags question: http://stackoverflow.com/q/22963720
tags question: http://stackoverflow.com/q/22929748
tags question: http://stackoverflow.com/q/22958118
tags question: http://stackoverflow.com/q/22917518
tags question: http://stackoverflow.com/q/22940608
tags question: http://stackoverflow.com/q/22948376
tags question: http://stackoverflow.com/q/22866653
tags question: http://stackoverflow.com/q/22903953
tags question: http://stackoverflow.com/q/22860381
tags question: http://stackoverflow.com/q/22830668
tags question: http://stackoverflow.com/q/22870094
tags question: http://stackoverflow.com/q/22893888
tags question: http://stackoverflow.com/q/22852425
tags question: http://stackoverflow.com/q/22879321
tags question: http://stackoverflow.com/q/22962852
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/22833557
tags question: http://stackoverflow.com/q/22894727
tags question: http://stackoverflow.com/q/22861546
tags question: http://stackoverflow.com/q/22883487
tags question: http://stackoverflow.com/q/22894115
tags question: http://stackoverflow.com/q/22870422
tags question: http://stackoverflow.com/q/22938677
tags question: http://stackoverflow.com/q/22854130
tags question: http://stackoverflow.com/q/22860001
tags question: http://stackoverflow.com/q/22939753
tags question: http://stackoverflow.com/q/22835632
tags question: http://stackoverflow.com/q/22964829
tags question: http://stackoverflow.com/q/22843596
tags question: http://stackoverflow.com/q/22921828
tags question: http://stackoverflow.com/q/22911511
tags question: http://stackoverflow.com/q/22874348
tags question: http://stackoverflow.com/q/22958771
tags question: http://stackoverflow.com/q/22832936
tags question: http://stackoverflow.com/q/22966928
tags question: http://stackoverflow.com/q/22906178
tags question: http://stackoverflow.com/q/22933083
tags question: http://stackoverflow.com/q/22814352
tags question: http://stackoverflow.com/q/22810484
tags question: http://stackoverflow.com/q/22815438
tags question: http://stackoverflow.com/q/22955567
tags question: http://stackoverflow.com/q/22830101
tags question: http://stackoverflow.com/q/22884707
tags question: http://stackoverflow.com/q/22911356
tags question: http://stackoverflow.com/q/22939154
tags question: http://stackoverflow.com/q/22830799
tags question: http://stackoverflow.com/q/22874910
tags question: http://stackoverflow.com/q/22845412
tags question: http://stackoverflow.com/q/22812572
tags question: http://stackoverflow.com/q/22963706
tags question: http://stackoverflow.com/q/22922922
tags question: http://stackoverflow.com/q/22853521
tags question: http://stackoverflow.com/q/22921889
tags question: http://stackoverflow.com/q/22840851
tags question: http://stackoverflow.com/q/22885285
tags question: http://stackoverflow.com/q/22907647
tags question: http://stackoverflow.com/q/22870927
tags question: http://stackoverflow.com/q/22893015
tags question: http://stackoverflow.com/q/22838452
tags question: http://stackoverflow.com/q/22900249
tags question: http://stackoverflow.com/q/22894210
tags question: http://stackoverflow.com/q/22928298
tags question: http://stackoverflow.com/q/22957280
tags question: http://stackoverflow.com/q/22945206
tags question: http://stackoverflow.com/q/22920225

http://stackoverflow.com/comment/35038015
type: QuestionComment
type: Comment
has text: That's not what I mean. A reference or an object aren't final. Variables are final. When you use a variable as an argument the value of the reference it holds is passed.
comment on: http://stackoverflow.com/q/22949718
score: 0

http://stackoverflow.com/a/22933196
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22932770
has comment: http://stackoverflow.com/comment/35010464
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22932770
downvote count: 0
has body: No, as far as I know. As a workaround, you can define a Java constant which calls the method: @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface MyJavaAnnotation { int aValue() default A; static final int A = MyValues.a(); } I think it could be defined inside the same annotation, if not move it somewhere.
type: Answer

webclient
tags question: http://stackoverflow.com/q/22863043
type: Tag
tag name: webclient

http://stackoverflow.com/a/22873689
answers question: http://stackoverflow.com/q/22873376
has comment: http://stackoverflow.com/comment/35194325
type: Answer
has body: By default FlatFileItemWriter uses default line separator System.getProperty("line.separator") I think you have overridden this value some where in your code. For more info read source code. Here is the piece of code from write() method of FlatFileItemWriter @Override public void write(List&lt;? extends T&gt; items) throws Exception { ... StringBuilder lines = new StringBuilder(); int lineCount = 0; for (T item : items) { lines.append(lineAggregator.aggregate(item) + lineSeparator); lineCount++; } ... }
has comment: http://stackoverflow.com/comment/34979977
score: 0
accepted answer of: http://stackoverflow.com/q/22873376
type: AcceptedAnswer

http://stackoverflow.com/q/22854498
has title: How exactly does Tomcat's Threadpool work
type: AnsweredQuestion
upvote count: 19
has comment: http://stackoverflow.com/comment/34866268
tagged with: java
has body: So here's my understanding. The Apache Tomcat's threadpool (is it called the connector Threadpool? ) has a number of threads ( 200 by default ). Now this means that at a particular time, 200 people can communicate with my web application. Now, taking a scenario when a particular connects with my application. I get a request, and the tomcat client on the server checks if there is any thread available to cater to the request or not. If it is then good, else we give back some error code. Now in case of success, will that one thread, that I have assigned to that request, be associated with that particular client till the time his request is not handled? Basically, as a user if I go to, www.myApp.com, I get one thread from the thread pool that fetches all the info from the server and gives me back the final html. After that the thread is free and goes back to pool. Now if I click on something else then again go to the threadpool and get assigned a thread if available and it goes on a on. Is this how it works? Question 2 Let's say, I have a Java Application on my server side. So when I hit a url, it takes me to some java code. Now is it that, the thread that I got from Tomcat Threadpool, that thread will execute my code? If that is so, what happens if I make new threads in my java code, will those threads be taken from the Tomcat's threadpool or will those be from the Java's threadpool created? Also, what happens to the execution of the Tomcat's thread in that case? Thanks. Kindly provide some Tomcat official references/resources where I can read about such things if you know about any. Cheers.
score: 17
has comment: http://stackoverflow.com/comment/34865964
type: Question
has answer: http://stackoverflow.com/a/22856659
has comment: http://stackoverflow.com/comment/34865887
tagged with: threadpool
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/34927628
has comment: http://stackoverflow.com/comment/34865876
has comment: http://stackoverflow.com/comment/34866041
has comment: http://stackoverflow.com/comment/34865939
has comment: http://stackoverflow.com/comment/34904507
has comment: http://stackoverflow.com/comment/34904409
accepted answer: http://stackoverflow.com/a/22856659
has comment: http://stackoverflow.com/comment/34865784
favorite count: 0
has comment: http://stackoverflow.com/comment/34866227
tagged with: multithreading
downvote count: 2
has comment: http://stackoverflow.com/comment/34866054

http://stackoverflow.com/comment/34912695
type: Comment
type: QuestionComment
has text: Exception in thread "main" java.lang.NullPointerException at java.awt.Container.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at Game.<init>(Game.java:185) at Game.main(Game.java:243) here are the exceptions
comment on: http://stackoverflow.com/q/22880419
score: 0

http://stackoverflow.com/q/22897976
downvote count: 1
favorite count: 0
tagged with: openstack-swift
tagged with: jclouds
type: UnansweredQuestion
has body: Can someone tell how to list available containers in Openstack SWIFT using Jcloud ? We have used keystone for authentication. Any help is appreciated :)
has answer: http://stackoverflow.com/a/22914514
score: 1
tagged with: java
tagged with: openstack
type: Question
has answer: http://stackoverflow.com/a/22902673
upvote count: 2
has title: How to list available containers in SWIFT using JCloud?
answer count: 2

http://stackoverflow.com/comment/34862798
type: Comment
comment on: http://stackoverflow.com/a/22852507
has text: @Shaz I think the problem is what RichS mentions. The problem maybe with `users` variable. You could post more code to make your question more clear.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22935589
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/22935946
has comment: http://stackoverflow.com/comment/35012264
has comment: http://stackoverflow.com/comment/35012175
answer count: 5
type: UnansweredQuestion
tagged with: file
upvote count: 1
has comment: http://stackoverflow.com/comment/35012099
downvote count: 1
has comment: http://stackoverflow.com/comment/35012082
has answer: http://stackoverflow.com/a/22935705
has comment: http://stackoverflow.com/comment/35012199
has comment: http://stackoverflow.com/comment/35012156
tagged with: java
has answer: http://stackoverflow.com/a/22935755
has answer: http://stackoverflow.com/a/22936464
type: Question
has title: java file reading file returning null
has answer: http://stackoverflow.com/a/22935760
has body: i have a method, which should return a string from a text file. But it returning null. Could you please help me to figure this one out? Thank you! Here is the code public String findFile() { String line = ""; try { File myDir = new File("files"); File myFile = new File(myDir, "ISBN 123-654.txt"); BufferedReader br = new BufferedReader(new FileReader(myFile)); while ((line = br.readLine()) != null) { System.out.println(line + "1"); } } catch (IOException e) { e.printStackTrace(); } System.out.println(line+"2"); return line; } String line should hold a text like: H:\Java\workspace\LMS\files\book.jpg many thanks to all participated! here is working code: public String findFile() { String line = ""; try { File myFile = new File("files", "ISBN 123-654.txt"); BufferedReader br = new BufferedReader(new FileReader(myFile)); while ((line = br.readLine()) == null) System.out.println(line + "1"); br.close(); } catch (IOException e) { e.printStackTrace(); } System.out.println(line+"2"); return line; }
has comment: http://stackoverflow.com/comment/35012160

http://stackoverflow.com/comment/34978274
type: Comment
type: QuestionComment
has text: I don't think this fully answers the question nor do I have a reference handy, but I recall reading a long time ago that the `String.hashCode` method has been optimized for very good distribution, such that in a hash table, you will get very few collisions.
comment on: http://stackoverflow.com/q/22916843
score: 0

http://stackoverflow.com/comment/34879247
type: QuestionComment
comment on: http://stackoverflow.com/q/22862226
has text: Of course, you must read `x` while holding the same lock.
score: 3
type: Comment

http://stackoverflow.com/comment/34931311
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22890578
type: Comment
has text: Do you have `hibernate-jpa-2.1-api.jar` in Weblogic classpath ? Looks like weblogic 12c uses an old JPA API by default.

http://stackoverflow.com/q/22902314
has comment: http://stackoverflow.com/comment/34952967
accepted answer: http://stackoverflow.com/a/22904584
upvote count: 2
answer count: 3
has body: In Java I can create a Singleton like this (as long as it doesn't throw as exception): private static Singleton m_this = new Singleton(); This is very convenient because it's inherently thread safe. Can I do something similar in C++?
has comment: http://stackoverflow.com/comment/34952716
favorite count: 0
possible better answer: http://stackoverflow.com/a/22902369
has answer: http://stackoverflow.com/a/22904584
has answer: http://stackoverflow.com/a/22902369
tagged with: singleton
linked to: http://stackoverflow.com/q/11711920
has answer: http://stackoverflow.com/a/22906173
tagged with: c++
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34979877
linked to: http://stackoverflow.com/q/8102125
has comment: http://stackoverflow.com/comment/34952620
type: Question
has title: Singleton in java vs. Singleton in C++
has comment: http://stackoverflow.com/comment/34954460
tagged with: java
has comment: http://stackoverflow.com/comment/34952469
has comment: http://stackoverflow.com/comment/34953051

http://stackoverflow.com/a/22900705
has body: Assuming that this is Java and not Javascript, you probably want this: for(int i=0; i&lt;plainTextUpper.length()-1; i++) { System.out.println(plainTextupper.codePointAt(i)); } Note that this will not process the last character of plainTextUpper. You probably also want to either get rid of the -1 or change the comparison operator to &lt;= in the for termination test.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22900678
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34951985
upvote count: 2
answers question: http://stackoverflow.com/q/22900678

http://stackoverflow.com/comment/34900566
score: 0
type: Comment
has text: are you using any `lineAggregator`?
type: QuestionComment
comment on: http://stackoverflow.com/q/22873376

http://stackoverflow.com/comment/34942717
score: 0
type: AnswerComment
has text: What do you mean with "apache to listen for requests, passing them to tomcat"?
comment on: http://stackoverflow.com/a/22873237
type: Comment

http://stackoverflow.com/comment/34926416
type: AnswerComment
comment on: http://stackoverflow.com/a/22887774
type: Comment
has text: I do not have money to get 10 machines yet, main issue at the moment.
score: 0

http://stackoverflow.com/a/22918001
has comment: http://stackoverflow.com/comment/34981262
answers question: http://stackoverflow.com/q/22917691
type: Answer
has comment: http://stackoverflow.com/comment/35007143
has body: In Java TimeZone.getDefault() is initialized that way: Look up the system property "user.timezone" (this is always a good work-around to start your application with this property set to "Asia/Kolkata"). If not present then look at "user.country" and "java.home" and use native method for accessing platform zone information (so you should really check your android-OS-configuration for timezone). If still not present then fall back to GMT. UPDATE: For Android (which is not really Java) you can also check this other SO-post where an answer mentions the system property System.getProperty("persist.sys.timezone");. You can try to print out this property for you and follow given links there.
has comment: http://stackoverflow.com/comment/34981376
has comment: http://stackoverflow.com/comment/35006425
score: 0

http://stackoverflow.com/a/30722869
score: 1
has body: To answer the question directly (it was answered in the comments by Pavel). The jackson core lib dependency was missing: jackson-core-$x.y.z.jar
upvote count: 1
answers question: http://stackoverflow.com/q/22819511
type: Answer
downvote count: 0

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

http://stackoverflow.com/a/29786573
type: AcceptedAnswer
type: Answer
has body: Just to close it. As @M. Deinum mentioned in the comments. Spring handle this way for security purposes. The implementation can be seen in the ExceptionTranslationFilter class.
accepted answer of: http://stackoverflow.com/q/22964789
score: 0
answers question: http://stackoverflow.com/q/22964789

http://stackoverflow.com/a/22829060
has body: You can insert a string in Middle of another string in following way, String mErrorMsgId = getResources().getString(R.string.username_or_password_incorrectfull); // + getResources().getString(R.string.nux_add_selfhosted_blog); String firstPart = mErrorMsgId.substring( 0, mErrorMsgId.indexOf( "tap") + 4 ); String selfhosted_blog = getResources().getString(R.string.nux_add_selfhosted_blog) + " "; String thirdPart = mErrorMsgId.substring( mErrorMsgId.indexOf( "tap") + 4 ); mErrorMsgId = firstPart + selfhosted_blog + thirdPart;
has comment: http://stackoverflow.com/comment/34821198
answers question: http://stackoverflow.com/q/22828986
has comment: http://stackoverflow.com/comment/34822306
score: 0
has comment: http://stackoverflow.com/comment/34838293
has comment: http://stackoverflow.com/comment/34822277
type: Answer

http://stackoverflow.com/comment/35061794
type: Comment
score: 0
has text: Your environmental Variable is wrong. Set it Properly to point to Tomcat Folder like I have Shown Above. Restart your PC to pick the new env variable and it will work. I have the same sample code running in my machine. Working perfectly.
comment on: http://stackoverflow.com/a/22959648
type: AnswerComment

http://stackoverflow.com/comment/35004941
type: QuestionComment
has text: I want the console logs to be in a seperate file, rather than tomcat.stderr.logs. And, printing the console logs along with the other log statements won't give duplicate entries, since both are different.
score: 0
comment on: http://stackoverflow.com/q/22930620
type: Comment

http://stackoverflow.com/q/22818138
has answer: http://stackoverflow.com/a/22818383
has comment: http://stackoverflow.com/comment/34800395
has comment: http://stackoverflow.com/comment/34822764
tagged with: java
downvote count: 2
upvote count: 1
has body: I'm a thorough novice. Could someone give me some examples of Java command line arguments and explain them? I have exhausted Google and I am still confused about exactly what they are.
type: Question
tagged with: command-line-arguments
score: -1
answer count: 1
has comment: http://stackoverflow.com/comment/34800383
has comment: http://stackoverflow.com/comment/34800494
has title: What are some examples of Java command line arguments?
has comment: http://stackoverflow.com/comment/34800372
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35000255
comment on: http://stackoverflow.com/a/22926667
score: 0
type: AnswerComment
type: Comment
has text: You can look at my **UPDATE** I don't get any exception.

http://stackoverflow.com/a/22914669
score: 1
answers question: http://stackoverflow.com/q/22904554
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22904554
downvote count: 0
has body: I don't know if you've resolved your problem, but if you haven't, here is what you can do to make it work. You should use OnItemClickListener() instead of OnItemSelectedListener(). I couldn't find the difference between those two in AdapterView, but I can say that it (OnItemSelectedListener()) was never invoked while debugging your code. Here is the replacement: textView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int index, long id) { if(index == 1){ Intent i = new Intent (MainActivity.this, SecondActivity.class); i.putExtra("KEY", presidents[index]); startActivity(i); } } }); Also keep in mind that index in onItemClick() is the position of item clicked. So if you click the first item from the drop down list (index=0) which is, say, "Bill Clinton", you put "Rahul" as extra for the Intent. EDIT according to your new question. Do as follows: textView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int index, long id) { String president = ((TextView) view).getText().toString(); Intent intent = null; if (president.equals("John F. Kennedy")) intent = new Intent (MainActivity.this, KennedyActivity.class); if (president.equals("Lyndon B. Johnson")) intent = new Intent (MainActivity.this, JohnsonActivity.class); if (president.equals("Richard Nixon")) intent = new Intent (MainActivity.this, NixonActivity.class); if (president.equals("Gerald Ford")) intent = new Intent (MainActivity.this, FordActivity.class); if (president.equals("Jimmy Carter")) intent = new Intent (MainActivity.this, CarterActivity.class); if (president.equals("Ronald Reagan")) intent = new Intent (MainActivity.this, ReaganActivity.class); if (president.equals("George H. W. Bush")) intent = new Intent (MainActivity.this, SrBushActivity.class); if (president.equals("Bill Clinton")) intent = new Intent (MainActivity.this, ClintonActivity.class); if (pre…
type: Answer
upvote count: 1

java
tags question: http://stackoverflow.com/q/22817775
tags question: http://stackoverflow.com/q/22951695
tags question: http://stackoverflow.com/q/22867155
tags question: http://stackoverflow.com/q/22891478
tags question: http://stackoverflow.com/q/22879188
tags question: http://stackoverflow.com/q/22954567
tags question: http://stackoverflow.com/q/22891623
tags question: http://stackoverflow.com/q/22833508
tags question: http://stackoverflow.com/q/22846484
tags question: http://stackoverflow.com/q/22890132
tags question: http://stackoverflow.com/q/22870655
tags question: http://stackoverflow.com/q/22890952
tags question: http://stackoverflow.com/q/22834774
tags question: http://stackoverflow.com/q/22907774
tags question: http://stackoverflow.com/q/22837325
tags question: http://stackoverflow.com/q/22866901
tags question: http://stackoverflow.com/q/22850460
tags question: http://stackoverflow.com/q/22890644
tags question: http://stackoverflow.com/q/22946769
tags question: http://stackoverflow.com/q/22838047
tags question: http://stackoverflow.com/q/22815733
tags question: http://stackoverflow.com/q/22810776
tags question: http://stackoverflow.com/q/22815448
tags question: http://stackoverflow.com/q/22928598
tags question: http://stackoverflow.com/q/22915821
tags question: http://stackoverflow.com/q/22911317
tags question: http://stackoverflow.com/q/22877020
tags question: http://stackoverflow.com/q/22941621
tags question: http://stackoverflow.com/q/22816979
tags question: http://stackoverflow.com/q/22876030
tags question: http://stackoverflow.com/q/22950346
tags question: http://stackoverflow.com/q/22838271
tags question: http://stackoverflow.com/q/22873886
tags question: http://stackoverflow.com/q/22958034
tags question: http://stackoverflow.com/q/22920046
tags question: http://stackoverflow.com/q/22951011
tags question: http://stackoverflow.com/q/22894885
tags question: http://stackoverflow.com/q/22892744
tags question: http://stackoverflow.com/q/22851513
tags question: http://stackoverflow.com/q/22877887
tags question: http://stackoverflow.com/q/22949081
tags question: http://stackoverflow.com/q/22870361
tags question: http://stackoverflow.com/q/22891916
tags question: http://stackoverflow.com/q/22921800
tags question: http://stackoverflow.com/q/22922744
tags question: http://stackoverflow.com/q/22879490
tags question: http://stackoverflow.com/q/22886187
tags question: http://stackoverflow.com/q/22932575
tags question: http://stackoverflow.com/q/22905798
tags question: http://stackoverflow.com/q/22856888
tags question: http://stackoverflow.com/q/22954722
tags question: http://stackoverflow.com/q/22960074
tags question: http://stackoverflow.com/q/22874209
tags question: http://stackoverflow.com/q/22867838
tags question: http://stackoverflow.com/q/22852106
tags question: http://stackoverflow.com/q/22812488
tags question: http://stackoverflow.com/q/22916319
tags question: http://stackoverflow.com/q/22931991
tags question: http://stackoverflow.com/q/22890803
tags question: http://stackoverflow.com/q/22885156
tags question: http://stackoverflow.com/q/22850457
tags question: http://stackoverflow.com/q/22848674
tags question: http://stackoverflow.com/q/22947755
tags question: http://stackoverflow.com/q/22829724
tags question: http://stackoverflow.com/q/22878191
tags question: http://stackoverflow.com/q/22832265
tags question: http://stackoverflow.com/q/22914882
tags question: http://stackoverflow.com/q/22810333
tags question: http://stackoverflow.com/q/22839342
tags question: http://stackoverflow.com/q/22893530
tags question: http://stackoverflow.com/q/22827906
tags question: http://stackoverflow.com/q/22862255
tags question: http://stackoverflow.com/q/22882892
tags question: http://stackoverflow.com/q/22948896
tags question: http://stackoverflow.com/q/22819341
tags question: http://stackoverflow.com/q/22871599
tags question: http://stackoverflow.com/q/22897469
tags question: http://stackoverflow.com/q/22811985
tags question: http://stackoverflow.com/q/22920371
tags question: http://stackoverflow.com/q/22912888

http://stackoverflow.com/q/22846044
tagged with: authentication
type: Question
tagged with: jsp
tagged with: spring-security
has title: Call ldap security login and then additional custom action from same link
upvote count: 1
has body: I have a webapp that needs to login twice when the user logs in : once with an ldap authentication (used spring security) and then I want to auto login using the original custom login system. To login to the original system, I've got a login.xhtml page having this : &lt;h:inputText value="#{loginForm.username}" id="username"/&gt; &lt;h:inputSecret value="#{loginForm.password}" id="password"/&gt; (...) &lt;h:commandButton action="#{loginForm.login}" value="Connexion"/&gt; LoginForm.login does the work I need and returns "first_page" so that the user can enter the application. Now that I added a login.jsp page for spring security with : &lt;form action="&lt;%=request.getContextPath()%&gt;/j_spring_security_check" method="post"&gt; &lt;input name="j_username"&gt; &lt;input type="password" name="j_password" /&gt; &lt;input type="submit" value="login"&gt; &lt;/form&gt; The user is redirected to the first page without calling LoginForm.login. How can I call both login action, passing username and password to both of them ? Thank you
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: spring
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/22816016
tagged with: java
has answer: http://stackoverflow.com/a/22816377
answer count: 2
has comment: http://stackoverflow.com/comment/34796444
tagged with: arrays
has comment: http://stackoverflow.com/comment/34796658
favorite count: 0
has answer: http://stackoverflow.com/a/22816271
accepted answer: http://stackoverflow.com/a/22816271
downvote count: 3
score: -3
duplicate of: http://stackoverflow.com/q/18470094
upvote count: 0
tagged with: shuffle
has body: I've been assigned a program with arrays to build a deck of cards, and I need a program to shuffle the deck. I have no idea where to start. I considered creating a new method named shuffleDeck, but I'm not sure if it would work properly with the two arrays. Arrays are a generally new topic to me, and I'm not sure how to shuffle the deck when there are two arrays building each separate card. No direct answers please, but some hints/help with this would be greatly appreciated. EDIT: I tried using Collections.shuffle, and it seems that it's not building properly with Strings. import java.util.*; import java.io.*; public class cards_st { public static void main(String[] args) { String [] card = {"2","3","4","5","6","7","8","9","10","Jack","Queen","King","Ace"}; String [] suit = {" of hearts"," of clubs"," of spades", " of diamonds"}; String [] odeck = new String[52]; buildDeck(odeck,card,suit); for(int d = 0; d &lt;52; d++) System.out.println(odeck[d]); } public static void buildDeck(String [] tdeck,String [] tcard, String [] tsuit) { int count = 0; for (int i = 0; i &lt; 13; i++) { for (int j = 0; j &lt; 4; j++) { tdeck[count]= tcard[i] + tsuit[j]; count++; } } } }
type: Question
has comment: http://stackoverflow.com/comment/34797812
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22816377
has comment: http://stackoverflow.com/comment/34796920
has title: How do I 'shuffle' strings arranged in two separate arrays?
linked to: http://stackoverflow.com/q/18470094
has comment: http://stackoverflow.com/comment/34797051

http://stackoverflow.com/q/22852587
has answer: http://stackoverflow.com/a/22852633
type: Question
tagged with: java
score: -1
answer count: 2
has comment: http://stackoverflow.com/comment/60120246
upvote count: 0
tagged with: string
has title: Java Word Counter -- Write method that accepts string object as argument and returns word count
favorite count: 0
has body: The assignment for java is to write a method that accepts string objects as an argument and returns the number of words it contains. Demonstrate the method in a program that asks the user to input a string and passes it to the method. The number of words should be displayed in the screen.. I know its close but there are probably some errors. public class WordCounter { public static void main(String[] args) { //Imported scanner here Scanner in = new Scanner(System.in); // //Asks and gets the users input here // private static string getInput(Scanner in) { String input; System.out.println("Enter a string here: "); input = in.nextLine(); // //Create an if/else statment to find out if the user entered input. // if(input.length() &gt; 0) { getInput(input); } else { System.out.println("Error -- You must enter a string!"); System.out.println("Enter a string here: "); input = in.nextLine(); } return input; } //Close public static string getInput here // //Calculates the number of words the user inputs // public static int getWordCount(String input) { int wordcount = 0; //Initializes word counter to 0 at start of program for(int i = 0; i &lt;= input.length() -1; i++) { if(input.charAt(i) == ' ') { wordcount++; } } return wordcount; } //Close public static int getWordCount here //Print out the number of words within the users string here System.out.println("The number of words in the string are: " + wordcount); } //Close public static void main string args here } //Close public class word counter here
linked to: http://stackoverflow.com/q/22900641
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22852624
downvote count: 1

http://stackoverflow.com/comment/103270848
has text: Any reason `getStructuringElement` isn't used to create the kenel?
type: AnswerComment
comment on: http://stackoverflow.com/a/22965468
score: 0
type: Comment

http://stackoverflow.com/q/22942435
has answer: http://stackoverflow.com/a/23964127
tagged with: maven
upvote count: 1
type: Question
tagged with: maven-release-plugin
has body: I've set up the maven build for a Java project according to Publishing releases using Github, Bintray and maven-release-plugin , a blog post by Andreas Veithen. My pom version is 1.0.2-SNAPSHOT, and I've created the respective version 1.0.2 in my bintray package. I perform mvn -Prelease clean install, no problems. I perform mvn release:prepare, no problems. But when I perform mvn release:perform, the build breaks with the error message below. Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project [PROJECT]: Failed to deploy artifacts: Could not transfer artifact my.project:test:jar:1.0.2-20140408.154954-1 from/to bintray- user-maven-package (https://api.bintray.com/maven/user/maven/package): Failed to transfer file: https://api.bintray.com/maven/user/maven/package/my/project/test/ 1.0.2-SNAPSHOT/test-1.0.2-20140408.154954-1.jar. Return code is: 400, ReasonPhrase: Bad Request. -> [Help 1] I'm noticing that the release plugin is trying to upload the SNAPSHOT, and of course this should have no place on bintray... I'd have thought that it would try to deploy 1.0.2? How can I convince maven to upload the correct artifact, or is there anything wrong with my set up? Below are the parts of the POM that I think are relevant, the complete POM is at pastebin. 4.0.0 my.tool util jar 1.0.2-SNAPSHOT scm:git:https://github.com/user/package.git scm:git:git@github.com:user/package.git https://github.com/user/package HEAD <distributionManagement> bintray-user-maven-package user-maven-package https://api.bintray.com/maven/user/maven/package </distributionManagement> release maven-source-plugin attach-sources jar maven-javadoc-plugin attach-javadocs jar </profiles> install org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 com.mycila license-maven-plugin 2.6 ${basedir}/src/etc/header.txt src/main/java/** src/test/java/** check maven-release-plugin 2.5 false release true
score: 1
has comment: http://stackoverflow.com/comment/35054599
tagged with: java
has answer: http://stackoverflow.com/a/24899407
has comment: http://stackoverflow.com/comment/35056830
answer count: 3
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22954597
has title: Deploying to bintray from Maven fails
tagged with: deployment
tagged with: bintray

http://stackoverflow.com/a/22893297
downvote count: 0
has comment: http://stackoverflow.com/comment/34935962
score: 6
has comment: http://stackoverflow.com/comment/34936491
upvote count: 6
has comment: http://stackoverflow.com/comment/34935915
type: Answer
answers question: http://stackoverflow.com/q/22893263
has comment: http://stackoverflow.com/comment/48199956
has body: Stream&lt;Person&gt; persons = groups.stream().flatMap(g -&gt; g.getPersons().stream());

http://stackoverflow.com/q/22863965
accepted answer: http://stackoverflow.com/a/22864097
favorite count: 0
has title: how future get() method works with timeout
possible better answer: http://stackoverflow.com/a/22865436
has answer: http://stackoverflow.com/a/22864097
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/22865436
has body: I am a bit confused how Future.get(timeout) works as per the definition it would through an exception after specified timeout time, but its not happening in my test cases. import java.util.LinkedHashSet; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; public class CallableExample { public static class WordLengthCallable implements Callable&lt;String&gt; { private String word; private long waiting; public WordLengthCallable(String word, long waiting) { this.word = word; this.waiting = waiting; } public String call() throws InterruptedException { Thread.sleep(waiting); return word; } } public static void main(String args[]) throws Exception { args = new String[] { "i", "am", "in", "love" }; long[] waitArr = new long[] { 3000, 3440, 2500, 3000 }; ExecutorService pool = Executors.newFixedThreadPool(3); Set&lt;Future&lt;String&gt;&gt; set = new LinkedHashSet&lt;Future&lt;String&gt;&gt;(); int i = 0; for (String word : args) { Callable&lt;String&gt; callable = new WordLengthCallable(word, waitArr[i++]); Future&lt;String&gt; future = pool.submit(callable); set.add(future); } String sum = ""; for (Future&lt;String&gt; future : set) { try { sum += future.get(2000, TimeUnit.MILLISECONDS) + ", "; } catch (Exception e) { } } System.out.print("Result : " + sum); } } output "am, in," it behaves differently on changing waiting time in array( timeArr values). when to use get with timeout?
downvote count: 0
score: 4

http://stackoverflow.com/comment/34935413
comment on: http://stackoverflow.com/a/22888098
has text: Why do I need to store the result? And why a static variable?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22912372
tagged with: eclipse
type: Question
has title: How to prevent P2 to overwrite eclipse.ini
answer count: 1
tagged with: p2
score: 0
has body: I'm using eclipse 3.72 (Indigo) for my RCP Application. And it works fine. I've implemented p2 for automated updates. But after using p2 for updating my features my eclipse.ini gets overwritten! How can I disable that? My customer is able to change the language-settings my prog is using and the -data-param for storing specific data into "@user.home ...". I can't tell him to modify the eclipse.ini after an update is placed.
type: UnansweredQuestion
tagged with: java
tagged with: rcp
has answer: http://stackoverflow.com/a/22942947

http://stackoverflow.com/q/22868791
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35004462
has title: Calling a web service SOAP in java
accepted answer: http://stackoverflow.com/a/22965160
answer count: 2
possible better answer: http://stackoverflow.com/a/22868902
downvote count: 0
has answer: http://stackoverflow.com/a/22868902
favorite count: 0
has body: I would like to calling the following web service in the link : http://www.webservicex.net/globalweather.asmx?op=GetCitiesByCountry This is the main program: public static void main(String[] args) { try { // Create the connection SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance(); SOAPConnection conn = scf.createConnection(); // Create message MessageFactory mf = MessageFactory.newInstance(); SOAPMessage msg = mf.createMessage(); // Add eventually a SoapAction header if necessary MimeHeaders hd = msg.getMimeHeaders(); hd.addHeader("SOAPAction", "http://www.webserviceX.NET/GetCitiesByCountry"); // Object for message parts SOAPPart sp = msg.getSOAPPart(); SOAPEnvelope env = sp.getEnvelope(); SOAPBody bd = env.getBody(); // Populate body // Main element and namespace SOAPElement be = bd.addChildElement(env.createName("GetCitiesByCountry", "ansi", "http://www.webserviceX.NET")); // Add content be.addChildElement("CountryName").addTextNode("Morocco"); // Save message msg.saveChanges(); // View input System.out.println("\n Soap request:\n"); msg.writeTo(System.out); System.out.println(); // Send String urlval = "http://www.webservicex.net/globalweather.asmx"; // or /rcx-ws-rpc/rcx for my rpc/encoded web service SOAPMessage rp = conn.call(msg, urlval); // View the output System.out.println("\nXML response\n"); // Create transformer TransformerFactory tff = TransformerFactory.newInstance(); Transformer tf = tff.newTransformer(); // Get reply content Source sc = rp.getSOAPPart().getContent(); // Set output transformation StreamResult result = new StreamResult(System.out); tf.transform(sc, result); System.out.println(); // Close connection conn.close(); } catch (Exception e) { System.out.println(e.getMessage()); } } I got the following error in response : &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSc…
tagged with: soap
tagged with: web-services
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34891263
has answer: http://stackoverflow.com/a/22965160
score: 1

http://stackoverflow.com/comment/34926612
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22887637
has text: Well this was a nice and simple solution! It works out well, but i have to use StringTokenizer/string methods like useDelimiter, skip, etc to arrive at the answer. Any tips?
type: Comment

http://stackoverflow.com/a/22892853
has comment: http://stackoverflow.com/comment/34936128
answers question: http://stackoverflow.com/q/22892675
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22892675
has body: One thing first: no matter what you are doing, whether you make an applet or a servlet or any other Java application, it is never a good idea to make HTML by appending strings. Never do that! But as I started my studies and I did the very same (:D) and today I am laughing about it. So let's assume you want to learn Java and you need some hints... You problem is that the loop in your JavaScript (which you generate) has nothing to do with your Java array. Of course. What you do is that your create another program (a JavaScript program) from your Java code. The two programs (your Java code and the JavaScript it generates) are two completely different applications. So you cannot iterate in JavaScript over a Java array (like you try). Instead you should iterate in Java over your Java array and generate the JavaScript code. Here's how it could look like (I didn't tested it, it is pseudo-code): toClient.println("var myrest = new Array();"); for(String element: myArray) toClient.println("myrest.append(" + element + ");");
has comment: http://stackoverflow.com/comment/34935804
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/34935773

http://stackoverflow.com/comment/35014393
has text: in webpage , actualy a jsp page . .
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22936708
score: 0

http://stackoverflow.com/comment/35032431
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22946634
type: QuestionComment
has text: Please share that portion of code where you have added it.

hql
tags question: http://stackoverflow.com/q/22845761
tag name: hql
tags question: http://stackoverflow.com/q/22817540
type: Tag
tags question: http://stackoverflow.com/q/22837325

http://stackoverflow.com/a/22818290
has comment: http://stackoverflow.com/comment/34801929
has comment: http://stackoverflow.com/comment/34802014
answers question: http://stackoverflow.com/q/22818042
has body: $id = mysqli_query($con,"SELECT userid FROM users WHERE userid=$userid "); how can i insert the user.uid into the product.userid? but as you mention above you need inner join query for doing this
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34801436

http://stackoverflow.com/comment/35060803
comment on: http://stackoverflow.com/a/22936209
score: 0
type: AnswerComment
type: Comment
has text: Show your full Jsp and how are child parent forms related?

http://stackoverflow.com/comment/36032147
type: QuestionComment
type: Comment
has text: I see this problem too. It suggests that the latest ADT 22.6.2 is BROKEN. I am seeing this on MacOS; you are seeing this on Windows. Pretty severe breakage. Can try searching for the bug at https://code.google.com/p/android/issues/advsearch and reporting it there if not found.
comment on: http://stackoverflow.com/q/22951868
score: 0

http://stackoverflow.com/comment/35043958
comment on: http://stackoverflow.com/q/22953136
type: Comment
has text: Just making sure, you actually *can* use JS ([this language](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Values,_variables,_and_literals))? If so, that's easy.
score: 0
type: QuestionComment

http://stackoverflow.com/q/22879005
has answer: http://stackoverflow.com/a/22899098
tagged with: image-segmentation
answer count: 3
has title: Text extraction and segmentation open CV
downvote count: 0
has answer: http://stackoverflow.com/a/22898953
favorite count: 0
has body: I've never used OpenCV before, but I'm trying to write my neural network system to recognize text and I need some tool for text extraction/ segmentation. How can I use java OpenCV to preprocess and segmentate an image containing text. I don't need to recognize the text, I just need to get each letter in a separate image. Something like this :
tagged with: handwriting-recognition
type: UnansweredQuestion
tagged with: opencv
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22879675
type: Question

http://stackoverflow.com/a/22869127
has comment: http://stackoverflow.com/comment/34892433
answers question: http://stackoverflow.com/q/22868429
type: Answer
downvote count: 0
score: 1
has body: Assuming @ContextConfiguration(locations=("/spring/application-config.xml")) refers to the XML configuration you've shown, there are no @Controller beans registered and therefore nothing to handle any requests. Your @ContextConfiguration should probably be loading the dispatcher-servlet.xml file which is used by the DispatcherServlet. That context configuration file should contain &lt;mvc:annotation-driven /&gt; to register any found @Controller beans as handlers.
has comment: http://stackoverflow.com/comment/34892242
upvote count: 1

http://stackoverflow.com/comment/34908467
has text: On entering 'Joh', I get the prediction 'John F. Kennedy' but on selecting 'John F. Kennedy' nothing happens.
comment on: http://stackoverflow.com/a/22877407
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22853923
type: Answer
has comment: http://stackoverflow.com/comment/116215190
downvote count: 1
upvote count: 33
answers question: http://stackoverflow.com/q/22853321
accepted answer of: http://stackoverflow.com/q/22853321
has body: RestTemplate has a method in which you can define Interface ResponseExtractor&lt;T&gt;, this interface is used to obtain the headers of the response, once you have them you could send it back using HttpEntity and added again. .add("Cookie", "SERVERID=c52"); Try something like this. String cookieHeader = null; new ResponseExtractor&lt;T&gt;(){ T extractData(ClientHttpResponse response) { response.getHeaders(); } } Then HttpHeaders headers = new HttpHeaders(); headers.add("Cookie", cookieHeader ); ResponseEntity&lt;byte[]&gt; response = restTemplate.exchange("http://example.com/file/123", GET, new HttpEntity&lt;String&gt;(headers), byte[].class); Also read this post
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34883178
has comment: http://stackoverflow.com/comment/34889345
score: 32

http://stackoverflow.com/comment/35024053
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22933315
has text: Thanks, I actually came up with a solution over night using do while statements but yours is much cleaner.
type: AnswerComment

http://stackoverflow.com/a/22888087
answers question: http://stackoverflow.com/q/22888042
score: 0
type: Answer
has body: The answer about the reason could either become rather philosophical, or just refer to the Java Language Specification. In any case, new AnotherNewClass("Hello World!!") should work.

http://stackoverflow.com/q/22909724
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34965248
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/22910935
tagged with: php
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34998103
has body: here is my XML: &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;&lt;pdftsExtract&gt;&lt;page number="0"&gt;&lt;block height="10.425598" width="121.31714" xpos="75.384" ypos="695.5"&gt;&lt;text&gt;This is a test document.&lt;/text&gt;&lt;/block&gt;&lt;text&gt;&amp;#13; &amp;#13; &lt;/text&gt;&lt;block height="63.34558" width="462.63947" xpos="72.024" ypos="616.3"&gt;&lt;text&gt;&lt;italic&gt;Portable Document Format &lt;/italic&gt;(PDF) is a file format used to represent documents in a manner&amp;#13; independent pdf application software, hardware, and operating systems.Each PDF file&amp;#13; encapsulates a complete description of a fixed-layout flat document, including the text,&amp;#13; fonts, graphics, and other information needed to display it. &lt;bold&gt;In 1991, Adobe Systems co-&amp;#13; founder John Warnock outlined a system called "Camelot" that evolved into PDF.&lt;/bold&gt;&lt;/text&gt;&lt;/block&gt;&lt;text&gt;&amp;#13; &amp;#13; &lt;/text&gt;&lt;block height="89.31" width="466.7436" xpos="72.024" ypos="508.87"&gt;&lt;text&gt;While Adobe Systems made the PDF specification available free of charge in 1993, PDF remained a&amp;#13; proprietary format, controlled by Adobe, until it was officially released as an open standard on July&amp;#13; 1,2008, and published by the International Organization for Standardization as ISO 32000-1:2008. In&amp;#13; 2008, Adobe published a Public Patent &lt;bold&gt;License to ISO 32000-1 granting royalty-free rights for all&amp;#13; patents owned by Adobe that are necessary to make, use, sell and distribute PDF compliant&amp;#13; implementations.&lt;/bold&gt;&lt;/text&gt;&lt;/block&gt;&lt;text&gt;&amp;#13; &lt;/text&gt;&lt;block height="41.76004" type="table" width="478.87598" xpos="66.62401" ypos="451.50998"&gt;&lt;block height="13.920044" width="159.62599" xpos="66.62401" ypos="479.34998"&gt;&lt;block height="8.279999" width="26.727844" xpos="72.024" ypos="482.71"&gt;&lt;text&gt;Name&lt;/text&gt;&lt;/block&gt;&l…
has title: Convert XML to HTML in following format PHP or Java
score: 0
answer count: 1

http://stackoverflow.com/comment/34844849
has text: Just speculating: Does the remote side also have a JodaTime version? Maybe an older one before version 2.0 where the `Comparable`-handling changed a little bit (see generified interface `ReadableInstant`)? Please have a look.
type: Comment
comment on: http://stackoverflow.com/q/22810331
type: QuestionComment
score: 0

http://stackoverflow.com/q/22927585
has title: On button click switch to new layout xml file, using buttons now but how do I use fragments?
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-fragments
score: 0
tagged with: java
type: Question
tagged with: bluetooth
answer count: 2
has body: I am creating a Bluetooth app that requires a log in and/or sign up. I use a button click to switch to new layout xml file, but I need to not use buttons and figure out how to use fragments! When I have a button on the second page that gets clicked it crashes the app. Help :( MainActivity.java package com.example.chirp; import android.app.Activity; import android.app.FragmentTransaction; import android.bluetooth.BluetoothAdapter; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.FragmentManager; import android.view.KeyEvent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter() ; bluetooth.setName("Chirp Bluetooth"); String status; { if (bluetooth != null) { if (bluetooth.isEnabled()) { String mydeviceaddress = bluetooth.getAddress(); String mydevicename = bluetooth.getName(); // String state = bluetooth.getState(); // status = mydevicename + ":" + mydeviceaddress + ":" + state; } else { status = "Bluetooth is not Enabled."; } } // Toast.makeText(this, status, Toast.LENGTH_LONG).show(); } // Configuration config = getResources().getConfiguration(); // // FragmentManager fragmentManager = getFragmentManager(); // FragmentTransaction fragmentTransaction = // fragmentManager.beginTransaction(); // Button quickfindbutton = (Button) findViewById(R.id.qfbutton); quickfindbutton.setOnClickListener(new OnClickListener(){ public void onClick(View v){ } }); Button loginbutton = (Button) findViewById(R.id.button1); loginbutton.setOnClickListener(new OnClickListener(){ public void onClick(View v){ setContentView(R.layout.loginscreen); }; }); Button signupbutton = (Button) findViewById(R.i…
has comment: http://stackoverflow.com/comment/34998578
has answer: http://stackoverflow.com/a/22927899
has comment: http://stackoverflow.com/comment/34998552
has answer: http://stackoverflow.com/a/22928769
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/34824796
comment on: http://stackoverflow.com/q/22831696
has text: @Raghunandan is there any other method to package jar with XML?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34951529
type: Comment
has text: I'm not that familiar with the Android specific libraries, but you might be able to start with making everything in your class private except for the createSomeEntry() and getSomeEntry() methods, which would be the only methods your other code would use. Making the createSomeEntry() and getSomeEntry() methods synchronized would take care of contention by client threads. You might need some additional adjustments inside the class, but that would be a start.
comment on: http://stackoverflow.com/a/22900664
score: 0
type: AnswerComment

http://stackoverflow.com/q/22916116
tagged with: android-studio
has title: Android Studio 0.5.4 update causes Java.Lang.VerifyError
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22916440
tagged with: lang
accepted answer: http://stackoverflow.com/a/22916440
type: Question
answer count: 1
favorite count: 0
upvote count: 3
has body: After updating my installation of android studio from 0.5.3 to 0.5.4 the project would throw this error as it launched. I have updated the SDK via SDK Manager to get the new Android SDK Tools required for 0.5.4. I have also updated the build tools in the gradle.build to use the newly updated versions. I have deleted the androidpreview folder and restarted android studio to no avail. I have also verified I have only 1 SDK on my system and that the paths to it are correct within Android studio. Any suggestions greatly appreciated. here is the Logcat output... 04-07 10:53:20.126 1656-1656/com.super8bit.singoffbetaversionone D/dalvikvm﹕ Not late-enabling CheckJNI (already on) 04-07 10:53:21.406 1656-1656/com.super8bit.singoffbetaversionone W/dalvikvm﹕ DexOpt: method is in an interface 04-07 10:53:21.406 1656-1656/com.super8bit.singoffbetaversionone I/dalvikvm﹕ Could not find method com.google.android.gms.common.api.GoogleApiClient.isConnected, referenced from method com.google.example.games.basegameutils.GameHelper.beginUserInitiatedSignIn 04-07 10:53:21.406 1656-1656/com.super8bit.singoffbetaversionone W/dalvikvm﹕ VFY: unable to resolve virtual method 9992: Lcom/google/android/gms/common/api/GoogleApiClient;.isConnected ()Z 04-07 10:53:21.406 1656-1656/com.super8bit.singoffbetaversionone W/dalvikvm﹕ VFY: rejecting opcode 0x6e at 0x0010 04-07 10:53:21.406 1656-1656/com.super8bit.singoffbetaversionone W/dalvikvm﹕ VFY: rejected Lcom/google/example/games/basegameutils/GameHelper;.beginUserInitiatedSignIn ()V 04-07 10:53:21.406 1656-1656/com.super8bit.singoffbetaversionone W/dalvikvm﹕ Verifier rejected class Lcom/google/example/games/basegameutils/GameHelper; 04-07 10:53:21.406 1656-1656/com.super8bit.singoffbetaversionone D/AndroidRuntime﹕ Shutting down VM 04-07 10:53:21.406 1656-1656/com.super8bit.singoffbetaversionone W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb3a80ba8) 04-07 10:53:21.506 1656-1656/com.super8bit.singoffbetaversionone E/Androi…
tagged with: android

http://stackoverflow.com/comment/34933137
type: Comment
type: QuestionComment
has text: @JB Nizet: I want it to return to previous class cause if not return I couldn't able to book the train but I don't know how to do the return class, so I try to learn from here
comment on: http://stackoverflow.com/q/22891421
score: 0

arraylist
tags question: http://stackoverflow.com/q/22839342
tags question: http://stackoverflow.com/q/22820307
tags question: http://stackoverflow.com/q/22865353
tags question: http://stackoverflow.com/q/22902286
tags question: http://stackoverflow.com/q/22889517
tags question: http://stackoverflow.com/q/22921346
tags question: http://stackoverflow.com/q/22914997
tags question: http://stackoverflow.com/q/22820743
tags question: http://stackoverflow.com/q/22944511
tags question: http://stackoverflow.com/q/22963363
tags question: http://stackoverflow.com/q/22883256
tags question: http://stackoverflow.com/q/22901937
tags question: http://stackoverflow.com/q/22882515
tags question: http://stackoverflow.com/q/22827577
tags question: http://stackoverflow.com/q/22843425
tags question: http://stackoverflow.com/q/22962233
tags question: http://stackoverflow.com/q/22889918
tags question: http://stackoverflow.com/q/22888092
tags question: http://stackoverflow.com/q/22854086
tags question: http://stackoverflow.com/q/22844855
tags question: http://stackoverflow.com/q/22833047
tags question: http://stackoverflow.com/q/22928503
tags question: http://stackoverflow.com/q/22843587
tags question: http://stackoverflow.com/q/22829161
tags question: http://stackoverflow.com/q/22932451
tags question: http://stackoverflow.com/q/22897927
tags question: http://stackoverflow.com/q/22953533
tags question: http://stackoverflow.com/q/22822786
tags question: http://stackoverflow.com/q/22900060
tags question: http://stackoverflow.com/q/22889095
tags question: http://stackoverflow.com/q/22883558
tags question: http://stackoverflow.com/q/22815047
tags question: http://stackoverflow.com/q/22849916
tags question: http://stackoverflow.com/q/22952654
tags question: http://stackoverflow.com/q/22827698
tags question: http://stackoverflow.com/q/22884335
tags question: http://stackoverflow.com/q/22888485
tags question: http://stackoverflow.com/q/22935729
tags question: http://stackoverflow.com/q/22920105
tags question: http://stackoverflow.com/q/22928051
tags question: http://stackoverflow.com/q/22925757
tags question: http://stackoverflow.com/q/22897968
tags question: http://stackoverflow.com/q/22825933
tags question: http://stackoverflow.com/q/22962590
tags question: http://stackoverflow.com/q/22891735
tags question: http://stackoverflow.com/q/22956532
tags question: http://stackoverflow.com/q/22855085
tags question: http://stackoverflow.com/q/22898596
tags question: http://stackoverflow.com/q/22920070
tags question: http://stackoverflow.com/q/22926771
tags question: http://stackoverflow.com/q/22850664
tags question: http://stackoverflow.com/q/22883297
tags question: http://stackoverflow.com/q/22812349
tags question: http://stackoverflow.com/q/22859830
tags question: http://stackoverflow.com/q/22852113
tags question: http://stackoverflow.com/q/22838583
tags question: http://stackoverflow.com/q/22952362
tags question: http://stackoverflow.com/q/22854329
tags question: http://stackoverflow.com/q/22898979
tags question: http://stackoverflow.com/q/22875993
tags question: http://stackoverflow.com/q/22902905
tags question: http://stackoverflow.com/q/22871918
tags question: http://stackoverflow.com/q/22851581
tags question: http://stackoverflow.com/q/22835770
tags question: http://stackoverflow.com/q/22848102
tags question: http://stackoverflow.com/q/22891088
tags question: http://stackoverflow.com/q/22905866
tags question: http://stackoverflow.com/q/22883794
tags question: http://stackoverflow.com/q/22883070
tags question: http://stackoverflow.com/q/22871660
tags question: http://stackoverflow.com/q/22927875
tags question: http://stackoverflow.com/q/22931441
tags question: http://stackoverflow.com/q/22846236
tags question: http://stackoverflow.com/q/22932082
tags question: http://stackoverflow.com/q/22821663
tags question: http://stackoverflow.com/q/22880458
tags question: http://stackoverflow.com/q/22867038
tags question: http://stackoverflow.com/q/22885181
tags question: http://stackoverflow.com/q/22918109
tags question: http://stackoverflow.com/q/22952058

http://stackoverflow.com/q/22924712
tagged with: lexer
tagged with: java
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/22924848
answer count: 1
tagged with: regex
score: 1
favorite count: 0
has body: For some reason the while loop is only going through one time, picking up a NUMBER and then exiting. Does anyone have any idea why it isn't lexing the rest of the String? All I had was an input of 1 + 2. Any help is much appreciated!! public Lexer(String input) throws TokenMismatchException { tokens = new ArrayList&lt;Token&gt;(); // Lexing logic begins here StringBuffer tokenPatternsBuffer = new StringBuffer(); for (Type type : Type.values()) tokenPatternsBuffer.append(String.format("|(?&lt;%s&gt;%s)", type.name(), type.pattern)); Pattern tokenPatterns = Pattern.compile(new String(tokenPatternsBuffer.substring(1))); // Begin matching tokens Matcher matcher = tokenPatterns.matcher(input.replaceAll(" ", "")); while (matcher.find()) { if (matcher.group(Type.NUMBER.name()) != null) { tokens.add(new Token(Type.NUMBER, matcher.group(Type.NUMBER.name()))); continue; } else if (matcher.group(Type.OPERATOR.name()) != null) { tokens.add(new Token(Type.OPERATOR, matcher.group(Type.OPERATOR.name()))); continue; } else if (matcher.group(Type.UNIT.name()) != null) { tokens.add(new Token(Type.UNIT, matcher.group(Type.UNIT.name()))); continue; } else if (matcher.group(Type.PARENTHESES.name()) != null) { tokens.add(new Token(Type.PARENTHESES, matcher.group(Type.PARENTHESES.name()))); continue; } else { throw new TokenMismatchException(); } } } enum Type { NUMBER("[0-9]+.*[0-9]*"), OPERATOR("[*|/|+|-]"), UNIT("[in|pt]"), PARENTHESES("[(|)]"); public final String pattern; private Type(String pattern) { this.pattern = pattern; } }
has title: Lexing a String in Java with Regex
upvote count: 1
has answer: http://stackoverflow.com/a/22924848
type: AnsweredQuestion

http://stackoverflow.com/a/23502710
downvote count: 0
type: Answer
has body: newGraph.clearSelection(); newGraph.selectAll(); Object[] cells = newGraph.getSelectionCells(); //here you have all cells for (Object c : cells) { mxCell cell = (mxCell) c; //cast if (cell.isVertex()) { //isVertex //todo }else{ //is not a vertex, so u can get source and target //todo cell.getChildCount(); //Returns the number of child cells. (edges) cell.getChildAt(x); //Returns the child at the specified index. (target) } Att,
upvote count: 1
answers question: http://stackoverflow.com/q/22858073
score: 1

http://stackoverflow.com/comment/105037341
type: AnswerComment
comment on: http://stackoverflow.com/a/22903004
has text: `root = null` It will do nothing inside a function . Java is passed by values, not by references
score: 1
type: Comment

http://stackoverflow.com/q/22898629
has answer: http://stackoverflow.com/a/22900490
accepted answer: http://stackoverflow.com/a/22900490
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: bytecode
possible better answer: http://stackoverflow.com/a/22898863
score: 0
linked to: http://stackoverflow.com/q/22893152
answer count: 3
has answer: http://stackoverflow.com/a/22899236
has body: Today, I answered an ordinary question of some Java beginner. A little bit later I thought it would be fun to take his question seriously and so I implemented exactly what he wants. I created a simple code for runtime Class generation. Most of the code is taken from a template, the only possible change is to declare some fields. Generated code could be written as: public class Container implements Storage { private int foo; // user defined (runtime generated) private Object boo; // user defined (runtime generated) public Container() { super(); } } The generated Class file is then loaded into the JVM using a custom ClassLoader. Then I implemented something like "static hashtable". Programmer enters all the possible keys and then it generates a Class (where each key is as a field). In the moment we have instance of this class, we may also save or read those generated fields using reflection. Here is a whole code: import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Hashtable; import java.util.Random; class ClassGenerator extends ClassLoader { private ArrayList&lt;FieldInfo&gt; fields = new ArrayList&lt;ClassGenerator.FieldInfo&gt;(); public static class FieldInfo { public final String name; public final Class&lt;?&gt; type; public FieldInfo(String name, Class&lt;?&gt; type) { this.name = name; this.type = type; } } private static class ComponentTypeInfo { private final Class&lt;?&gt; type; private final int arrayDimensions; public ComponentTypeInfo(Class&lt;?&gt; type, int arrayDimensions) { this.type = type; this.arrayDimensions = arrayDimensions; } } private static ComponentTypeInfo getComponentType(Class&lt;?&gt; type) { Class&lt;?&gt; tmp = type; int array = 0; while (tmp.isArray()) { tmp = tmp.getComponentType(); array++; } return new ComponentTypeInfo(tmp, array); } public static String getFieldDescriptor(Class&lt;?&gt; type) { ComponentTypeInfo componentTypeInfo = getComponentType(type); Class&lt;?&gt; c…
tagged with: code-generation
has title: Custom "hash table" implementation: Why is it so slow? (bytecode generation)
tagged with: hashtable
has answer: http://stackoverflow.com/a/22898863

database
tags question: http://stackoverflow.com/q/22917421
tags question: http://stackoverflow.com/q/22954787
tags question: http://stackoverflow.com/q/22895941
tags question: http://stackoverflow.com/q/22867679
tags question: http://stackoverflow.com/q/22937935
tags question: http://stackoverflow.com/q/22822879
tags question: http://stackoverflow.com/q/22837052
tags question: http://stackoverflow.com/q/22876460
tags question: http://stackoverflow.com/q/22916661
tags question: http://stackoverflow.com/q/22909545
type: Tag
tags question: http://stackoverflow.com/q/22880560
tags question: http://stackoverflow.com/q/22961806
tags question: http://stackoverflow.com/q/22949618
tags question: http://stackoverflow.com/q/22900621
tags question: http://stackoverflow.com/q/22945827
tags question: http://stackoverflow.com/q/22828751
tags question: http://stackoverflow.com/q/22911705
tags question: http://stackoverflow.com/q/22936487
tags question: http://stackoverflow.com/q/22928889
tags question: http://stackoverflow.com/q/22897975
tags question: http://stackoverflow.com/q/22893156
tags question: http://stackoverflow.com/q/22854723
tag name: database
tags question: http://stackoverflow.com/q/22932165
tags question: http://stackoverflow.com/q/22866024
tags question: http://stackoverflow.com/q/22919349
tags question: http://stackoverflow.com/q/22816166
tags question: http://stackoverflow.com/q/22832330
tags question: http://stackoverflow.com/q/22838381
tags question: http://stackoverflow.com/q/22930305
tags question: http://stackoverflow.com/q/22960648
tags question: http://stackoverflow.com/q/22959875
tags question: http://stackoverflow.com/q/22809340
tags question: http://stackoverflow.com/q/22849046
tags question: http://stackoverflow.com/q/22949924
tags question: http://stackoverflow.com/q/22855837
tags question: http://stackoverflow.com/q/22878446
tags question: http://stackoverflow.com/q/22879343
tags question: http://stackoverflow.com/q/22882584

http://stackoverflow.com/comment/34841267
type: Comment
has text: @Timmos yeah my mind seems to be not thinking of the obvious these days ;) I'll let the OP read your comment. Too lazy to edit. You're free to do so.
type: AnswerComment
comment on: http://stackoverflow.com/a/22840479
score: 0

http://stackoverflow.com/comment/34962185
has text: I need to take the value from the flash scoped attributes, not from the database...long story
comment on: http://stackoverflow.com/a/22907998
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22929012
has comment: http://stackoverflow.com/comment/35000974
has body: You can use -XX:HeapDump JVM options. With the following JVM options: -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="/tmp" JVM will dump the content of heap to a file in specified directory. Note that this only happens when OutOfMemoryError is thrown since dump isn't really needed if JVM crashed due to a different reason. You may also want to read http://docs.oracle.com/javase/6/docs/technotes/tools/share/jhat.html once
has comment: http://stackoverflow.com/comment/35001018
has comment: http://stackoverflow.com/comment/35000937
answers question: http://stackoverflow.com/q/22928961
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/35134988
type: QuestionComment
comment on: http://stackoverflow.com/q/22953224
has text: No, this is the problem. It might not have come up in another project because that project didn't need a conflicting class/method. Don't use different versions of the Spring libraries. All the Spring libraries [here](http://mvnrepository.com/artifact/org.springframework) that are currently at version 4.0.3.RELEASE should always be at the same version in your projects.
score: 0
type: Comment

http://stackoverflow.com/a/22862999
has comment: http://stackoverflow.com/comment/34882318
has comment: http://stackoverflow.com/comment/34880784
has comment: http://stackoverflow.com/comment/34881863
has comment: http://stackoverflow.com/comment/34881708
score: 1
answers question: http://stackoverflow.com/q/22862873
has comment: http://stackoverflow.com/comment/34892016
upvote count: 1
has comment: http://stackoverflow.com/comment/34880563
has comment: http://stackoverflow.com/comment/34881881
has comment: http://stackoverflow.com/comment/34882240
has comment: http://stackoverflow.com/comment/34881171
has comment: http://stackoverflow.com/comment/34881925
has body: You need to move these lines from onCreate() method to doInBackground() method, Name = jN.getText().toString(); Body = jB.getText().toString(); put them inside the doInBackground() method like below, public class submitJ extends AsyncTask&lt;Void, Integer, Void&gt;{ @Override protected Void doInBackground(Void... params) { try{ String Name = jN.getText().toString(); // move here and delete from the class String Body = jB.getText().toString(); String encodedName = URLEncoder.encode(Name,"UTF-8"); String encodedBody = URLEncoder.encode(Body,"UTF-8"); URL url = new URL("http://site123.com/android/J/sJ.php?Name="+encodedName+"&amp;Body="+encodedBody); URLConnection urlConnection = url.openConnection(); @SuppressWarnings("unused") InputStream in = urlConnection.getInputStream(); }catch(Exception e){ e.printStackTrace(); } return null; } }
downvote count: 0
has comment: http://stackoverflow.com/comment/34882099
has comment: http://stackoverflow.com/comment/34881988
type: Answer
has comment: http://stackoverflow.com/comment/34882147
has comment: http://stackoverflow.com/comment/34881187

http://stackoverflow.com/comment/35004376
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22841949
has text: I thought I mentioned in my post but now I see I didn't. Sorry for the confusion. I'll try that!
score: 0

http://stackoverflow.com/q/22882533
has comment: http://stackoverflow.com/comment/34917268
tagged with: java
type: Question
score: 0
tagged with: playframework
has title: No such file or directory when Installing Play 2.2.2 in OS X
has comment: http://stackoverflow.com/comment/34917247
has comment: http://stackoverflow.com/comment/34917555
has comment: http://stackoverflow.com/comment/34952621
has body: When trying to install play 2.2.2 and running it, an error apperas: /Users/NoePodesta/play-2.2.0/play: line 70: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/bin/java: No such file or directory What is wrong here?? I have already set this in the .bashrc export PATH=$PATH:/Users/xxxx/play-2.2.0 export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk Thanks
tagged with: macos
has comment: http://stackoverflow.com/comment/34947500
has comment: http://stackoverflow.com/comment/34924603
answer count: 0
type: UnansweredQuestion
tagged with: java-home

http://stackoverflow.com/comment/34986625
type: QuestionComment
score: 0
has text: Post the stacktrace. Where are you using the `UserService` bean?
comment on: http://stackoverflow.com/q/22921071
type: Comment

http://stackoverflow.com/comment/42755488
comment on: http://stackoverflow.com/q/22913958
has text: please describe properly.. can't get
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22906126
answers question: http://stackoverflow.com/q/22905320
has body: This should be working: MyActivity public class MyActivity extends FragmentActivity implements View.OnClickListener { private FragmentManager supportFragmentManager; private Button btn; private TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = (Button) findViewById(R.id.button1); btn.setOnClickListener(this);//implemented onclicklistener (look up) tv = (TextView) findViewById(R.id.Textview1); } @Override public void onClick(View view) { int id = view.getId(); switch (id) { case R.id.button1://listener for this id if view id is the same supportFragmentManager = getSupportFragmentManager(); if(supportFragmentManager.findFragmentByTag("mydialog") != null) { return; } //dialog fragment FireMissilesDialogFragment schermpje = new FireMissilesDialogFragment(); //arguments Bundle bundle = new Bundle(); bundle.putString(FireMissilesDialogFragment.KEY_OK, "ok"); bundle.putString(FireMissilesDialogFragment.KEY_CANCEL, "cancel"); //set arguments schermpje.setArguments(bundle); //show schermpje.show(supportFragmentManager, "mydialog"); break; } } } FireMissilesDialogFragment public class FireMissilesDialogFragment extends DialogFragment { public static final String KEY_OK = "key_ok"; public static final String KEY_CANCEL = "key_cancel"; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final String textOK = getArguments().getString(KEY_OK); final String textCancel = getArguments().getString(KEY_CANCEL); // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage("Test") .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Toast.makeText(FireMissilesDialogFragment.this.getActivity(), textOK, Toast.LENGTH_SHORT).show(); } }) .setNegativeButton(android.R.string.cancel, new DialogInterface.On…
score: 0
type: Answer

http://stackoverflow.com/a/22839943
type: Answer
has body: You should look to http://docs.spring.io/spring/docs/4.0.3.RELEASE/javadoc-api/org/springframework/transaction/TransactionStatus.html . It has required functionality: - create savepoint - release savepoint - rollback to savepoint Of course, your transaction manager (and underlying JDBC driver, and DB) should support the functionality.
answers question: http://stackoverflow.com/q/22836854
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22836854
score: 0

http://stackoverflow.com/q/22934822
accepted answer: http://stackoverflow.com/a/29818502
has comment: http://stackoverflow.com/comment/35015501
has comment: http://stackoverflow.com/comment/35015855
tagged with: android
has comment: http://stackoverflow.com/comment/35016140
has comment: http://stackoverflow.com/comment/35013458
has comment: http://stackoverflow.com/comment/35036703
has comment: http://stackoverflow.com/comment/35019702
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35019903
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/35048764
has comment: http://stackoverflow.com/comment/35017044
type: Question
score: 0
has title: Deleting Buffers LibGdx
has body: I have created multiple Screens for my Libgdx game. Whenever I exit the game (Desktop Version), I am getting a red sentence in eclipse console, showing Deleting Buffers(1). The number is changing according to the Screen, which is active when I quit the game. What is this "Deleting Buffers"? Do I have to worry about that? Also the android version of my game crashes at the second Screen, while the desktop version is running perfectly. Thanks in advance. Screen1 public class Splash implements Screen { private SpriteBatch batch; private Sprite titleSprite; private Input input; @Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT); batch.begin(); titleSprite.draw(batch); batch.end(); Gdx.input.setInputProcessor(input); } @Override public void show() { batch = new SpriteBatch(); titleSprite = new Sprite(new Texture("img/Title.jpg")); titleSprite.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); titleSprite.setOrigin(titleSprite.getWidth() / 2f, titleSprite.getHeight() / 2f); titleSprite.setPosition( Gdx.graphics.getWidth() / 2f - titleSprite.getWidth() / 2f, Gdx.graphics.getHeight() / 2f - titleSprite.getHeight() / 2f); input = new Input() { public boolean keyDown(int keycode) { if (keycode == Keys.ENTER) { ((Game) Gdx.app.getApplicationListener()) .setScreen(new MainMenu()); Gdx.audio.newMusic(Gdx.files.internal("sounds/button.mp3")) .play(); dispose(); } if (keycode == Keys.ESCAPE) { Gdx.app.exit(); } return false; } @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { ((Game) Gdx.app.getApplicationListener()) .setScreen(new MainMenu()); dispose(); return super.touchDown(screenX, screenY, pointer, button); } }; } @Override public void dispose() { batch.dispose(); titleSprite.getTexture().dispose(); } } Screen2 public class MainMenu implements Screen { private Stage stage; private Table table; private TextButton playButton, exitButton; private Skin skin; private B…
answer count: 1
tagged with: user-interface
has answer: http://stackoverflow.com/a/29818502

http://stackoverflow.com/q/22939838
upvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22939994
possible better answer: http://stackoverflow.com/a/22939863
tagged with: java
has answer: http://stackoverflow.com/a/22939863
has answer: http://stackoverflow.com/a/22939927
type: Question
has comment: http://stackoverflow.com/comment/35022039
has title: Java "&" Operator
has body: Could somebody explain me why System.out.println((12 &amp; 9)); prints 8, please? I do not understand the logic of the &amp; operator at this context. Thanks!
linked to: http://stackoverflow.com/q/16162290
downvote count: 5
duplicate of: http://stackoverflow.com/q/16162290
has answer: http://stackoverflow.com/a/22939994
has comment: http://stackoverflow.com/comment/35019923
score: 1
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/22940160

http://stackoverflow.com/comment/34920820
has text: Make that method an instance method. You never need "global" data in a controller.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22881873

http://stackoverflow.com/q/22869673
has answer: http://stackoverflow.com/a/22869841
has title: How do I create a infinite loop in java
score: -3
accepted answer: http://stackoverflow.com/a/22869700
has answer: http://stackoverflow.com/a/22869799
favorite count: 0
linked to: http://stackoverflow.com/q/13806880
has comment: http://stackoverflow.com/comment/34892908
possible better answer: http://stackoverflow.com/a/22869799
has body: I am writting a simple programs using java for my school assignment. I cant find a way to create a infinte loop. Its a survey program which i have to redesign it so it does no only count 5 people but as many as I want untill I end it. Here is a code: class morecoffee { public static void main (String [] args) { Scanner input = new Scanner(System.in); int person, preference, nothing, sugar, sweetener, count, quit; nothing = sugar = sweetener = 0; for (count = 1; count &lt;=5; count++) { System.out.println ("How do you sweeten your coffee?"); System.out.println ("1. I don't"); System.out.println ("2. With sugar?"); System.out.println ("3. With sweetener?"); System.out.println ("4. Quit"); preference = input.nextInt(); if (preference == 1) nothing++; else if (preference == 2) sugar++; else if (preference == 3) sweetener++; if (preference == 4) count = 5; } count = count +1; System.out.println ("Survey Report"); System.out.println ("============="); System.out.println (nothing + " person don't sweeten coffee"); System.out.println (sugar + " person use sugar in coffee"); System.out.println (sweetener + " person use sweetener in coffee"); }
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7081339
has comment: http://stackoverflow.com/comment/34892921
tagged with: infinite
tagged with: java
downvote count: 3
tagged with: loops
has answer: http://stackoverflow.com/a/22869700
has answer: http://stackoverflow.com/a/22869806
type: Question
upvote count: 0

http://stackoverflow.com/q/22919134
answer count: 1
favorite count: 0
tagged with: settext
has comment: http://stackoverflow.com/comment/34982671
downvote count: 0
has body: I am trying to get some text displayed inside JTextField, the text should be taken from an ArrayList to which i add text using the addText method. I also want to be able to cycle through the Strings in the ArrayList using buttons. Text class import java.util.ArrayList; public class Text { private String text; public Text (String text) { this.text=text; } public String getText() { return text; } } TextDisplay class import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.ArrayList; public class TextDisplay { private JFrame frame; private JTextField text; private JButton next; private JButton back; private ArrayList&lt;Text&gt; someText; public TextDisplay () { makeFrame(); someText= new ArrayList&lt;Text&gt;(); } public void addText(String text) { Text sText = new Text(text); someText.add(sText); } private void makeFrame() {frame = new JFrame("text"); Container contentPane = frame.getContentPane(); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(1, 0)); text = new JTextField(); text.setEditable(false); contentPane.add(text, BorderLayout.NORTH); back = new JButton("back"); panel.add(back); next = new JButton("next"); panel.add(next); contentPane.add(panel,BorderLayout.WEST); frame.pack(); frame.setVisible(true); } } Can someone explain or show an example to me of how to achieve this?
has comment: http://stackoverflow.com/comment/34983420
tagged with: swing
has answer: http://stackoverflow.com/a/22919328
accepted answer: http://stackoverflow.com/a/22919328
tagged with: jtextfield
score: 2
type: AnsweredQuestion
has title: JTextField text display
tagged with: java
type: Question
upvote count: 2

android
tags question: http://stackoverflow.com/q/22871232
tags question: http://stackoverflow.com/q/22959554
tags question: http://stackoverflow.com/q/22926964
tags question: http://stackoverflow.com/q/22892078
tags question: http://stackoverflow.com/q/22965673
tags question: http://stackoverflow.com/q/22902869
tags question: http://stackoverflow.com/q/22927035
tags question: http://stackoverflow.com/q/22892461
tags question: http://stackoverflow.com/q/22824675
tags question: http://stackoverflow.com/q/22909073
tags question: http://stackoverflow.com/q/22918086
tags question: http://stackoverflow.com/q/22965992
tags question: http://stackoverflow.com/q/22844503
tags question: http://stackoverflow.com/q/22907869
tags question: http://stackoverflow.com/q/22836819
tags question: http://stackoverflow.com/q/22888273
tags question: http://stackoverflow.com/q/22935198
tags question: http://stackoverflow.com/q/22855759
tags question: http://stackoverflow.com/q/22905486
tags question: http://stackoverflow.com/q/22855592
tags question: http://stackoverflow.com/q/22847509
tags question: http://stackoverflow.com/q/22934744
tags question: http://stackoverflow.com/q/22860678
tags question: http://stackoverflow.com/q/22949514
tags question: http://stackoverflow.com/q/22948156
tags question: http://stackoverflow.com/q/22811650
tags question: http://stackoverflow.com/q/22811130
tags question: http://stackoverflow.com/q/22950101
tags question: http://stackoverflow.com/q/22919566
tags question: http://stackoverflow.com/q/22842235
tags question: http://stackoverflow.com/q/22893625
tags question: http://stackoverflow.com/q/22844003
tags question: http://stackoverflow.com/q/22911514
tags question: http://stackoverflow.com/q/22942896
tags question: http://stackoverflow.com/q/22855303
tags question: http://stackoverflow.com/q/22923228
tags question: http://stackoverflow.com/q/22848784
tags question: http://stackoverflow.com/q/22857710
tags question: http://stackoverflow.com/q/22838251
tags question: http://stackoverflow.com/q/22863641
tags question: http://stackoverflow.com/q/22951538
tags question: http://stackoverflow.com/q/22924174
tags question: http://stackoverflow.com/q/22906218
tags question: http://stackoverflow.com/q/22829405
tags question: http://stackoverflow.com/q/22904170
tags question: http://stackoverflow.com/q/22839266
tags question: http://stackoverflow.com/q/22922134
tags question: http://stackoverflow.com/q/22860603
tags question: http://stackoverflow.com/q/22880402
tags question: http://stackoverflow.com/q/22883246
tags question: http://stackoverflow.com/q/22960071
tags question: http://stackoverflow.com/q/22824209
tags question: http://stackoverflow.com/q/22935466
tags question: http://stackoverflow.com/q/22881239
tags question: http://stackoverflow.com/q/22897002
tags question: http://stackoverflow.com/q/22862873
tags question: http://stackoverflow.com/q/22955840
tags question: http://stackoverflow.com/q/22855836
tags question: http://stackoverflow.com/q/22895289
tags question: http://stackoverflow.com/q/22934689
tags question: http://stackoverflow.com/q/22891147
tags question: http://stackoverflow.com/q/22929038
tags question: http://stackoverflow.com/q/22956584
tags question: http://stackoverflow.com/q/22826640
tags question: http://stackoverflow.com/q/22890864
tags question: http://stackoverflow.com/q/22903804
tags question: http://stackoverflow.com/q/22888173
tags question: http://stackoverflow.com/q/22815022
tags question: http://stackoverflow.com/q/22877895
tags question: http://stackoverflow.com/q/22920212
tags question: http://stackoverflow.com/q/22933715
tags question: http://stackoverflow.com/q/22879781
tags question: http://stackoverflow.com/q/22886351
tags question: http://stackoverflow.com/q/22836971
tags question: http://stackoverflow.com/q/22889903
tags question: http://stackoverflow.com/q/22898147
tags question: http://stackoverflow.com/q/22827441
tags question: http://stackoverflow.com/q/22881326
tags question: http://stackoverflow.com/q/22823731
tags question: http://stackoverflow.com/q/22855318

http://stackoverflow.com/a/22861911
has comment: http://stackoverflow.com/comment/34878708
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34879213
has comment: http://stackoverflow.com/comment/34878746
has comment: http://stackoverflow.com/comment/42153920
type: Answer
accepted answer of: http://stackoverflow.com/q/22861828
has body: JavaScript has no concept of character encoding for String, everything is in UTF-16. Most of time time the value of a char in UTF-16 matches UTF-8, so you can forget it's any different. There are more optimal ways to do this but function s(x) {return x.charCodeAt(0);} "test.message".split('').map(s); // [116, 101, 115, 116, 46, 109, 101, 115, 115, 97, 103, 101] So what is unescape(encodeURIComponent(str)) doing? Let's look at each individually, encodeURIComponent is converting every character in str which is illegal or has a meaning in URI Syntax into a URI escaped version so that there is no problem using it as a key or value in the search component of a URI, for example encodeURIComponent('&amp;='); // "%26%3D" Notice how this is now a 6 character long String. unescape is actually depreciated, but it does a similar job to decodeURI or decodeURIComponent (the reverse of encodeURIComponent). If we look in the ES5 spec we can see 11. Let c be the character whose code unit value is the integer represented by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5 within Result(1). So, 4 digits is 2 bytes is "UTF-8", however as I mentioned, all Strings are UTF-16, so it's really a UTF-16 string limiting itself to UTF-8.
has comment: http://stackoverflow.com/comment/34879433
upvote count: 11
answers question: http://stackoverflow.com/q/22861828
has comment: http://stackoverflow.com/comment/34880842
downvote count: 1
has comment: http://stackoverflow.com/comment/34879114
score: 10

http://stackoverflow.com/q/22820351
type: Question
tagged with: javacard
has comment: http://stackoverflow.com/comment/34822347
has comment: http://stackoverflow.com/comment/34822701
has comment: http://stackoverflow.com/comment/34843213
tagged with: tlv
upvote count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34848923
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34833600
has comment: http://stackoverflow.com/comment/34848847
has comment: http://stackoverflow.com/comment/34811899
has comment: http://stackoverflow.com/comment/34818175
answer count: 0
score: 1
tagged with: java
has body: I have imported all the necessary tlv libraries (library for JavaCard) to the Java SE application, but it does not work as expected. Example, in the JavaCard applet, when I try to run: byte data[] = {(byte) 0xc1, (byte) 0x02, (byte) 0x01, (byte) 0x02}; if (BERTLV.verifyFormat(data, (short) 0, (short) 4)) { ISOException.throwIt((short) 0x6666); } The status word I received is 0x6666. That is, data is a well-formed BER TLV representation. But, when I try to run the Java SE code: byte data[] = {(byte) 0xc1, (byte) 0x02, (byte) 0x01, (byte) 0x02}; System.out.println(BERTLV.verifyFormat(data, (short) 0, (short) 4)); The result is false. That is, data is not a well-formed BER TLV representation. Similarly, some other functions do not work correctly in the Java SE application. How can I fix it? Thanks for reading.
has title: Can't use the BER TLV library (JavaCard) in Java SE application?

http://stackoverflow.com/comment/35019664
comment on: http://stackoverflow.com/q/22938813
type: Comment
score: 0
has text: Why do you need the server to add two numbers together? Why can't you just say `var myValue = value1 + value2;`?
type: QuestionComment

http://stackoverflow.com/comment/35022391
type: QuestionComment
comment on: http://stackoverflow.com/q/22883315
has text: then pass it as integer, do putExtra("PATH", integer); then path = .getIntExtra("PATH", 0);... check if (path != 0) openRawResource(path);
score: 0
type: Comment

http://stackoverflow.com/comment/34799970
type: QuestionComment
comment on: http://stackoverflow.com/q/22810331
has text: Also, it seems whether the bug reproduces or not depends on some obscure factors, like presence of extra imports or volatility or variables not used in the thread (but declared in the same class)
score: 0
type: Comment

http://stackoverflow.com/a/64427509
answers question: http://stackoverflow.com/q/22880287
score: 0
type: Answer
has body: public boolean evenlySpaced(int a, int b, int c) { int small = Math.min(a,b); small = Math.min(small,c); int large = Math.max(a,b); large = Math.max(large,c); int medium = (small + large)/2; boolean flag = false; if(a == medium || b == medium || c == medium) flag = true; return ((large - medium) == (medium - small) &amp;&amp; flag); }

http://stackoverflow.com/comment/34917369
type: QuestionComment
comment on: http://stackoverflow.com/q/22882887
has text: @YsrShk no, the questions are totally different. Tomcat doesn't find it out through java code, it finds it out through system variables.
score: 0
type: Comment

http://stackoverflow.com/comment/34949321
score: 0
has text: Thank you Stripling! Is there anything else I should know about the difference between the C# properties and Java fields?
type: Comment
comment on: http://stackoverflow.com/a/22900528
type: AnswerComment

http://stackoverflow.com/comment/34858621
type: AnswerComment
comment on: http://stackoverflow.com/a/22850326
type: Comment
has text: No, because this variant relies on multiple inheritance. And that's why it can't be done in java (because java doesn't support multiple inheritance. christopher already answered this in the comments.
score: 0

jtable
tags question: http://stackoverflow.com/q/22953913
tags question: http://stackoverflow.com/q/22938649
tags question: http://stackoverflow.com/q/22966183
tags question: http://stackoverflow.com/q/22960787
tags question: http://stackoverflow.com/q/22887192
tags question: http://stackoverflow.com/q/22869785
tags question: http://stackoverflow.com/q/22957717
tags question: http://stackoverflow.com/q/22871975
tags question: http://stackoverflow.com/q/22961403
tags question: http://stackoverflow.com/q/22856643
tags question: http://stackoverflow.com/q/22820564
type: Tag
tags question: http://stackoverflow.com/q/22826785
tags question: http://stackoverflow.com/q/22812005
tags question: http://stackoverflow.com/q/22810418
tags question: http://stackoverflow.com/q/22880742
tags question: http://stackoverflow.com/q/22854878
tags question: http://stackoverflow.com/q/22937613
tags question: http://stackoverflow.com/q/22960849
tag name: jtable
tags question: http://stackoverflow.com/q/22864095
tags question: http://stackoverflow.com/q/22858268
tags question: http://stackoverflow.com/q/22867838
tags question: http://stackoverflow.com/q/22920371
tags question: http://stackoverflow.com/q/22812922
tags question: http://stackoverflow.com/q/22917572
tags question: http://stackoverflow.com/q/22839163
tags question: http://stackoverflow.com/q/22842910
tags question: http://stackoverflow.com/q/22884087
tags question: http://stackoverflow.com/q/22857833
tags question: http://stackoverflow.com/q/22817312
tags question: http://stackoverflow.com/q/22866426
tags question: http://stackoverflow.com/q/22931243
tags question: http://stackoverflow.com/q/22816564
tags question: http://stackoverflow.com/q/22907730
tags question: http://stackoverflow.com/q/22966603
tags question: http://stackoverflow.com/q/22863808

http://stackoverflow.com/comment/35003223
type: Comment
has text: I am asking whther you are using any web framework ?
comment on: http://stackoverflow.com/q/22891348
score: 0
type: QuestionComment

http://stackoverflow.com/q/22841559
has title: Updating Rendered Tree Cells
answer count: 1
has answer: http://stackoverflow.com/a/22861399
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22861399
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/40480
tagged with: treecellrenderer
tagged with: swing
tagged with: nodes
type: Question
has body: Here is my application. What I want to do is make it so that when the user's details are updated, so does it's node in the JTree. Is this possible; even though the JTree and it's rendered cells have already been created? I need an example of updating a rendered cell even after it has already been created. Here is my View code: void createTree() { rootNode = new DefaultMutableTreeNode("users"); for (User user : listOfUsers) { String id = user.getId(); File file = new File(id); DefaultMutableTreeNode node = new DefaultMutableTreeNode(file); rootNode.add(node); } treeModel = new DefaultTreeModel(rootNode); tree = new JTree(rootNode); } void addTreeModelListener(TreeModelListener a) { treeModel.addTreeModelListener(a); } void repaintTree() { treeModel.reload(); tree.revalidate(); tree.repaint(); } And here is my Controller code: view.addTreeModelListener(new MyTreeModelListener()); class MyTreeModelListener implements TreeModelListener { public void treeNodesChanged(TreeModelEvent e) { DefaultMutableTreeNode node; node = (DefaultMutableTreeNode)(e.getTreePath().getLastPathComponent()); int index = e.getChildIndices()[0]; node = (DefaultMutableTreeNode)(node.getChildAt(index)); System.out.println("The user has finished editing the node."); System.out.println("New value: " + node.getUserObject()); } public void treeNodesInserted(TreeModelEvent e) {} public void treeNodesRemoved(TreeModelEvent e) {} public void treeStructureChanged(TreeModelEvent e) {} } The idea is after the changes to the objects have been made, I call the repaintTree() method. After looking over the code now, I think the problem lies in the fact that I'm changing the object details and not the node details, but that's just a hunch. Please reply soon, many thanks.
tagged with: jtree

http://stackoverflow.com/q/22928025
has comment: http://stackoverflow.com/comment/34999176
has comment: http://stackoverflow.com/comment/34999232
favorite count: 0
has body: I am making a web application in which I pass a Int value from a servlet to next jsp page like this : request.setAttribute("n",n); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/sharingfilesselection.jsp"); dispatcher.forward(request, response); Now on the next page i.e sharingfilesselection.jsp I want that n textboxes are created dynamically each with a different id as i need to store the values of these textboxes in my database. The N is obtained on next jsp page by this : Object N=request.getAttribute("n"); How this can be done using javascript ?Please help
linked to: http://stackoverflow.com/q/13989741
has comment: http://stackoverflow.com/comment/34999115
has answer: http://stackoverflow.com/a/22928169
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/22928225
type: Question
has title: Creating Multiple textboxes dynamically
tagged with: java
tagged with: javascript
score: -1
possible better answer: http://stackoverflow.com/a/22928169
tagged with: servlets
has answer: http://stackoverflow.com/a/22928168
accepted answer: http://stackoverflow.com/a/22928168
answer count: 3
downvote count: 1
tagged with: jsp

http://stackoverflow.com/q/22847108
answer count: 1
has body: I'm working with Spring AMQP to create queues in RabbitMQ. I'd like to have a queue whose name includes the name of the machine that the app is running on. So the queue name might be "fooQueue.host1" or "fooQueue.host2" depending on where you run the app. I've figured out a way to do this (detailed below) but it seems a little complicated. Is there an easier/better/Spring-ier way to accomplish this? My Solution First make a bean to fetch the machine name: public class MachineNamePropertyBean { public String GetMachineName() throws UnknownHostException { InetAddress localMachine = InetAddress.getLocalHost(); return localMachine.getHostName(); } } Then register the bean in your Spring config: &lt;bean id="machineNameBean" class="com.example.myapp.MachineNamePropertyBean" /&gt; then use it in your Spring AMQP config like this: &lt;rabbit:queue id="fooQueue" name="fooQueue.#{ machineNameBean.GetMachineName() }" durable="false" auto-delete="false" exclusive="false" /&gt;
favorite count: 0
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: spring-amqp
upvote count: 1
accepted answer: http://stackoverflow.com/a/22847387
downvote count: 0
tagged with: spring-el
has answer: http://stackoverflow.com/a/22847387
has title: Spring AMQP: Queue with machine name

http://stackoverflow.com/comment/34850857
type: QuestionComment
score: 1
has text: Hi David, I should found that you have told me the right answer in your first comment earlier, and it works currently, thanks for your help, Runtime.getRuntime().exec(new String[]{"sh","-c","gzip -c /tmp/specificPreffix_2013-11-06.txt > /tmp/specificPreffix_2013-11-06.txt.gz",}); is the correct one. Thank you very much.
comment on: http://stackoverflow.com/q/22844268
type: Comment

http://stackoverflow.com/q/22858223
tagged with: modularity
has title: OSGi Bundle not get resolved automatically
type: Question
has answer: http://stackoverflow.com/a/22885850
has answer: http://stackoverflow.com/a/22858344
answer count: 3
tagged with: equinox
tagged with: osgi
accepted answer: http://stackoverflow.com/a/22858344
has body: I have a simple OSGi bundle written and here is the source file. When I install it in a equinox OSGi container it does not get resolved it automatically. Can someone explain what I'm doing wrong here??. package org.sample.api; /** * Created on 3/11/14. */ public interface Hello { void sayHello(); } This is the pom.xml file of the bundle. <?xml version="1.0" encoding="UTF-8"?> osgi osgi 1.0 4.0.0 sample-api 1.0 bundle org.apache.felix maven-bundle-plugin 2.3.5 true Sample Inc ${project.artifactId} org.sample.api*;version=1.0.0 MANIFEST.MF Manifest-Version: 1 Bnd-LastModified: 1396602001251 Build-Jdk: 1.6.0_45 Built-By: Zeus Bundle-ManifestVersion: 2 Bundle-Name: sample-api Bundle-SymbolicName: sample-api Bundle-Vendor: Sample Inc Bundle-Version: 1.0.0 Created-By: Apache Maven Bundle Plugin Export-Package: org.sample.api;version="1.0.0" Tool: Bnd-1.43.0 This is the bundle installation console output Bundle id is 7 RegisteredServices null ServicesInUse null LoaderProxy sample-api; bundle-version="1.0.0" Fragments null ClassLoader null Version 1.0.0 LastModified 1396605985751 Headers Bnd-LastModified = 1396602001251 Build-Jdk = 1.6.0_45 Built-By = Zeus Bundle-ManifestVersion = 2 Bundle-Name = sample-api Bundle-SymbolicName = sample-api Bundle-Vendor = Sample Inc Bundle-Version = 1.0.0 Created-By = Apache Maven Bundle Plugin Export-Package = org.sample.api;version="1.0.0" Manifest-Version = 1 Tool = Bnd-1.43.0 BundleContext null BundleId 7 StartLevel 1 SymbolicName sample-api BundleData sample-api_1.0.0 KeyHashCode 7 StateChanging null BundleDescription sample-api_1.0.0 Framework org.eclipse.osgi.framework.internal.core.Framework@65cb687f ResolutionFailureException org.osgi.framework.BundleException: The bundle "sample-api_1.0.0 [7]" could not be resolved Revisions [sample-api_1.0.0] Key 7 ProtectionDomain null Location file:/home/Zeus/idea-projects/osgi/sample-api/target/sample-api-1.0.jar State 2 Bundle 7|Installed | 1|sample-api (1.0.0)
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9675298
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/22884504
has answer: http://stackoverflow.com/a/22884504

http://stackoverflow.com/comment/35031360
type: AnswerComment
has text: Will have a go at using your code. As far as runners is concerned - assuming I have not misread the instructions, it is required to be private. if you mean the list then that's how the examples I have use it. If there is a problem with either of these variables I will contact my tutor. In the meantime I thank you for your help.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22939139

http://stackoverflow.com/comment/34946181
type: QuestionComment
comment on: http://stackoverflow.com/q/22895000
score: 0
type: Comment
has text: I want to create a class, which its methods follow the next rules: all methods have the same privacy level, have the same return type, have the same parameters, have the same checked exception list. The only thing different between the methods is the name... I can take "no" for an answer

http://stackoverflow.com/comment/65125593
type: Comment
comment on: http://stackoverflow.com/a/38231289
type: AnswerComment
has text: On windows, alt+up/down is for Previous/Next method. I believe this is default settings.
score: 0

http://stackoverflow.com/comment/34874511
has text: it will throw exception if you are using list as final.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22859434
type: AnswerComment

http://stackoverflow.com/comment/35041682
comment on: http://stackoverflow.com/q/22951702
score: 1
type: Comment
has text: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html - first paragraph.
type: QuestionComment

http://stackoverflow.com/q/22966176
score: 12
has answer: http://stackoverflow.com/a/32887126
has answer: http://stackoverflow.com/a/23048879
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/35067159
has comment: http://stackoverflow.com/comment/35067240
has comment: http://stackoverflow.com/comment/35067048
favorite count: 0
has title: Creating a custom FileSystem implementation in Java
has comment: http://stackoverflow.com/comment/43560555
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/51457196
tagged with: java
type: Question
tagged with: filesystems
has comment: http://stackoverflow.com/comment/35066980
has body: I read on oracle that it is possible to create a custom FileSystem, but I can't really find much documentation on creating one. Could anyone link me to somewhere I can learn more about custom FileSystems? Where I read about this: http://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/filesystemprovider.html
upvote count: 14

http://stackoverflow.com/q/22941572
has comment: http://stackoverflow.com/comment/35023296
has body: This code written in JAVA program I'm using this events to press Escape key and then to release the Escape key keyRelease "r.keyPress(KeyEvent.VK_ESCAPE); r.keyRelease(KeyEvent.VK_ESCAPE);" in for loop but upon execution of this code "Escape key" is executing twice. Kindly help
upvote count: 2
tagged with: keypress
favorite count: 0
type: UnansweredQuestion
has title: How to release all keys
score: 2
downvote count: 0
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35024008

http://stackoverflow.com/comment/34910623
has text: Added in a mini-tutorial on how to write the code, should guide you through the process nicely.
comment on: http://stackoverflow.com/a/22827735
type: Comment
score: 0
type: AnswerComment

autowired
tags question: http://stackoverflow.com/q/22925951
tags question: http://stackoverflow.com/q/22958464
tags question: http://stackoverflow.com/q/22955543
type: Tag
tags question: http://stackoverflow.com/q/22898562
tags question: http://stackoverflow.com/q/22884096
tag name: autowired

http://stackoverflow.com/q/22967748
type: Question
tagged with: apache-camel
has title: Apache Camel auto type convert Protobuf in routes
has answer: http://stackoverflow.com/a/23007350
score: 0
has body: I have a topic set up with using Camel and ActiveMQ which receives messages as a byte array of a protobuf. The receive route looks like this: &lt;route&gt; &lt;from uri="jmsComponent:topic:{{heartbeat}}" /&gt; &lt;unmarshal&gt; &lt;protobuf instanceClass="protobuf.HeartbeatProto" /&gt; &lt;/unmarshal&gt; &lt;to uri="bean:heartbeatConsumer" /&gt; &lt;/route&gt; The heartbeatConsumer only has one method that takes the POJO version of a Heartbeat. In order for this to work, I have a type converter that converts to/from POJO to protobuf. This works very well and Camel is able to take the byte array and pass it to the heartbeatConsumer as a POJO. My issue comes with the sender. I have my sending route setup as: &lt;route&gt; &lt;from uri="quartz2://heartbeatJob?cron=0/30+*+*+*+*+?" /&gt; &lt;to uri="bean:heartbeat?method=sendHeartbeat" /&gt; &lt;marshal&gt; &lt;protobuf instanceClass="protobuf.HeartbeatProto" /&gt; &lt;/marshal&gt; &lt;to uri="jmsComponent:topic:{{heartbeat}}" /&gt; &lt;/route&gt; It gives me the exception: 'java.lang.ClassCastException: protobuf.HeartbeatProto cannot be cast to com.google.protobuf.Message' Why would it be able to automatically type converter in the receive route, but not in the sending route?
answer count: 1
tagged with: protocol-buffers
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/131189680
type: Comment
comment on: http://stackoverflow.com/a/22842806
has text: In macOS Ventura, it's ~/.zprofile
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34960883
type: QuestionComment
comment on: http://stackoverflow.com/q/22861853
has text: My other classes have the same code for double click listener and selection change listener on the same tree and it works fine, but in this class it throws an assertion failed exception, What could be the possible reasons for this kind of exception? Could u please tell me few possible reasons so that I can look into it?
score: 0
type: Comment

http://stackoverflow.com/comment/34892426
score: 0
type: Comment
type: AnswerComment
has text: While this is correct, this is the wrong way of doing it. Perhaps you should suggest a more appropriate way.
comment on: http://stackoverflow.com/a/22869411

http://stackoverflow.com/comment/34998711
has text: So, update, I also tried making my masterList be the datasource for the report, and then passing in parameters as $F{t1}, $F{disclaimer}, etc., but to no avail. Although it compiles, it doesn't even seem to print any portion of the subreport at all...
score: 0
comment on: http://stackoverflow.com/q/22923699
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35006351
type: QuestionComment
has text: possible duplicate of [Java Swing table tree](http://stackoverflow.com/questions/7122901/java-swing-table-tree)
score: 0
comment on: http://stackoverflow.com/q/22931829
type: Comment

http://stackoverflow.com/comment/35055491
comment on: http://stackoverflow.com/a/22960088
score: 0
has text: I have `scale_factor` defined in another class as `static float`. I can't make it final, because it's value is not a constant, it depends on the screens density, I get it's value doing: `getResources().getDisplayMetrics().density;`
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34940677
has text: Get the value, subtract from it, and put it back. An `ArrayList` is not an array.
type: QuestionComment
comment on: http://stackoverflow.com/q/22895991
type: Comment
score: 0

http://stackoverflow.com/q/22949908
has comment: http://stackoverflow.com/comment/35038861
type: AnsweredQuestion
tagged with: sql
has answer: http://stackoverflow.com/a/22950313
has body: I'd like to create a ranking in a MySQL-Table for Users, sorted by their score. I already found a nice Query for that, but this Query is only working with phpmyadmin, not in java... I got the following MySQL-Query which works well in phpmyadmin to create a Ranking: SET @r=0; UPDATE `hg_stats` SET `stats_rank`= @r:= (@r+1) ORDER BY `stats_score` DESC; In Java: try { preparedStatement = connection.prepareStatement("SET @r=0; UPDATE `hg_stats` SET `stats_rank`= @r:= (@r+1) ORDER BY `stats_score` DESC;"); preparedStatement.executeQuery(); } catch (SQLException e) { e.printStackTrace(); } I am getting the following Error and the Query is not working: [00:09:50] [Server thread/WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE `hg_stats` SET `stats_rank`= @r:= (@r+1) ORDER BY `stats_score` DESC' at line 1 [00:09:50] [Server thread/WARN]: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [00:09:50] [Server thread/WARN]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [00:09:50] [Server thread/WARN]: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [00:09:50] [Server thread/WARN]: at java.lang.reflect.Constructor.newInstance(Unknown Source) [00:09:50] [Server thread/WARN]: at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) [00:09:50] [Server thread/WARN]: at com.mysql.jdbc.Util.getInstance(Util.java:382) [00:09:50] [Server thread/WARN]: at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) [00:09:50] [Server thread/WARN]: at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593) [00:09:50] [Server thread/WARN]: at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525) [00:09:50] [Server thread/WARN]: at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986) [00:09:50] [Server thread/WARN]: at com.mysql.jdbc.MysqlIO.sqlQue…
type: Question
tagged with: jdbc
has comment: http://stackoverflow.com/comment/35038562
accepted answer: http://stackoverflow.com/a/22950313
has comment: http://stackoverflow.com/comment/35039033
has title: Using a mysql-variable in java (for a ranking-query)
score: 0
answer count: 1
tagged with: java
tagged with: mysql
tagged with: ranking

http://stackoverflow.com/comment/34788251
type: Comment
type: QuestionComment
has text: possible duplicate of [Run a simple text file as Java](http://stackoverflow.com/questions/6226063/run-a-simple-text-file-as-java)
comment on: http://stackoverflow.com/q/22811478
score: 0

http://stackoverflow.com/a/22906389
has body: There should be a -main function in ns Physics.core =&gt; (load "core") directly looks for core.clj in the src folder. You should use (load "Physics/core") instead. (defn restart [] (reload) (-main) ) Here, you should write (declare -main) before this form
has comment: http://stackoverflow.com/comment/34960063
has comment: http://stackoverflow.com/comment/34963924
has comment: http://stackoverflow.com/comment/34959710
has comment: http://stackoverflow.com/comment/34961468
has comment: http://stackoverflow.com/comment/34961758
has comment: http://stackoverflow.com/comment/34959670
has comment: http://stackoverflow.com/comment/34962151
has comment: http://stackoverflow.com/comment/34959652
has comment: http://stackoverflow.com/comment/34961631
downvote count: 0
has comment: http://stackoverflow.com/comment/34959885
has comment: http://stackoverflow.com/comment/34960394
has comment: http://stackoverflow.com/comment/34963037
has comment: http://stackoverflow.com/comment/34960022
has comment: http://stackoverflow.com/comment/34959601
has comment: http://stackoverflow.com/comment/34963604
upvote count: 2
has comment: http://stackoverflow.com/comment/34961824
answers question: http://stackoverflow.com/q/22906321
type: Answer
has comment: http://stackoverflow.com/comment/34960155
has comment: http://stackoverflow.com/comment/34960969
has comment: http://stackoverflow.com/comment/34960192
has comment: http://stackoverflow.com/comment/34960029
score: 2
has comment: http://stackoverflow.com/comment/34959968
has comment: http://stackoverflow.com/comment/34959887
has comment: http://stackoverflow.com/comment/34959534

http://stackoverflow.com/q/22900290
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22901614
has title: Moving to different servlet other than form action
tagged with: java
tagged with: servlets
type: Question
has body: I am having a form : <%String namee=rs.getString(2);%> <input name="IndUserName" type="hidden" value="<%=namee%>"/> User Name : <%=namee%> First Name : <%=rs.getString(4)%> Last Name : <%=rs.getString(5)%> Email Id : <%=rs.getString(6)%> Contact : <%=rs.getString(7)%> <% String groupidd = request.getSession().getAttribute("groupid").toString(); s=null; rs=null; int flag=0; String sql="select * from TBGROUPUSERS where I_ID=? and GU_GROUPID=?"; s = con.prepareStatement(sql); s.setString(1,idperson); s.setString(2,groupidd); rs=s.executeQuery(); if(rs.next()) flag=1; request.setAttribute("flag", flag); %> <c:choose> <c:when test="${requestScope.flag == 1}"> <a href="CancelRequest?userid=<%=idperson%>&userrnamee=<%=namee%>" onclick="return confirm('Are you sure you want to cancel the request?');"> </c:when> <c:otherwise> </c:otherwise> </c:choose> Now ,In this part of code : <a href="CancelRequest?userid=<%=idperson%>&userrnamee=<%=namee%>" onclick="return confirm('Are you sure you want to cancel the request?');"> I want to move to servlet CancelRequest.java with this given parameters.But as the form action goes to sendaddnotification,So this servlet never runs. How to make it run on click of this button.Please help
answer count: 1
tagged with: jsp
score: 0

http://stackoverflow.com/a/22892229
answers question: http://stackoverflow.com/q/22892189
upvote count: 3
has body: Synchronizing on an object doesn't prevent any thread to access this object. It prevents other thread to execute any block of code which is also synchronized on the same object. So if you have public class Foo { } public class SharedState private final Foo foo = new Foo(); private long value; public void increment() { synchronized (foo) { value++; } } public long getValue() { synchronized (foo) { return value; } } } Then if one thread is currently incrementing or getting the value, no other thread won't be able to increment or read the value at the same time. If you add a method public Foo getFoo() { return foo; } to the SharedState, any thread will be able to call it, and to call any method of foo concurrently.
type: Answer
score: 3
downvote count: 0

spring-mvc
tags question: http://stackoverflow.com/q/22839116
tags question: http://stackoverflow.com/q/22906178
tags question: http://stackoverflow.com/q/22848738
tags question: http://stackoverflow.com/q/22952047
tags question: http://stackoverflow.com/q/22933083
tags question: http://stackoverflow.com/q/22856600
tags question: http://stackoverflow.com/q/22899057
tags question: http://stackoverflow.com/q/22951785
tags question: http://stackoverflow.com/q/22923967
tags question: http://stackoverflow.com/q/22884096
tags question: http://stackoverflow.com/q/22830430
tags question: http://stackoverflow.com/q/22877350
tags question: http://stackoverflow.com/q/22839322
tags question: http://stackoverflow.com/q/22866735
tags question: http://stackoverflow.com/q/22880749
tags question: http://stackoverflow.com/q/22811227
tags question: http://stackoverflow.com/q/22875803
tags question: http://stackoverflow.com/q/22876113
tags question: http://stackoverflow.com/q/22898895
tags question: http://stackoverflow.com/q/22902372
tags question: http://stackoverflow.com/q/22822744
tags question: http://stackoverflow.com/q/22860616
tags question: http://stackoverflow.com/q/22922834
tags question: http://stackoverflow.com/q/22853168
tags question: http://stackoverflow.com/q/22834816
tags question: http://stackoverflow.com/q/22822577
tags question: http://stackoverflow.com/q/22845543
tags question: http://stackoverflow.com/q/22955225
tags question: http://stackoverflow.com/q/22893772
tags question: http://stackoverflow.com/q/22893309
tags question: http://stackoverflow.com/q/22869901
tags question: http://stackoverflow.com/q/22824889
tags question: http://stackoverflow.com/q/22852842
tag name: spring-mvc
tags question: http://stackoverflow.com/q/22832524
tags question: http://stackoverflow.com/q/22910399
tags question: http://stackoverflow.com/q/22864187
tags question: http://stackoverflow.com/q/22865329
tags question: http://stackoverflow.com/q/22859532
tags question: http://stackoverflow.com/q/22863165
tags question: http://stackoverflow.com/q/22965810
tags question: http://stackoverflow.com/q/22943034
tags question: http://stackoverflow.com/q/22920475
type: Tag
tags question: http://stackoverflow.com/q/22906565
tags question: http://stackoverflow.com/q/22918231
tags question: http://stackoverflow.com/q/22935136
tags question: http://stackoverflow.com/q/22917298
tags question: http://stackoverflow.com/q/22853509
tags question: http://stackoverflow.com/q/22844988
tags question: http://stackoverflow.com/q/22838225
tags question: http://stackoverflow.com/q/22942614
tags question: http://stackoverflow.com/q/22836448
tags question: http://stackoverflow.com/q/22939074
tags question: http://stackoverflow.com/q/22869403
tags question: http://stackoverflow.com/q/22828189
tags question: http://stackoverflow.com/q/22904665
tags question: http://stackoverflow.com/q/22860381
tags question: http://stackoverflow.com/q/22824469
tags question: http://stackoverflow.com/q/22879169
tags question: http://stackoverflow.com/q/22821695
tags question: http://stackoverflow.com/q/22841156
tags question: http://stackoverflow.com/q/22812604
tags question: http://stackoverflow.com/q/22811908
tags question: http://stackoverflow.com/q/22876798
tags question: http://stackoverflow.com/q/22889632
tags question: http://stackoverflow.com/q/22856020
tags question: http://stackoverflow.com/q/22845524
tags question: http://stackoverflow.com/q/22919777
tags question: http://stackoverflow.com/q/22898562
tags question: http://stackoverflow.com/q/22947751
tags question: http://stackoverflow.com/q/22938689
tags question: http://stackoverflow.com/q/22877207
tags question: http://stackoverflow.com/q/22864931
tags question: http://stackoverflow.com/q/22945386
tags question: http://stackoverflow.com/q/22877511
tags question: http://stackoverflow.com/q/22883324
tags question: http://stackoverflow.com/q/22962128
tags question: http://stackoverflow.com/q/22878575
tags question: http://stackoverflow.com/q/22838745

http://stackoverflow.com/comment/35045244
has text: @TheLittleNaruto yes,but i am getting this error.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22953533

http://stackoverflow.com/a/22829226
answers question: http://stackoverflow.com/q/22825033
upvote count: 3
has body: What TextureFilter settings are you using in your code or in the texturepacker? Try the "Nearest" filter. If you have set it to "Linear" or alike, it will always take 4 texture pixels (texels) and interpolate them to get the color of the pixel to be drawn. That might help against the blur, but I am not sure if it will produce exactly that 8-bit look you are aiming for...
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22825033

http://stackoverflow.com/comment/35836608
score: 0
type: Comment
type: QuestionComment
has text: Did you find out the answer to this by any chance? I'm puzzled by the same scenario
comment on: http://stackoverflow.com/q/22878504

http://stackoverflow.com/q/22810553
type: Question
has answer: http://stackoverflow.com/a/22810733
has answer: http://stackoverflow.com/a/22811837
linked to: http://stackoverflow.com/q/787700
has body: I am trying to calculate the average of an array list. So far the numbers are added together, however when I try to divide them by the size of the array, it does not work. Here is my code: public int mean (ArrayList&lt;Integer&gt; number) { int sum = 0; int counter = 0; for (Integer meanInt :number) { sum+=meanInt; counter++; } return sum / counter; }
answer count: 6
has answer: http://stackoverflow.com/a/22810631
upvote count: 2
has answer: http://stackoverflow.com/a/22811095
score: 0
tagged with: java
downvote count: 2
tagged with: average
has comment: http://stackoverflow.com/comment/34786447
has comment: http://stackoverflow.com/comment/34786376
has title: Need to return the mean value of an Array List
has answer: http://stackoverflow.com/a/22810724
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34786373
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34786502
has answer: http://stackoverflow.com/a/22810600
favorite count: 0
has comment: http://stackoverflow.com/comment/34786573

http://stackoverflow.com/comment/34851708
has text: There is a way I can configure the repository to download the correct .classpath? Because I remember that the first time I downloaded the project there were no need to configure anything!
comment on: http://stackoverflow.com/a/22843712
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34866798
type: Comment
score: 0
has text: ok ok thanks for your suggestion...i'll check in debugging mode.
type: AnswerComment
comment on: http://stackoverflow.com/a/22854653

http://stackoverflow.com/comment/34962659
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22906398
score: 0
has text: @fge I have this `Path dir = Paths.get("./brieven").toRealPath();` and this `Desktop.getDesktop().open(dir.toFile());` and when I print `dir` to the console it gives the path. but when it comes to the opening the program stops working

parsing
tags question: http://stackoverflow.com/q/22920703
tags question: http://stackoverflow.com/q/22877895
tags question: http://stackoverflow.com/q/22945416
tags question: http://stackoverflow.com/q/22813685
tags question: http://stackoverflow.com/q/22940242
tag name: parsing
tags question: http://stackoverflow.com/q/22932075
tags question: http://stackoverflow.com/q/22863806
tags question: http://stackoverflow.com/q/22871660
tags question: http://stackoverflow.com/q/22855303
tags question: http://stackoverflow.com/q/22932867
tags question: http://stackoverflow.com/q/22937716
tags question: http://stackoverflow.com/q/22845663
type: Tag
tags question: http://stackoverflow.com/q/22903803
tags question: http://stackoverflow.com/q/22821145
tags question: http://stackoverflow.com/q/22883296
tags question: http://stackoverflow.com/q/22905712
tags question: http://stackoverflow.com/q/22832849
tags question: http://stackoverflow.com/q/22815448
tags question: http://stackoverflow.com/q/22886187
tags question: http://stackoverflow.com/q/22903275
tags question: http://stackoverflow.com/q/22837086
tags question: http://stackoverflow.com/q/22895088
tags question: http://stackoverflow.com/q/22924252
tags question: http://stackoverflow.com/q/22821123
tags question: http://stackoverflow.com/q/22864571
tags question: http://stackoverflow.com/q/22900332
tags question: http://stackoverflow.com/q/22879124

http://stackoverflow.com/comment/34828485
type: Comment
comment on: http://stackoverflow.com/a/22833696
type: AnswerComment
has text: I am creating the GUI in a class named Server-Start and I also want to access it from a class called Server.
score: 0

http://stackoverflow.com/a/22821915
type: Answer
answers question: http://stackoverflow.com/q/22821663
score: 1
has body: First Question: The ArrayList is my main issue here, I think (probably have more issues). Below, I just tried my best to implement the ArrayList, but obviously couldn't get it. Well, it seems you are missing the return statement and have a logical issue in your totalPerimeter(...) method. You need to make sure to add the total perimeter up in a variable, then return that variable. Also, ArrayList use the method size() for length of the list instead of length. Also, you access ArrayList objects using the get(...) method. public static double totalPerimeter( ArrayList&lt;Triangle&gt;a ){ double total = 0.0; //give default value of 0 for( int i = 0; i &lt; a.size(); i++){ total = total + a.get(i).perimeter(); //add up total } return total;//return it back! } Second Question: Also, how would I write/change my toString function, so that it would also contain the name of the object created in main (i.e. t1, t2, etc.)? I don't think you can do that. However, you could pass a String to the constructor: private String name; public Triangle( double a, double b, double c, String variableName){ this.sideA = a; this.sideB = b; this.sideB = c; this.name = variableName; if (checkSides() == true){} } Then in your main: Triangle t1 = new Triangle(7, 5, 4, "t1"); Triangle t2 = new Triangle(9, 6, 1, "t2"); You can then update your toString(...) method and access the variable name. Note: Final thing to note is that when you checkSides() and it returns false. You should throw an Exception or give the user a warning (ex. print out "WARNING: invalid sides").
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/22848829
has title: How do I add an image inside a rectangle or a circle in JavaFX?
favorite count: 0
upvote count: 6
tagged with: geometry
has comment: http://stackoverflow.com/comment/34878000
linked to: http://stackoverflow.com/q/20489908
score: 6
has answer: http://stackoverflow.com/a/30879054
possible better answer: http://stackoverflow.com/a/22849893
has answer: http://stackoverflow.com/a/22849893
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has body: Suppose we have a rectangle called r Rectangle r = new Rectangle(40, 20); and an image called image Image image = new Image("...src for image"); How do I fit the image inside the rectangle? Also, how can I make the image move if the rectangle moves too? How do I do the same thing for a circle? Code examples are greatly appreciated. P.S. Jewelsea, I'm waiting for you, lol!
tagged with: image
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/30879054
downvote count: 0

http://stackoverflow.com/q/22852015
accepted answer: http://stackoverflow.com/a/22852095
type: AnsweredQuestion
tagged with: java
tagged with: loops
upvote count: 1
downvote count: 1
type: Question
has body: How do I print the result in the main method? And how do I loop the "isLucky" method to the array? I posted a little bit ago and was told I should post again with less questions. import java.util.Scanner; public class FunArrays { public static void main(String[] args) { luckyNumber1 = 7; luckyNumber2 = 13; luckyNumber3 = 18; int[] a=new int[10]; Scanner sc=new Scanner(System.in); System.out.println("Please enter numbers..."); for(int j = 0; j &lt; a.length; j++) a[j] = sc.nextInt(); boolean b = isLucky(a); int result; if(b){ result = sum(a); } else{ result = sumOfEvens(a); } } public static int sum(int [ ] value) { int i, total = 0; for(i=0; i&lt;10; i++) { total = total + value[ i ]; } return (total); } static int sumOfEvens(int array[]) { int sum = 0; for(int i = 0; i &lt; array.length; i++) { if(array[i] % 2 == 0) sum += array[i]; } return sum; } public static boolean isLucky (int[] array) { if ( array[i] == 7 || array[i] == 13 || array[i] == 18 ) return true; else return false; } // write the static methods isLucky, sum, and sumOfEvens }
score: 0
has answer: http://stackoverflow.com/a/22852095
tagged with: arrays
answer count: 1
favorite count: 0
has title: Java program. How do I loop my "isLucky method through the array? and how do I print the result in the main method?

http://stackoverflow.com/q/22836220
downvote count: 0
tagged with: tomcat
favorite count: 0
tagged with: postgresql
has title: ERROR : javax.servlet does not exist
answer count: 1
has answer: http://stackoverflow.com/a/22836301
upvote count: 2
has comment: http://stackoverflow.com/comment/34832377
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22836301
tagged with: servlets
type: Question
has body: I have checked almost all the posts possible for the error that I'm getting. Ive edited almost all the ENVIRONMENT VARIABLES as given online. These are my environment variables : ANT_HOME = C:\Ant9;C:\Tomcat7\lib\servlet-api.jar CLASSPATH = C:\Program Files\Java\jdk1.6.0_24\bin;C:\Program Files\Java\jre6\bin;C:\Tomcat7\lib\servlet-api.jar;. JAVA_HOME = C:\Program Files\Java\jdk1.6.0_24 PATH = C:\Program Files\Java\jdk1.6.0_24\bin TOMCAT_HOME = C:\Tomcat7 C:\Tomcat7\webapps\DBConnection\WEB_INF\classes\DBConnection&gt;javac -cp .,C:\Tomc at7\lib\servlet-api.jar DBConnnection.java DBConnnection.java:4: package javax.servlet does not exist import javax.servlet.*; ^ DBConnnection.java:5: package javax.servlet.http does not exist import javax.servlet.http.*; ^ DBConnnection.java:11: cannot find symbol symbol: class HttpServlet public class DBConnnection extends HttpServlet ^ DBConnnection.java:14: cannot find symbol symbol : class HttpServletRequest location: class DBConnection.DBConnnection public void doGet(HttpServletRequest request, HttpServletResponse response) th rows ServletException, IOException ^ DBConnnection.java:14: cannot find symbol symbol : class HttpServletResponse location: class DBConnection.DBConnnection public void doGet(HttpServletRequest request, HttpServletResponse response) th rows ServletException, IOException ^ DBConnnection.java:14: cannot find symbol symbol : class ServletException location: class DBConnection.DBConnnection public void doGet(HttpServletRequest request, HttpServletResponse response) th rows ServletException, IOException ^ DBConnnection.java:53: cannot find symbol symbol : class EmployeeInformation location: class DBConnection.DBConnnection EmployeeInformation empInfo = new EmployeeInformation(); ^ DBConnnection.java:53: cannot find symbol symbol : class EmployeeInformation location: class DBConnection.DBConnnection EmployeeInformation empInfo = new EmployeeInformation(); ^ DBConnnection.java:13: method does not override or impl…

http://stackoverflow.com/q/22827673
answer count: 2
upvote count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/34817351
tagged with: sorting
favorite count: 0
has body: Part of my assignment requires 3 array of input size 100 with integers from 1-1000. Where 1st array is of random numbers from 1-1000. 2nd is sorted array from integers 1-1000. 3rd is almost sorted array from integers 1-1000. My random array.. int array [] = new int [100]; // Random Array of 100 for ( int i = 0 ; i &lt; array-1 ; i++) { array [i] = (int) (Math.random () * 100); } My sorted array.. int [] array = new int[100]; // Sorted Array of 100 for (int a = 0; a &lt; array.length; a++) { array[a] = (a + 1) * 10; } But how to do a almost sorted array. I thought about shuffling but that will just be all random.
has comment: http://stackoverflow.com/comment/34817377
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/35179138
has answer: http://stackoverflow.com/a/34254036
has comment: http://stackoverflow.com/comment/34817356
type: Question
has comment: http://stackoverflow.com/comment/34817370
tagged with: java
has comment: http://stackoverflow.com/comment/34817334
has title: How to create almost sorted array of 100 with integers from 1-1000?
has comment: http://stackoverflow.com/comment/34817319
has answer: http://stackoverflow.com/a/22827719

http://stackoverflow.com/q/22936367
favorite count: 0
tagged with: rest
has body: Fiends, i sending JSON String with three parameters to java web service method. but on java side method cant print in console. Please guide me what i have to change from below code? String json = ""; HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 10000); HttpConnectionParams.setSoTimeout(httpParams, 10000); HttpClient httpclient = new DefaultHttpClient(); // Prepare a request object HttpPost httpPost = new HttpPost(url); HttpGet httpGet = new HttpGet(url); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("name", "ghanshyam"); jsonObject.put("country", "India"); jsonObject.put("twitter", "ghahhd"); json = jsonObject.toString(); StringEntity se = new StringEntity(json); se.setContentEncoding("UTF-8"); se.setContentType("application/json"); // 6. set httpPost Entity System.out.println(json); httpPost.setEntity(se); httpGet.se // 7. Set some headers to inform server about the type of the content //httpPost.addHeader( "SOAPAction", "application/json" ); httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "application/json"); //String s = doGet(url).toString(); Toast.makeText(getApplicationContext(), "Data Sent", Toast.LENGTH_SHORT).show();
tagged with: android
has answer: http://stackoverflow.com/a/22936596
has comment: http://stackoverflow.com/comment/35013447
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
downvote count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: How to send Json String using REST to java webservice in Parameter in android?
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/62907874

http://stackoverflow.com/q/22892647
has comment: http://stackoverflow.com/comment/34936121
has body: I have a BaseDao interface to persist data to mysql using hibernate public interface BaseDao&lt;T extends Serializable&gt; { public void saveAll(Collection&lt;T&gt; objects) throws PersistenceException; } i have an entity classes hirechy that their base class is BaseActivity (all extends serializable) one of them: public class Activity1 extends BaseACtivity{...} in some class i'm declaring ActivityDao: protected abstract ActivityDao&lt;Activity1&gt; createActivityDao1(); and a method: private void persistData(ActivityDao&lt;? extends BaseActivity&gt; activityDao, Collection&lt;? extends BaseActivity&gt; data){ EntityTransaction transaction = activityDao.getEntityManager().getTransaction(); try { transaction.begin(); activityDao.saveAll(data); transaction.commit(); } catch (HibernateException ex) { at activityDao.saveAll(data) i'm getting a compile time exception: Error:(62, 24) java: method saveAll in interface com.matomy.persistence.dao.BaseDao&lt;T&gt; cannot be applied to given types; required: java.util.Collection&lt;capture#1 of ? extends com.matomy.persistence.entity.activities.BaseActivity&gt; found: java.util.Collection&lt;capture#2 of ? extends com.matomy.persistence.entity.activities.BaseActivity&gt; reason: actual argument java.util.Collection&lt;capture#2 of ? extends com.matomy.persistence.entity.activities.BaseActivity&gt; cannot be converted to java.util.Collection&lt;capture#1 of ? extends com.matomy.persistence.entity.activities.BaseActivity&gt; by method invocation conversion BaseActivity: public abstract class BaseActivity implements Serializable, Comparable&lt;BaseActivity&gt; { Help please Thanks! Roy UPDATE: private &lt;T extends BaseActivity&gt; void persistData(ActivityDao&lt;T&gt; activityDao, Collection&lt;T&gt; col){ EntityTransaction transaction = activityDao.getEntityManager().getTransaction(); try { transaction.begin(); activityDao.saveAll(col); transaction.commit(); } catch (HibernateException ex) {
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
tagged with: bounded-wildcard
has answer: http://stackoverflow.com/a/22892981
accepted answer: http://stackoverflow.com/a/22892981
upvote count: 2
has comment: http://stackoverflow.com/comment/34934906
has title: Java wildcard error
answer count: 1
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/34936188
has comment: http://stackoverflow.com/comment/34934922

http://stackoverflow.com/q/22820864
has answer: http://stackoverflow.com/a/22960514
upvote count: 2
has answer: http://stackoverflow.com/a/22822418
type: UnansweredQuestion
downvote count: 1
has body: I'm trying to show all combinations possible without using recursion. I was trying it with a loop but it isn't working. Without recursion(Not Working): import java.util.Arrays; public class Combination { public static void main(String[] args) { String[] arr = {"A","B","C","D","E","F"}; String[] result = new String[3]; int i = 0, len = 3; while(len != 0 || i &lt;= arr.length-len) { result[result.length - len] = arr[i]; len--; i++; } if (len == 0){ System.out.println(Arrays.toString(result)); return; } } } With recursion(Working): import java.util.Arrays; public class Combination { public static void main(String[] args){ String[] arr = {"A","B","C","D","E","F"}; combinations2(arr, 3, 0, new String[3]); } static void combinations2(String[] arr, int len, int startPosition, String[] result){ if (len == 0){ System.out.println(Arrays.toString(result)); return; } for (int i = startPosition; i &lt;= arr.length-len; i++){ result[result.length - len] = arr[i]; combinations2(arr, len-1, i+1, result); } } } What am I doing wrong?
has comment: http://stackoverflow.com/comment/34805501
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34809685
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34805569
favorite count: 0
has comment: http://stackoverflow.com/comment/34808421
has title: Trying to show all permutations possible without recursion
has comment: http://stackoverflow.com/comment/34806286

http://stackoverflow.com/a/22864643
type: AcceptedAnswer
has body: You have done readLine twice. Once in the while condition and next inside it. You are losing the line read in the while condition. Updated: Changed the code to the following and it gives the expected output: package stackoverflow; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.Arrays; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.border.EmptyBorder; import javax.swing.table.AbstractTableModel; public class T1Data extends JPanel { private final JTable table; public T1Data() { super(new BorderLayout(3, 3)); this.table = new JTable(new MyModel()); this.table.setPreferredScrollableViewportSize(new Dimension(700, 70)); this.table.setFillsViewportHeight(true); JPanel ButtonOpen = new JPanel(new FlowLayout(FlowLayout.CENTER)); add(ButtonOpen, BorderLayout.SOUTH); // Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); // Add the scroll pane to this panel. add(scrollPane, BorderLayout.CENTER); // add a nice border setBorder(new EmptyBorder(5, 5, 5, 5)); CSVFile Rd = new CSVFile(); MyModel NewModel = new MyModel(); this.table.setModel(NewModel); File DataFile = new File("res.csv"); ArrayList&lt;String[]&gt; Rs2 = Rd.ReadCSVfile(DataFile); NewModel.AddCSVData(Rs2); System.out.println("Rows: " + NewModel.getRowCount()); System.out.println("Cols: " + NewModel.getColumnCount()); } // Method for reading CSV file public class CSVFile { private final ArrayList&lt;String[]&gt; Rs = new ArrayList&lt;String[]&gt;(); private String[] OneRow; public ArrayList&lt;String[]&gt; ReadCSVfile(File DataFile) { try { BufferedReader brd = new BufferedReader(new FileReader(DataFile)); while (brd.ready()) { String st = brd.readLine(); OneRow = st.split(",|\\s|;"); Rs.add(OneRow); System.out.println(Arrays.toStr…
has comment: http://stackoverflow.com/comment/35007403
has comment: http://stackoverflow.com/comment/34978301
has comment: http://stackoverflow.com/comment/34981884
has comment: http://stackoverflow.com/comment/34981557
downvote count: 0
has comment: http://stackoverflow.com/comment/35013559
type: Answer
has comment: http://stackoverflow.com/comment/35007977
has comment: http://stackoverflow.com/comment/34981949
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34982176
has comment: http://stackoverflow.com/comment/34948248
has comment: http://stackoverflow.com/comment/35009199
has comment: http://stackoverflow.com/comment/34981215
has comment: http://stackoverflow.com/comment/34982069
accepted answer of: http://stackoverflow.com/q/22864095
has comment: http://stackoverflow.com/comment/34976984
answers question: http://stackoverflow.com/q/22864095

http://stackoverflow.com/comment/85477862
comment on: http://stackoverflow.com/a/22836568
score: 0
type: AnswerComment
type: Comment
has text: The point was that you asked about **industry** standard. Your fellow developers are letting you know about how others *besides* yourself will expect to see the source code. Another way is to look at actual open source projects that have comments to follow their practice. Doc style in definitely the preferred way for descriptions of a chunk of code and line style is best for single items in those chunks.

http://stackoverflow.com/comment/35002729
score: 0
type: AnswerComment
type: Comment
has text: that's what it should do here, maybe you don't want to take out the green totally then, and you just want to set the red and green to the same level. you're really not clear about what you want! This is a forum to help solve technical difficulties, we're not supposed to guess what you might want to achieve... You should really ask your questions to the teacher that wrote the assignment. I edited my post.
comment on: http://stackoverflow.com/a/22917235

http://stackoverflow.com/comment/34908530
has text: Have a look at [this](http://stackoverflow.com/a/21801845/2587435)
comment on: http://stackoverflow.com/q/22877129
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22880678
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34913415
has comment: http://stackoverflow.com/comment/34913309
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22880560
has body: You have a serious misconception. The servlet is only called when the form is submitted. So you can't expect, in the JSP, to have access to a list that should have been created and stored in the request, since the servlet doing that has never been called. Your servlet never forwards to the JSP. All it does is send the content type of the response to text/html. Moreover, you're storing the same list in a request attribute at every iteration of the loop, instead of doing it just once, when the loop has ended: while(rs.next()) { ... } request.setAttribute("ual", al); Here's what you should have: A ShowUsers servlet. This servlet should have a doGet() method which gets the users, stores them in a request attribute, then forwards to a showUsers.jsp page The showUsers.jsp should have one form per user (and not a single form with all the users inside). Each form should have the ID of the user to delete in a hidden input field, and a submit button to delete the user. The form should have the path of the DeleteUser servlet. The DeleteUser servlet should have a doPost() method, which should take the ID of the user to delete as request parameter, delete this user from the database, and redirect to the ShowUsers servlet.
has comment: http://stackoverflow.com/comment/34913348
has comment: http://stackoverflow.com/comment/35048984

http://stackoverflow.com/a/22881513
has comment: http://stackoverflow.com/comment/34915022
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34915159
has comment: http://stackoverflow.com/comment/34915363
answers question: http://stackoverflow.com/q/22881007
has body: Your Question: I know how to add the combobox and textfield to the panel but At the moment it doesn't even print out the test to the console. Answer: Store the reference of JcomboBox some where and then check the source in ActionListener. do in this way: final JComboBox comboBox = new JComboBox(onderdelenBox()); onderdelenGebruikt.add(comboBox); comboBox.addActionListener(MyFrame.this); Your ActionListener will look like this. if( eventSource == comboBox ){ System.out.println("test"); }
type: Answer
has comment: http://stackoverflow.com/comment/34914765
has comment: http://stackoverflow.com/comment/34915174
has comment: http://stackoverflow.com/comment/34914781
accepted answer of: http://stackoverflow.com/q/22881007
has comment: http://stackoverflow.com/comment/34918625
has comment: http://stackoverflow.com/comment/34914984
score: 0
has comment: http://stackoverflow.com/comment/34915271
has comment: http://stackoverflow.com/comment/34915102
has comment: http://stackoverflow.com/comment/34915232
has comment: http://stackoverflow.com/comment/34918660

http://stackoverflow.com/comment/35024355
type: QuestionComment
has text: I don't think there is a way to get when a button is pressed/released. When you add the actionlistner i would first call the sound that it is suppose to make when pressed then have it play the sound it is released at the end of the action listener code.
comment on: http://stackoverflow.com/q/22942131
score: 0
type: Comment

http://stackoverflow.com/a/28232958
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22904267
downvote count: 0
has body: (Though an old question..) I haven't worked with CQEngine, but if the particular framework allows you to pick your own collections underneeth the indices it creates maybe a good choice is Hazelcast grid which is designed for distributed environments Let us know if you manage to merge the two together smoothly hope it helps
type: Answer

http://stackoverflow.com/q/22951325
has body: I am using a duplicate for statement for some reason, but somehow I feel inefficient. The reasons why I use duplicated for statement is below. I got 'channel' data, which is a List of Channel information Channel Information is 'Map&lt;String, Object&gt;' type which has many elements There is another list of Map&lt;String, Object&gt; which represent program information What I need to do in insert a program in to each channels Source code is below public static void injectProgram2Channel ( List&lt;Map&lt;String, Object&gt;&gt; channelList, List&lt;Map&lt;String, Object&gt;&gt; programList) throws Exception { for(Map&lt;String, Object&gt; channel : channelList){ String serviceId = channel.get("serviceId").toString(); ArrayList&lt;Map&lt;String, Object&gt;&gt; programsForChannel = new ArrayList&lt;Map&lt;String,Object&gt;&gt;(); for(Map&lt;String, Object&gt; program : programList){ if(serviceId.equals(program.get("serviceId").toString())){ programsForChannel.add(program); } } channel.put("programs", programsForChannel); } } I do not want to iterate all of this List, since each List has many elements. How can I improve its performance? Channel List has around 500 Elements Program List has around 2000 Elements (I need solution which does not using duplicated for statement)
type: UnansweredQuestion
has title: How to improve inefficient duplicated for statement in java
has answer: http://stackoverflow.com/a/22951963
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/35040902
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/22951420
has comment: http://stackoverflow.com/comment/35041233
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35040905
has answer: http://stackoverflow.com/a/22951374

http://stackoverflow.com/comment/35010789
type: Comment
has text: @Robert, I have confused in this concept. please tell me step by step approach to solve. please help me.
type: QuestionComment
comment on: http://stackoverflow.com/q/22933493
score: 0

http://stackoverflow.com/a/22961756
answers question: http://stackoverflow.com/q/22961041
score: 0
type: Answer
has body: In Java some delimiter splitters use null/empty tokens others not. If you have || or |notInt| and it falls that scanner.nextInt() is run you will get an ImputMissmatchException Scanner i = new Scanner("Jeremy|Ronald|Wright|43|||Family Member|06|04|2013|06666-9139\n").useDelimiter("[|\\n]"); while (i.hasNext()) { for (int j = 0; j &lt; 3; j++) { System.out.println(i.next()); } for (int j = 3; j &lt; 6; j++) { int loc = i.nextInt(); // here i get same exception // when reading next int after 43 System.out.println(loc); } } Scanner with Delimiter and string splitter process empty tokens, while StringTokenizer doesn't, running the below code System.out.println("------Scanner Delimiter------------------------------"); Scanner i = new Scanner("Jeremy|Ronald|433|||06|04|2013|06666-9139").useDelimiter("[|]"); while (i.hasNext()) { System.out.println("\""+i.next()+"\""); } System.out.println("---------------String split---------------------"); String[] result = "Jeremy|Ronald|433|||06|04|2013|06666-9139".split("[|]"); for(String s: result) System.out.println("\""+s+"\""); System.out.println("-------------String Tokenizer-----------------------"); StringTokenizer st = new StringTokenizer("Jeremy|Ronald|433|||06|04|2013|06666-9139", "|"); while (st.hasMoreTokens()) { System.out.println("\""+st.nextToken()+"\""); } Will output: ------Scanner Delimiter------------------------------ "Jeremy" "Ronald" "433" "" "" "06" "04" "2013" "06666-9139" ---------------String split--------------------- "Jeremy" "Ronald" "433" "" "" "06" "04" "2013" "06666-9139" -------------String Tokenizer----------------------- "Jeremy" "Ronald" "433" "06" "04" "2013" "06666-9139"

debugging
tags question: http://stackoverflow.com/q/22826538
tags question: http://stackoverflow.com/q/22852537
tag name: debugging
tags question: http://stackoverflow.com/q/22813848
tags question: http://stackoverflow.com/q/22956559
tags question: http://stackoverflow.com/q/22882937
type: Tag
tags question: http://stackoverflow.com/q/22935164
tags question: http://stackoverflow.com/q/22837064
tags question: http://stackoverflow.com/q/22862253
tags question: http://stackoverflow.com/q/22919206
tags question: http://stackoverflow.com/q/22895518
tags question: http://stackoverflow.com/q/22891398
tags question: http://stackoverflow.com/q/22867491
tags question: http://stackoverflow.com/q/22825358
tags question: http://stackoverflow.com/q/22905622
tags question: http://stackoverflow.com/q/22869300

http://stackoverflow.com/q/22939027
score: 0
answer count: 2
tagged with: jscrollpane
has answer: http://stackoverflow.com/a/22941196
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22939447
tagged with: java
tagged with: swing
type: Question
has title: How to scroll back from bottom to top after adding components to panel which is in jscrollpane
has body: i have a jscrollpane and i have added panel to it and then inside panel i am adding jlabel and textarea dynamically . After adding components to the panel dynamically the vertical scroll goes to bottom. What i want is bringing verticall scroll to the top . That's my problem how can i solve this any help regarding this would be greatly appreciated . Here is my code import javax.swing.*; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class MyGui1 extends JPanel implements ActionListener { /** * */ protected JPanel panel; protected JTextArea textarea; static JFrame frame; JLabel Jlabel = null; public MyGui1() { // to lay out the container's components in a rectangular grid super(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; JButton jbutton = new JButton("button"); jbutton.setActionCommand("button"); jbutton.addActionListener(this); add(jbutton, c); c.gridy = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; setBackground(Color.cyan); panel = new JPanel(new GridLayout(0, 1)); JScrollPane jsp = new JScrollPane(panel); jsp.setPreferredSize(new Dimension(300, 300)); add(jsp, c); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); } public void actionPerformed(ActionEvent evt) { if ("button".equals(evt.getActionCommand())) { execute(); } } synchronized public void execute() { // to remove all the content of panel panel.removeAll(); // to refresh the window repaint(); for (int i = 0; i &lt; 20; i++) { Jlabel = new JLabel("Labe1l" + i); Jlabel.setVerticalAlignment(SwingConstants.TOP); panel.add(Jlabel); textarea = new JTex…

http://stackoverflow.com/a/42511116
has body: This has been an issue for quite a long time on MongoDB JIRA, but it is solved now. Take a look at this release notes for detailed documentation. You should use collation. User.find() .collation({locale: "en" }) //or whatever collation you want .sort({name:1}) .exec(function(err, users) { // use your case insensitive sorted results });
score: 32
type: Answer
answers question: http://stackoverflow.com/q/22931177
downvote count: 1
upvote count: 33

http://stackoverflow.com/comment/34833097
has text: What did happen after 10? Not updating after 10 means ? Are you getting any error?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22835493

http://stackoverflow.com/comment/35046877
type: Comment
comment on: http://stackoverflow.com/q/22954724
has text: @user2636390 Post your logcat and the line at where you'r getting null pointer exception.
score: 0
type: QuestionComment

http://stackoverflow.com/a/22853468
score: 0
type: Answer
has body: public void onClick(View view){ String string = getMyString(); Toast.makeText(getApplicationContext(), string,Toast.LENGTH_SHORT).show(); }
answers question: http://stackoverflow.com/q/22853382

http://stackoverflow.com/a/22887495
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34925888
score: 1
has comment: http://stackoverflow.com/comment/34935322
has comment: http://stackoverflow.com/comment/34935300
has comment: http://stackoverflow.com/comment/34925930
downvote count: 0
answers question: http://stackoverflow.com/q/22887446
has comment: http://stackoverflow.com/comment/34935345
has body: Try this one String s = "a\r\nb"; for (String str : s.split(System.getProperty("line.separator"))) { System.out.println(str); } System.out.println("Length:"+s.split(System.getProperty("line.separator")).length); \r\n represents new line. output a b Length:2

http://stackoverflow.com/q/22864571
type: Question
has comment: http://stackoverflow.com/comment/119034508
tagged with: simpledateformat
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/67341048
linked to: http://stackoverflow.com/q/38922754
downvote count: 0
possible better answer: http://stackoverflow.com/a/67341048
favorite count: 0
has answer: http://stackoverflow.com/a/22865265
has answer: http://stackoverflow.com/a/22864726
answer count: 3
tagged with: parsing
accepted answer: http://stackoverflow.com/a/22864726
score: 2
type: AnsweredQuestion
upvote count: 2
has body: I'm trying to parse this String 2014-04-04T14:28:38+02:00 It should be ISO 8601 format. But i can't parse it to a correct Date. I've tried the following: String example = "2014-04-04T14:28:38+02:00" public final static SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz") Date tempDate = df.parse(example) But I get always the message "unparseable Date" I can not change the example because it's a value from a webservice. Could it be there is a probleme with "+02:00" instead of "+0200" ? Thanks a lot
has title: Unparsable Date with colon-separated timezone

http://stackoverflow.com/q/22811420
tagged with: playframework
linked to: http://stackoverflow.com/q/19809764
downvote count: 0
has body: In Play framework 2.0, how to clear session values (or invalidate session) after some certain idle time is encountered? I've gone through Internet but found no relevant answers for my query. I've found some solution for Version 1.x in this link, even the documentation says that application.session.maxAge concept in v1.x sets the session's max age, not the idle time duration. Unfortunately, I couldn't find such configurations for v2.x so far. Is there a way to do so? Can someone help pls.
has comment: http://stackoverflow.com/comment/34791215
favorite count: 0
answer count: 0
upvote count: 3
type: UnansweredQuestion
has title: How to clear session after some idle time in play framework
tagged with: playframework-2.0
score: 3
tagged with: session
tagged with: java
has comment: http://stackoverflow.com/comment/34789527
has comment: http://stackoverflow.com/comment/34789149
type: Question

http://stackoverflow.com/comment/34956063
type: AnswerComment
has text: I agree completely. The question that was asked is general. That said, these are precisely the types of questions that I often find myself facing, particularly when I am new to an area.
comment on: http://stackoverflow.com/a/22904195
type: Comment
score: 8

http://stackoverflow.com/a/22902426
has body: you can add request params to the getTestCall method: @RequestParam(value = "testNumber", required = false, defaultValue = "") String testNumber
answers question: http://stackoverflow.com/q/22902372
has comment: http://stackoverflow.com/comment/34952734
score: 0
type: Answer

http://stackoverflow.com/a/22858763
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22852425
answers question: http://stackoverflow.com/q/22852425
has body: In your client code you specify a namespace for the service, which is good practice, but I don't see that namespace back in your service code. Your service has to define a namespace and this should correspond with the namespace your client uses for specifying the webservice method. E.g. @WebService(targetNamespace = "http://service.itmd.iit/")
type: Answer
score: 0

http://stackoverflow.com/a/22965512
upvote count: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35359513
score: 2
has body: I would also try using mmap instead of standard file read/write. This should let your OS handle the reading and writing while your application is only concerned with the data. There's no situation where C++ can't be faster than Java, but sometimes it takes a lot of work from very talented people. But I don't think this one should be too hard to beat as it is a straightforward task. mmap for Windows is described in File Mapping (MSDN).
answers question: http://stackoverflow.com/q/22955178

http://stackoverflow.com/q/22831587
tagged with: security
score: 0
answer count: 1
type: AnsweredQuestion
tagged with: dynamic
tagged with: java
tagged with: glassfish-4
tagged with: authentication
type: Question
has answer: http://stackoverflow.com/a/22831781
accepted answer: http://stackoverflow.com/a/22831781
has body: My problem is the integration of a security system in my java ee 7 web application with glass fish 4. I have seen several examples of authentication declarative but also programmatic but none of them covered my problem. In my application i have 2 groups which need authentication. ADMIN = All access rights EMPLOYEE = Only a subset of the admin rights. The problem is that the users of these groups are always changing so i want to store all the users in a DB table. Also i want to use @RolesAllowed annotation and programmatic security like ctx.isCallerInRole("ADMIN") because of simplicity. Summary: I want to store all users in a database table and i want to use @RolesAllowed annotation and programmatic security like ctx.isCallerInRole("ADMIN"). Is this possible to accomplish?
has title: Java EE 7 dynamic user roles

http://stackoverflow.com/a/22940771
answers question: http://stackoverflow.com/q/22927055
type: AcceptedAnswer
has body: Don't instantiate the @FXML-injected fields in your controller. The idea is that these are instantiated by the FXMLLoader those instances are injected for you. To inject the fields from your FXML file into the controller, you need the attribute fx:id="fieldName", e.g. &lt;FlowPane fx:id="butLayout" ...&gt;. With the code you have, the fields are not being injected and you are not operating on the nodes in your scene graph (i.e. you're adding the buttons to the FlowPane you created in your controller, not the FlowPane you created in the FMXL file).
type: Answer
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22927055

http://stackoverflow.com/q/22816422
has comment: http://stackoverflow.com/comment/34797285
tagged with: security
has comment: http://stackoverflow.com/comment/34797416
has body: I have program that randomly generates a password for a text file of usernames. I was wondering how I could check and make sure the user does not enter a invalid input and throw and error. I don't understand how to do a loop to check for valid inputs. import java.util.Random; import java.io.File; import java.util.Scanner; import java.io.PrintStream; import java.lang.Math; //Create class PasswordProgram public class PasswordProgram { public static void main(String[] args) throws Exception { Random rand = new Random(); // Read in the text file with usernames File infile = new File(args[0]); File outfile = new File("PasswordList.txt"); Scanner kbd = new Scanner(System.in); Scanner Infile = new Scanner(infile); // Allowing All types of characters to be added PrintStream Outfile = new PrintStream(outfile); String uppers = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String lowers = "abcdefghijklmnopqrstuvwxyz"; String digits = "0123456789"; String symbols = "`~!$%^&amp;*()_+{}|:&lt;&gt;?/.,';][=-"; String total = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789`~!$%^&amp;*()_+{}|:&lt;&gt;?/.,';][=-"; outfile.setReadable(true, true); // Ask user how many uppercase letters they want in their password System.out.print("Minumum uppercase: "); int Uppers = kbd.nextInt(); // Ask user how many lowercase letters they want in their password System.out.print("Minumum lowercase: "); int Lowers = kbd.nextInt(); // Ask user how many digits they want in their password System.out.print("Minumum digits: "); int Digits = kbd.nextInt(); // Ask user how many symbols they want in their program System.out.print("Minumum symbols: "); int Symbols = kbd.nextInt(); // Ask user how many total characters they want their password System.out.print("Minumum total characters: "); int Total = kbd.nextInt(); char[] password = new char[Total]; String user; int i, j, k; char temp; // As long as there is more usernames add more passwords while (Infile.hasNext()) { user = Infile.next(); // Create …
answer count: 2
has title: Security! I am wondering if there is anyway to make my program more secure (novice programmer)
has comment: http://stackoverflow.com/comment/34797323
has comment: http://stackoverflow.com/comment/34797550
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22817068
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22816912
has comment: http://stackoverflow.com/comment/34797373
has comment: http://stackoverflow.com/comment/34797746
type: Question
linked to: http://stackoverflow.com/q/11051205

http://stackoverflow.com/comment/34870986
comment on: http://stackoverflow.com/q/22857417
score: 0
type: Comment
type: QuestionComment
has text: You got `Null Pointer Exception` its becoz your `ListView` belong to your `Fragment_players.xml`

odm
tags question: http://stackoverflow.com/q/22959854
tag name: odm
type: Tag

http://stackoverflow.com/q/22876412
accepted answer: http://stackoverflow.com/a/22876494
favorite count: 0
has answer: http://stackoverflow.com/a/22876438
tagged with: arraylist
upvote count: 4
has answer: http://stackoverflow.com/a/22876494
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22876455
tagged with: list
has title: What is the difference between assigning 1 arraylist to other vs adding 1 araylist to other empty araylist to make both of them contain same objects
downvote count: 1
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/22876455
answer count: 3
has body: So what I basically mean is what are the difference between the following ? List&lt;String&gt; phonesContainerOne = new ArrayList&lt;String&gt;(); List&lt;String&gt; phonesContainerTwo = new ArrayList&lt;String&gt;(); phonesContainerOne.add("Nexus 4"); phonesContainerOne.add("Nexus 5"); now suppose I want to add both these phones to the phone container second.In java I can do that in the following ways 1.phonesContainerTwo.addAll(phonesContainerOne); 2.phonesContainerTwo = phonesContainerOne; What exactly are the difference between the two ways (1 and 2) in my case ?(ps. i know that addAll is used to add objects of one Collection type to another at once.So besides this what are teh other difference between these ways?)

http://stackoverflow.com/q/22824280
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/22824419
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/34811657
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/34812685
has comment: http://stackoverflow.com/comment/34811631
has comment: http://stackoverflow.com/comment/34811610
answer count: 1
downvote count: 0
score: 4
has title: How does Java compute the sine and cosine functions?
has comment: http://stackoverflow.com/comment/34811579
favorite count: 0
linked to: http://stackoverflow.com/q/1252929
has comment: http://stackoverflow.com/comment/49874205
type: UnansweredQuestion
has body: How does Java find sine and cosine? I’m working on trying to make a game that is a simple platformer something like super Mario or Castlevania. I attempted to make a method that would rotate an image for me and then resize the JLabel to fit that image. I found an algorithm that worked and was able to accomplish my goal. However all I did was copy and past the algorithm any one can do that I want to understand the math behind it. So far I have figured everything out except one part. The methods sin and cos in the math class. They work and I can use them but I have no idea how Java get its numbers. It would seem there is more then one way to solve this problem. For now I’m interested in how Java does it. I looked into the Taylor series but I’m not sure that is how java does it. But if Java does use the Taylor series I would like to know how that algorithm is right all the time (I am aware that it is an approximation). I’ve also heard of the CORDIC algorithm but I don’t know much about it as I do with the Taylor series which I have programmed into Java even though I don’t understand it. If CORDIC is how it's done, I would like to know how that algorithm is always right. It would seem it is also possible that the Java methods are system dependent meaning that the algorithm or code used would differ from system to system. If the methods are system dependent then I would like to know how Windows gets sine and cosine. However if it is the CPU itself that gets the answer I would like to know what algorithm it is using (I run an AMD Turion II Dual-Core Mobile M520 2.29GHz). I have looked at the score code of the Math class and it points to the StrictMath class. However the StrictMath class only has a comment inside it no code. I have noticed though that the method does use the keyword native. A quick Google search suggest that this keyword enables java to work with other languages and systems supporting the idea that the methods are system dependent. I have looked at the jav…
linked to: http://stackoverflow.com/q/2284860
has comment: http://stackoverflow.com/comment/34811785

http://stackoverflow.com/a/22825852
has comment: http://stackoverflow.com/comment/34814401
has comment: http://stackoverflow.com/comment/34856058
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34814492
has comment: http://stackoverflow.com/comment/34814421
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22825838
has body: Use ^[0]{1,4} instead of ^[0]{0,4}. ^[0]{0,4} will also accept zero of 0 and as you can see +4912345678 has zero of zeroes so regex will be able to found match and place + there.
has comment: http://stackoverflow.com/comment/34814530
answers question: http://stackoverflow.com/q/22825838
has comment: http://stackoverflow.com/comment/34814366

http://stackoverflow.com/q/22931243
has comment: http://stackoverflow.com/comment/35036695
tagged with: swing
tagged with: tablecellrenderer
has body: I notice if you set a new model into a JTable, if the number of rows is lower than the highest selected row, this can happen: java.lang.IndexOutOfBoundsException: Row index 2 is out of bounds (0..1) at com.acme.MyTableModel.getRowObject(MyTableModel.java:184) at com.acme.MyCellRenderer.getTableCellRendererComponent(MyCellRenderer.java:144) at javax.swing.JTable$AccessibleJTable.getAccessibleChild(JTable.java:7039) at javax.swing.JTable$AccessibleJTable.getAccessibleAt(JTable.java:7426) at javax.swing.JTable$AccessibleJTable.valueChanged(JTable.java:6939) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:184) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:164) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:211) at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:405) at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:415) at javax.swing.DefaultListSelectionModel.removeSelectionIntervalImpl(DefaultListSelectionModel.java:576) at javax.swing.DefaultListSelectionModel.clearSelection(DefaultListSelectionModel.java:420) at javax.swing.JTable.clearSelection(JTable.java:2117) at javax.swing.JTable.clearSelectionAndLeadAnchor(JTable.java:2125) at javax.swing.JTable.tableChanged(JTable.java:4370) at javax.swing.JTable.setModel(JTable.java:3688) Whose bug is this? Should Swing be checking this index before asking for a renderer, or is it the renderer's job to check the index? Edit: Here's a much reduced example, just in case there really is a bug elsewhere. Press the button until row 5 is visible, then select row 5 and press the button again. import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JToolBar; impo…
has comment: http://stackoverflow.com/comment/35008884
type: Question
has comment: http://stackoverflow.com/comment/35060267
tagged with: java
has comment: http://stackoverflow.com/comment/35036649
has title: Is the row passed to getTableCellRendererComponent supposed to be in bounds?
has comment: http://stackoverflow.com/comment/35004757
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/35042350
has comment: http://stackoverflow.com/comment/35008596
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35005209
has comment: http://stackoverflow.com/comment/35004866
answer count: 0
has comment: http://stackoverflow.com/comment/35008635

http://stackoverflow.com/q/22920371
tagged with: mysql
tagged with: swing
type: Question
has title: JTable error: java.lang.ArrayIndexOutOfBoundsException: 1 >= 0
has answer: http://stackoverflow.com/a/28948859
has answer: http://stackoverflow.com/a/22921590
has comment: http://stackoverflow.com/comment/34985007
tagged with: jtable
score: 0
answer count: 3
has body: I created a JTable in Java Swing. How do I update it so that it displays all the values stored in my MySQL database? I tried searching on the web, but still no luck. This is my code... try{ PreparedStatement ps = con.prepareStatement("SELECT * FROM Users "); ResultSet result = ps.executeQuery(); while(result.next()){ salesTable.setValueAt(result.getString("users"), 1, 1); } } catch(SQLException sqle){ sqle.printStackTrace(); } I keep getting the java.lang.ArrayIndexOutOfBoundsException: 1 &gt;= 0 error. I would greatly appreciate it if someone could tell me where I am going wrong and a possible fix for this bug.
has answer: http://stackoverflow.com/a/22920443
type: UnansweredQuestion
tagged with: java
tagged with: indexoutofboundsexception

http://stackoverflow.com/comment/35036304
comment on: http://stackoverflow.com/a/22948714
score: 5
type: AnswerComment
has text: @yayu: I think you should have specified this in your question
type: Comment

http://stackoverflow.com/comment/34922828
has text: `Mainframe mainFrame = new Mainframe();` is a local variable that can be used inside `main` method only.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22885675
type: Comment

http://stackoverflow.com/q/22940728
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22940974
has answer: http://stackoverflow.com/a/22941007
score: 0
has answer: http://stackoverflow.com/a/22941066
has body: Following is my code and I have put comments to explain what am I facing. Should I be importing something else? I'm using the jGrasp compiler? import java.awt.*; import java.applet.*; import java.lang.*; /*this is just a test class to learn how to use substring. I was trying to use substring to play around with strings in this case my dogs name. I was doing exercises on codingbat.com and came across the substring method. */ public class Donna extends Applet { String DogName = "Donna Peluda"; // declare the String variable DogName String FirstDog = ""; // declare FirstDog String variable blank FirstDog = DogName.substring( 0, 2); // I get "Donna.java:9: error: &lt;identifier&gt; expected" // if I comment out line 9 it prints "Donna Peluda" ok // Ive tried examples from the web and get the same error and spent 2 evenings on this so public void paint(Graphics d) { d.drawString(DogName + FirstDog ,25, 25);//print the result to the applet } }
has answer: http://stackoverflow.com/a/22941048
answer count: 4
has title: Why do I get error: Error: <identifier> expected in line 9 am I missing a import

http://stackoverflow.com/comment/61000557
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22944556
has text: As an aside, naming a class `List` is an easy source of bugs, since it will often collide with `java.util.List`.
score: 1

http://stackoverflow.com/a/22864241
score: 0
type: Answer
has body: This is how Java works. It just doesn't support multiply inheritance. There are many reasons why multiply inheritance may be dangerous. For example there can be a name conflict. On the other hand you can implement as many interfaces as you want to.
answers question: http://stackoverflow.com/q/22864211

http://stackoverflow.com/comment/35005512
type: QuestionComment
comment on: http://stackoverflow.com/q/22930860
score: 0
has text: @Jared: But his `buildA` method creates also new objects. So this is no argument. Except from that if you do not reference these created objects they get gced anyway...
type: Comment

http://stackoverflow.com/comment/34999176
has text: @SaghirA.Khatri I want that n textboxes to appear at same time.Not one by one.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22928025
score: 0

http://stackoverflow.com/comment/34984320
has text: you need to define the joincolumn `@ManyToOne @JoinColumn(name = "some_id")` in the inverse, but I am not sure if it will work because you are using an embedded class
comment on: http://stackoverflow.com/q/22919153
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22866089
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22866253
upvote count: 0
has body: While trying to read .docx file using the following snippet : public void parseDocxFile(String textEntered) { try { XWPFDocument doc = new XWPFDocument(new FileInputStream(new File(SContainer.getFilePath()))); XWPFWordExtractor extractor = new XWPFWordExtractor(doc); System.out.println("DOCX File : " + extractor.getText()); }catch(Exception exc) {exc.printStackTrace();} } I get an exception, which says : Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache /xmlbeans/XmlException at org.suhail.gui.Main.parseDocxFile(Main.java:246) at org.suhail.gui.Main.jButton1ActionPerformed(Main.java:167) at org.suhail.gui.Main.access$000(Main.java:22) at org.suhail.gui.Main$1.actionPerformed(Main.java:71) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3260) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at…
score: -1
has answer: http://stackoverflow.com/a/22866221
possible better answer: http://stackoverflow.com/a/22866253
answer count: 2
has title: Why am I getting exception as I try to read .DOCX file?
accepted answer: http://stackoverflow.com/a/22866221
favorite count: 0
tagged with: http://stackoverflow.com/tag/docx
tagged with: apache-poi
type: AnsweredQuestion
tagged with: java
tagged with: noclassdeffounderror

http://stackoverflow.com/comment/34961513
comment on: http://stackoverflow.com/a/22892991
score: 0
type: AnswerComment
has text: I don't think so, there should be something with your controller. Do you see that POST request handled by your controller? Can you successfully execute ajax POST from the same domain?
type: Comment

http://stackoverflow.com/q/22822588
type: Question
tagged with: jlayeredpane
has title: How would I use Jlayered pane to get the buttons on top of the background instead of under it?
has comment: http://stackoverflow.com/comment/34808804
has body: I'm trying to get the image background set BEHIND the 3 JButtons. As of right now it's painting the background then placing the buttons below with no background (stretch window to see). How would I use JLayeredPane to get the background image to the back? I'm under the impression that JLayeredPane would be the easiest way to do this. I could be wrong wrong though. package main; import java.awt.BorderLayout; import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.*; import javax.swing.*; public class Galaga extends JFrame implements ActionListener, WindowListener{ private JButton startButton, highScoreButton, optionsButton; public JPanel buttonPanel, optionsPanel, highScorePanel; public Galaga() { startButton = new JButton("Start Game"); highScoreButton = new JButton("High Scores"); optionsButton = new JButton("Options"); buttonPanel = new JPanel(); buttonPanel.add(new JLabel(new ImageIcon("images/Spacebackground.png"))); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(startButton); buttonPanel.add(highScoreButton); buttonPanel.add(optionsButton); startButton.addActionListener(this); highScoreButton.addActionListener(this); optionsButton.addActionListener(this); addWindowListener(this); add(buttonPanel); }
has answer: http://stackoverflow.com/a/22822991
tagged with: layout
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: swing
tagged with: background

http://stackoverflow.com/q/22930654
has title: Method overloading with variable argument
has comment: http://stackoverflow.com/comment/35003821
linked to: http://stackoverflow.com/q/12879910
has answer: http://stackoverflow.com/a/22930864
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22930832
tagged with: java
type: Question
upvote count: 4
has body: I think this would be a stupid question a little bit, but I can not sure why it is. code; public class OverloadingTest { public static int sum(int ...a){ int sum=0; for(int i : a){ sum += i; } System.out.print("this is variant args//"); return sum; } public static double sum(double a, double b) { return a + b; } public static void main(String[] args) { System.out.println(sum(1.5, 2.5)); System.out.println(sum(10, 20)); System.out.println(sum(10, 20,30)); } } results I expected; 4.0 this is variant args//30 this is variant args//60 actual results in console: 4.0 30.0 this is variant args//60 I can not sure why results of sum(10, 20) 30.0, not 30 of variable argument.
downvote count: 0
has answer: http://stackoverflow.com/a/22930763
answer count: 6
accepted answer: http://stackoverflow.com/a/22930763
score: 4
has answer: http://stackoverflow.com/a/22930776
has answer: http://stackoverflow.com/a/22930858
tagged with: variadic-functions
favorite count: 0
linked to: http://stackoverflow.com/q/1572322
has answer: http://stackoverflow.com/a/22930808
possible better answer: http://stackoverflow.com/a/22930832

http://stackoverflow.com/q/22964091
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22980633
tagged with: jena
accepted answer: http://stackoverflow.com/a/22980633
has answer: http://stackoverflow.com/a/22973226
answer count: 2
favorite count: 0
tagged with: http://stackoverflow.com/tag/rdf
tagged with: owl
possible better answer: http://stackoverflow.com/a/22973226
tagged with: reasoning
score: 2
type: AnsweredQuestion
downvote count: 0
has title: Jena infers rdfs:Resource to be in range of a owl:DatatypeProperty. Why?
tagged with: java
has body: If I have any property with some XMLSchema data type in its rdfs:range, the Jena reasoner (OWL_MEM_RULE_INF spec in my case) automatically adds rdfs:Resource to that range. Why is that? Doesn't that mean I can use literally anything as a value of that property? For example: &lt;rdf:RDF xmlns="http://mre.kiv.zcu.cz/ontology/2013/01/dasta.owl#" xml:base="http://mre.kiv.zcu.cz/ontology/2013/01/dasta.owl" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ds="http://mre.kiv.zcu.cz/ontology/2013/01/dasta.owl#"&gt; &lt;owl:DatatypeProperty rdf:about="&amp;ds;date"&gt; &lt;rdfs:label&gt;date&lt;/rdfs:label&gt; &lt;rdfs:label xml:lang="en"&gt;date&lt;/rdfs:label&gt; &lt;rdfs:range rdf:resource="&amp;xsd;dateTime"/&gt; &lt;/owl:DatatypeProperty&gt; &lt;/rdf:RDF&gt; Query: PREFIX ds: &lt;http://mre.kiv.zcu.cz/ontology/2013/01/dasta.owl#&gt; PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; SELECT ?r WHERE { ds:date rdfs:range ?r } Output: --------------------------------------------------- | r | =================================================== | &lt;http://www.w3.org/2001/XMLSchema#dateTime&gt; | | &lt;http://www.w3.org/2000/01/rdf-schema#Resource&gt; | ---------------------------------------------------

http://stackoverflow.com/comment/34931217
type: Comment
comment on: http://stackoverflow.com/a/22890562
score: 0
type: AnswerComment
has text: I don't have problem in executing the round robin algo it gives correct output..... but I want to take actual time units and perform it.. that is,, when I execute it has to wait for that much burst time to complete in real time say, 1st job I gave 1 min bursttime and 40 sec as qtm, so I need the program to wait for so much time while executing and then the second one and so on... should I use any timer function???

http://stackoverflow.com/comment/34935090
score: 0
type: Comment
has text: @Braj which loop do you. I used that while loop in the do-while at cShell class...
type: QuestionComment
comment on: http://stackoverflow.com/q/22892836

http://stackoverflow.com/comment/34938594
type: AnswerComment
has text: That creates an empty project though
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22894318

http://stackoverflow.com/a/22835030
upvote count: 9
has comment: http://stackoverflow.com/comment/34831187
score: 9
has comment: http://stackoverflow.com/comment/34830807
has comment: http://stackoverflow.com/comment/34831377
downvote count: 0
answers question: http://stackoverflow.com/q/22834938
has comment: http://stackoverflow.com/comment/34831003
type: Answer
has comment: http://stackoverflow.com/comment/34831202
has body: Check the following areas within Eclipse: Right Click Project &gt; Properties &gt; Project Facets &gt; Java &gt; Version 1.7 Right Click Project &gt; Properties &gt; Java Build Path &gt; Libraries &gt; JRE Library should be 1.7 Right Click Project &gt; Properties &gt; Java Compiler &gt; Compiler compliance level Window &gt; Preferences &gt; Server &gt; Runtime Environment &gt; Select the Server &gt; Edit &gt; Ensure JRE is set to 1.7

http://stackoverflow.com/a/22931238
downvote count: 0
type: Answer
has body: You can accomplish that using serialization. Class PostingList: public class PostingList&lt;T extends Serializable&gt; implements Serializable{ private static final long serialVersionUID = 6893022784519772456L; private Integer number; private List&lt;T&gt; list; public PostingList(Integer number, List&lt;T&gt; list) { super(); this.number = number; this.list = list; } @Override public String toString() { return "PostingList [number=" + number + ", list=" + list + "]"; } } writePosting: public static void writePosting(FileChannel fc, PostingList&lt;Integer&gt; posting) throws IOException { ByteArrayOutputStream baos = null; ObjectOutputStream oos = null; try { baos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(baos); oos.writeObject(posting); oos.flush(); byte[] postingBytes = baos.toByteArray(); System.out.println("Bytes read: " + postingBytes.length); ByteBuffer buffer = ByteBuffer.allocate(postingBytes.length); // prepare buffer to fill with data. buffer.clear(); // write the bytes buffer.put(postingBytes); // prepare for writing buffer.flip(); fc.write(buffer); } finally { if (oos != null) { oos.close(); } if (baos != null) { baos.close(); } } } And an extra method, readPosting : @SuppressWarnings({ "rawtypes", "unchecked" }) private static PostingList&lt;Integer&gt; readPosting(FileChannel fc) throws IOException, ClassNotFoundException { // Better to set this to a higher number byte[] barray = new byte[32]; ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteBuffer buffer = ByteBuffer.allocate(32); int bytesRead = 0; while ((bytesRead = fc.read(buffer)) != -1) { buffer.flip(); buffer.get(barray, 0, bytesRead); bos.write(barray, 0, bytesRead); buffer.clear(); // for testing System.out.println(bytesRead); } // We write the bytes recovered to an object byte[] bytes = bos.toByteArray(); ByteArrayInputStream bis = null; ObjectInputStream ois = null; Object obj = null; try { bis = new ByteArrayInputStream(bytes); ois = new ObjectInputStream(bis)…
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22929248

http://stackoverflow.com/q/22953913
answer count: 1
has comment: http://stackoverflow.com/comment/35046061
tagged with: repaint
has comment: http://stackoverflow.com/comment/35045156
has comment: http://stackoverflow.com/comment/35045822
accepted answer: http://stackoverflow.com/a/22956980
has comment: http://stackoverflow.com/comment/35050122
has comment: http://stackoverflow.com/comment/35049969
has comment: http://stackoverflow.com/comment/35050219
has comment: http://stackoverflow.com/comment/35046157
has body: So I have this application with a JTable in it. The JTable is inside of a JScrollPane and JScrollPane is painted on a JFrame. Now in my application I open a new windows to add a new row to that table and after I click a button to save the changes, the new window closes. Now I have tried adding these lines after the new window is closed: askTableInfo(); //a method to save the info in database to table and then save the table to variable 'table' table.repaint(); scrollPane.repaint(); And of course repaint(); by it self. But it still does not seem to update my table in the JFrame. What could be the issue here? public class AppWindow extends JFrame implements ActionListener { String user = ""; JLabel greetText = new JLabel(); JPanel panel = new JPanel(); JPanel panel2 = new JPanel(new GridLayout(1, 3)); JScrollPane scrollPane; JTable tabel; JButton newBook = new JButton("Add a book"); JButton deleteBook = new JButton("Remove a book"); JButton changeBook = new JButton("Change a book"); int ID; public AppWindow(String user, int ID) { this.ID = ID; this.user = user; setSize(500, 500); setTitle("Books"); setLayout(new BorderLayout()); greetText.setText("Hi "+user+" here are your books:"); add(greetText, BorderLayout.NORTH); askData(); panel.add(scrollPane); add(panel, BorderLayout.CENTER); panel2.add(newBook); panel2.add(deleteBook); panel2.add(changeBook); add(paneel2, BorderLayout.SOUTH); newBook.addActionListener(this); setVisible(true); } private void askData() { DataAsker asker = null; try { asker = new AndmeKysija(ID); } catch (SQLException e) { e.printStackTrace(); } table = asker.giveTable(); scrollPane = new JScrollPane(tabel); } public static void main(String[] args){ AppWindow window = new AppWindow("Name", 2); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource() == newBook){ new BookAdded(ID); panel.revalidate(); panel.add(scrollPane); panel.repaint(); repaint(); } } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35045246
has comment: http://stackoverflow.com/comment/35045256
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35049887
has comment: http://stackoverflow.com/comment/35050072
has comment: http://stackoverflow.com/comment/35045551
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/35046204
has comment: http://stackoverflow.com/comment/35045704
has title: How to repaint my JTable
has comment: http://stackoverflow.com/comment/35045794
has answer: http://stackoverflow.com/a/22956980
has comment: http://stackoverflow.com/comment/35049351
tagged with: jtable
has comment: http://stackoverflow.com/comment/35049517
has comment: http://stackoverflow.com/comment/35050195

date
tags question: http://stackoverflow.com/q/22895126
tags question: http://stackoverflow.com/q/22961939
tag name: date
tags question: http://stackoverflow.com/q/22864571
tags question: http://stackoverflow.com/q/22923454
tags question: http://stackoverflow.com/q/22850574
tags question: http://stackoverflow.com/q/22917562
tags question: http://stackoverflow.com/q/22842930
tags question: http://stackoverflow.com/q/22917225
tags question: http://stackoverflow.com/q/22808828
tags question: http://stackoverflow.com/q/22842196
tags question: http://stackoverflow.com/q/22813099
type: Tag
tags question: http://stackoverflow.com/q/22868648
tags question: http://stackoverflow.com/q/22957431
tags question: http://stackoverflow.com/q/22863446
tags question: http://stackoverflow.com/q/22886823
tags question: http://stackoverflow.com/q/22854316
tags question: http://stackoverflow.com/q/22959646
tags question: http://stackoverflow.com/q/22914956
tags question: http://stackoverflow.com/q/22894996
tags question: http://stackoverflow.com/q/22963219
tags question: http://stackoverflow.com/q/22824190
tags question: http://stackoverflow.com/q/22935550
tags question: http://stackoverflow.com/q/22952344
tags question: http://stackoverflow.com/q/22966069
tags question: http://stackoverflow.com/q/22890303
tags question: http://stackoverflow.com/q/22890644
tags question: http://stackoverflow.com/q/22959493

http://stackoverflow.com/q/22833953
tagged with: jenkins-plugins
type: Question
accepted answer: http://stackoverflow.com/a/22987854
has title: How to add Jenkins plugin (Recorder/Notifier/Publisher) to new project by default?
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/22840017
favorite count: 0
has answer: http://stackoverflow.com/a/22840017
tagged with: plugins
type: AnsweredQuestion
score: 3
tagged with: jenkins
has answer: http://stackoverflow.com/a/22987854
upvote count: 3
tagged with: java
has body: I'm developing a plugin which I need to run on every single project in my Jenkins cluster. I need a way to ensure it is added by default when new projects are created (I can use groovy to add it to the existing projects). I know from developing another plugin in the past, with ListViewColumn there is a shownByDefault() in the descriptor. I can't seem to find an equivalent for Recorder/Notifier/Publisher... although I'm happy to use any other class providing I can have the logic run after a build and add a BadgeAction. Thanks

http://stackoverflow.com/a/22875158
has body: clone() is protected which means it is only accessible from a subclass or that very same package. Reiteration from the comments: It all depends on the context from which it is called, and if that context is the same type then you can call the protected method. Here the context is a different type so it cannot call it. When you change the parameter to HashMap&lt;K, V&gt; for example you can call it because HashMap overrides the clone() method with a public modifier. So in short: you can't do that with a simple Map&lt;K, V&gt; declaration. This means a situation like this will work: class X { public X(){ X newX = new X().clone(); } } but this won't: class X { public X(){ String newString = "hello".clone(); } } But then again, this will: class X implements Map&lt;String, String&gt;{ public X(){ Map&lt;String, String&gt; map = new HashMap&lt;&gt;().clone(); } } And so will this: private static double[] timeMapRemoves(HashMap&lt;String,Integer&gt; map, Collection&lt;String&gt; data, int reps) { Map&lt;String, String&gt; someMap = (Map&lt;String, String&gt;) map.clone(); } Notice how I changed the parameter to HashMap&lt;String,Integer&gt;. The reason for why this works is very simple: HashMap defines its own clone() method. public Object clone() { HashMap&lt;K,V&gt; result = null; try { result = (HashMap&lt;K,V&gt;)super.clone(); } catch (CloneNotSupportedException e) { // assert false; } result.table = new Entry[table.length]; result.entrySet = null; result.modCount = 0; result.size = 0; result.init(); result.putAllForCreate(this); return result; }
score: 1
has comment: http://stackoverflow.com/comment/34913059
has comment: http://stackoverflow.com/comment/34903788
downvote count: 0
has comment: http://stackoverflow.com/comment/34905322
has comment: http://stackoverflow.com/comment/34905926
has comment: http://stackoverflow.com/comment/34903758
type: Answer
answers question: http://stackoverflow.com/q/22875106
upvote count: 1
has comment: http://stackoverflow.com/comment/34905710
has comment: http://stackoverflow.com/comment/34903816

http://stackoverflow.com/q/22867992
tagged with: java
accepted answer: http://stackoverflow.com/a/23255616
linked to: http://stackoverflow.com/q/3662768
upvote count: 1
tagged with: swing
type: Question
tagged with: miglayout
tagged with: jscrollpane
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23255616
favorite count: 0
has title: Child expands past the bounds of its parent when height or width set to 100% using MigLayout in Java
has comment: http://stackoverflow.com/comment/35297709
has body: I'm trying to use MigLayout to set the height of certain elements to take up the full height of their parent's container using the expression "height 100%" however there is some kind of feedback loop in MigLayout that causes the height to jump to the maximum value when loaded. This issue only happens when the MiGPanel is embedded into a JScrollPane, if I remove the lines of code dealing with the JScrollPane and add the MiGPanel to my JFrame then the program runs as intended. I added the boolean statement in there to make this eaiser to see. NOTE: I've seen this fix but I'd like to use a solution where I don't have a margin on the bottom of my program. How to prevent MigLayout from exceeding a container&#39;s bounds Here is the code: import java.awt.BorderLayout; import java.awt.Color; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import net.miginfocom.swing.MigLayout; public class StackOverFlowQuestion { public static void main(String[] args) { JPanel MiGPanel = new JPanel(); MiGPanel.setBackground(Color.red); MiGPanel.setLayout(new MigLayout()); JPanel greenPanel = new JPanel(); greenPanel.setBackground(Color.green); MiGPanel.add(greenPanel, "pos 0 0, width 33%, height 100%"); JPanel yellowPanel = new JPanel(); yellowPanel.setBackground(Color.yellow); MiGPanel.add(yellowPanel, "pos 33% 0, width 33%, height 100%"); JPanel bluePanel = new JPanel(); bluePanel.setBackground(Color.blue); MiGPanel.add(bluePanel, "pos 66% 0, width 34%, height 100%"); JFrame mainFrame = new JFrame(); mainFrame.setLayout(new BorderLayout()); boolean scroll = true; if(scroll){ JScrollPane scrollPane = new JScrollPane(); scrollPane.add(MiGPanel); scrollPane.setViewportView(MiGPanel); mainFrame.add(scrollPane); }else{ mainFrame.add(MiGPanel); } mainFrame.add(scrollPane); mainFrame.pack(); mainFrame.setSize(900, 600); mainFrame.setVisible(true); mainFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); } }
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/34882187
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22862183
has text: The persistence.xml file - just the relevant part. (If you could create a short but complete example which demonstrates the problem, that would be ideal.)
score: 0

http://stackoverflow.com/q/22876762
favorite count: 0
accepted answer: http://stackoverflow.com/a/22876925
has body: Hi I am trying to scrape data from a web site I want to auto select dropdown menu in that website and then capture all data from the table. I am having a problem because in that website table id is not available there so I am confused how can I scrape that value. Here is my code public class Market { public static void main(String args[]) throws InterruptedException, ClassNotFoundException, SQLException { WebDriver driver = new HtmlUnitDriver(BrowserVersion.getDefault()); String market="Rura"; String url="http://www.upmandiparishad.in/CW_Rates_new.asp"; driver.get(url); Thread.sleep(5000); new Select(driver.findElement(By.id("mktcode"))).selectByVisibleText(market); Thread.sleep(3000); Thread.sleep(5000); WebElement findElement = driver.findElement(By.id("what to give here")); String htmlTableText = findElement.getText(); System.out.println(htmlTableText); driver.close(); driver.quit(); } } How can I achieve my output
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34906643
score: 1
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/22876925
tagged with: web-scraping
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34906653
downvote count: 0
tagged with: htmlunit-driver
has comment: http://stackoverflow.com/comment/34906670
has title: How to scrape data from website when dropdown list select?
answer count: 1

http://stackoverflow.com/q/22957039
accepted answer: http://stackoverflow.com/a/22968736
has title: Should have a 404 response to a GET request but received 200. Restlet
tagged with: httpresponse
has comment: http://stackoverflow.com/comment/35050988
type: AnsweredQuestion
has body: I've a RESTlet server running on my android device. It is configured fine. Now I'm jUnit testing it and this particular test is failing for no reason. I've this URL: http://10.17.1.72:8080/contacts?order=ASC&amp;limit=10&amp;offset=1 which is correct, I receive a 200 response as expected. But then if I misspell the parameters in the URL I should get a 404 response. Using postman extension for Chrome if I hit http://10.17.1.72:8080/contacts?oooooooorder=ASC&amp;limit=10&amp;offset=1 (note that "order" is misspelled) I receive a 404 as I should. Until here everything is fine. The problem comes when I create a RESTlet client to make that GET request on my jUnit test, it receives a 200 response. Here is my jUnit test method: public void testGoodRequest() // Success, receives a 200 code. { // Create the client resource ClientResource resource = new ClientResource("http://10.17.1.72:8080/contacts?order=ASC&amp;limit=10&amp;offset=1"); Response response = resource.getResponse(); Log.d(TAG, "Good: " + response.getStatus().getCode()); assertTrue(response.getStatus().getCode() == 200); } Adn this one should receive a 404 but receives a 200, eventho the same get request using Chrome's postman receives a 404: public void testBadRequestWithOrderMisspelled() { // Create the client resource ClientResource resource = new ClientResource("http://10.17.1.72:8080/contacts?oofdgrder=ASC&amp;limit=10&amp;offset=1"); Response response = resource.getResponse(); Log.d(TAG, "BadRequestWithOrderMisspelled: " + response.getStatus().getCode()); assertTrue(response.getStatus().getCode() == 404); // Assert fails, receives 200 instead of 404 } And here is my Restlet handle method: @Override public void handle(Request request, Response response) { //final ContactList contactList = new ContactList(mContext); String type = request.getMethod().getName(); String order = request.getResourceRef().getQueryAsForm().getFirstValue("order"); String limit = request.getResourceRef().getQueryAsForm().getFirstVal…
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22968736
tagged with: restlet
possible better answer: http://stackoverflow.com/a/22957096
tagged with: httprequest
has answer: http://stackoverflow.com/a/22957096
score: 0
answer count: 3
tagged with: junit
has comment: http://stackoverflow.com/comment/35052168
has answer: http://stackoverflow.com/a/22958099

http://stackoverflow.com/a/22810160
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22809624
downvote count: 0
has body: Due to your requirement to be able to push data to the client, while this is obviously possible with sockets, they do introduce other complexities and so, imho, the easiest solution would be to use a message queue. To use a message queue, the client would post a message to a known queue that the server is listening to. This message should contain a replyTo destination (typically a temporary queue owned by the client). On receiving a message, the server should register the replyTo destination, sending any notifications to this replyTo destination. I've normally found it easier to use the notification mechanism for all data - both the initial load and the updates - as it prevents the client from having to support two mechanisms to obtain data. This is very easy to do, as your notification messages will need to indicate what type of event is occurring (add, update, delete for example) and you just need to introduce an initialize type to this list.

http://stackoverflow.com/comment/34839275
type: AnswerComment
has text: I might be wrong, but I guess your intention isn't to add a PlaceHolderFragment. Try removing this code: ` getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit();`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22839681

http://stackoverflow.com/comment/34991994
type: Comment
type: QuestionComment
score: 2
has text: Do you mean `b += s`?
comment on: http://stackoverflow.com/q/22923994

recursion
type: Tag
tags question: http://stackoverflow.com/q/22868602
tags question: http://stackoverflow.com/q/22825444
tags question: http://stackoverflow.com/q/22877495
tags question: http://stackoverflow.com/q/22960074
tags question: http://stackoverflow.com/q/22848723
tag name: recursion
tags question: http://stackoverflow.com/q/22903647
tags question: http://stackoverflow.com/q/22826449
tags question: http://stackoverflow.com/q/22899257
tags question: http://stackoverflow.com/q/22824019
tags question: http://stackoverflow.com/q/22892367
tags question: http://stackoverflow.com/q/22856074
tags question: http://stackoverflow.com/q/22825395
tags question: http://stackoverflow.com/q/22900288

http://stackoverflow.com/comment/34994197
score: 1
type: Comment
has text: You don't seem to be grasping the concept. For a client to use SQL Server at all, they must have it "permanently" installed. You seem to have a requirement for an embedded database, and SQL Server does not meet that requirement. I suggest that you research embedded databases like the ones that I mentioned, and not try to use one of the server-installed databases (like MS SQL Server, Oracle, MySQL, Postgresql, etc.).
comment on: http://stackoverflow.com/a/22881052
type: AnswerComment

http://stackoverflow.com/q/22896275
has answer: http://stackoverflow.com/a/22896412
has comment: http://stackoverflow.com/comment/34941295
type: AnsweredQuestion
tagged with: performance
accepted answer: http://stackoverflow.com/a/22896412
tagged with: java
type: Question
has title: what does the multithreaded connection pool means?
has body: Hi can you please enlighten my mind what what does the multithreaded connection pool means? because i heard that httpclient can allow multithreaded connection pool. what does it mean? Thank you in advance.
score: 0
tagged with: android
answer count: 1

http://stackoverflow.com/comment/34880388
comment on: http://stackoverflow.com/q/22862873
has text: Put this `Name = jN.getText().toString(); Body = jB.getText().toString();` under `submitNewJ(........)` and try
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35019258
comment on: http://stackoverflow.com/a/22939313
type: AnswerComment
type: Comment
has text: In addition to the comment above, you should also mention that the `RewriteRule` above will rewrite any requests since it is `.*` (`^` and `$` are not necessary in this case).
score: 0

http://stackoverflow.com/a/55448333
has body: if(a==b&amp;&amp;b!=c||a==c&amp;&amp;c!=b||b==c&amp;&amp;c!=a){ return false; } return a-b==b-c||b-c==c-a||c-a==a-b; } This should work for you.
answers question: http://stackoverflow.com/q/22880287
score: 0
type: Answer

http://stackoverflow.com/comment/35069047
score: 1
comment on: http://stackoverflow.com/a/22967258
has text: @ifLoop Thank you for pointing me i update as your suggestion.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22951069
has body: This is a good case where you could use a debugger. Or insert a bunch of System.out.println() to print out some of the local values.
answers question: http://stackoverflow.com/q/22951014
score: 0
type: Answer

http://stackoverflow.com/q/22962861
tagged with: runnable
has title: Why does it not work? (send function as parameter by Runnable in java )
possible better answer: http://stackoverflow.com/a/22962926
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22962926
has body: I have a project in java, and I have a problem. Description of goal: In Form A (MainForm) I have some buttons in enable(false) mode. I have a function LockOrUnlockButtons() that checks some conditions and if this function return true then the buttons make enable(true) state . I want to call this function for "event of the closing of Form B" (AddCstmrForm). I tried to solve this goal with receiving this function as parameter: public Void AddCstmrForm(Runnable myFunc) { ..... .... } The problem: But in Form A (MainForm), when I send the function LockOrUnlockButtons() to the Constructor of Form B (AddCstmrForm) i got Error: Constructor AddCstmrForm in class AddCstmrForm cannot be applied to given types. required: no arguments. founf: Void What did I do wrong? Harel THE CODE: in the Form A ,(MainForm): private void buttonAddNewCstmrCrdActionPerformed(java.awt.event.ActionEvent evt) { AddCstmrForm addCstmr = null; try { addCstmr = new AddCstmrForm(LockOrUnlockButtons()); } catch (Exception ex) { Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex); } addCstmr.show(); } private Void LockOrUnlockButtons() throws Exception { if(sngltn.GetAllCustemers().size()==0) buttonUpdateAddActivityCstmrCrd.setEnabled(false); else buttonUpdateAddActivityCstmrCrd.setEnabled(true); if(sngltn.GetAllCustemers().size()==0) buttonDeleteCstmrCrd.setEnabled(false); else buttonDeleteCstmrCrd.setEnabled(true); if(sngltn.GetAllCustemers().size()==0) buttonQueriesViewData.setEnabled(false); else buttonQueriesViewData.setEnabled(true); return null; } *in the Form B(AddCstmrForm): * public class AddCstmrForm extends javax.swing.JFrame { ............... ............. ......... private Runnable MainFormLockOrUnlockButton; ........ public Void AddCstmrForm(Runnable myFunc) throws Exception { initComponents(); .............. .......... ...... this.MainFormLockOrUnlockButton = myFunc; return null; } .............. .......... ...... }
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22962916
accepted answer: http://stackoverflow.com/a/22962916
score: 0

http://stackoverflow.com/comment/35052711
type: Comment
has text: I don't see any point in your qualification. Global variables (i.e. in Java static variables) are shared, period. It has nothing to do with instances. You might want to add *another* paragraph about instance variables, but what you've added about global (static) variables is pointless.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22956972

http://stackoverflow.com/a/36180814
answers question: http://stackoverflow.com/q/22896481
score: 0
has body: Event during the Partial Request complete JSF view tree traversal happens. The Solution, which solved my issue is Reduce the number components in the View(Create multiple views with limited components), Add Dialogs to the corresponding view(Add dynamically), Removing unwanted tab sources/Components from the view tree.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22896481
type: Answer

http://stackoverflow.com/q/22810275
type: AnsweredQuestion
has body: how to simplify if ( this.something == false ) this boolean expression ? Actually I want to ask is what is Simplify Boolean Expression?
has answer: http://stackoverflow.com/a/22810501
tagged with: java
has answer: http://stackoverflow.com/a/22810311
has title: Simplify Boolean Expression example
type: Question
upvote count: 1
favorite count: 0
answer count: 5
possible better answer: http://stackoverflow.com/a/22810311
accepted answer: http://stackoverflow.com/a/22810285
has comment: http://stackoverflow.com/comment/34785799
downvote count: 5
score: -4
has answer: http://stackoverflow.com/a/22810374
has answer: http://stackoverflow.com/a/22810401
has answer: http://stackoverflow.com/a/22810285

http://stackoverflow.com/comment/34799026
type: QuestionComment
has text: Or an object which is composed of such objects, and constructs its own hash by hashing together the hashes of those objects. It only takes one.
score: 0
comment on: http://stackoverflow.com/q/22813022
type: Comment

http://stackoverflow.com/q/22859466
score: 0
tagged with: nullpointerexception
has title: NullPointerException in Data.class.getResourceAsStream
has comment: http://stackoverflow.com/comment/34874361
type: UnansweredQuestion
tagged with: maven
answer count: 0
has comment: http://stackoverflow.com/comment/34874913
has body: This is my Data class. There is nothing in it. public class Data { } Below is my DocHTML class. public class DocHTML { public static void main(String[] args){ long startTime = System.currentTimeMillis(); try { // 1) Load docx with POI XWPFDocument XWPFDocument document = new XWPFDocument( Data.class.getResourceAsStream( "DocxBig.docx" ) ); // 2) Convert POI XWPFDocument 2 PDF with iText File outFile = new File( "output.htm" ); outFile.getParentFile().mkdirs(); OutputStream out = new FileOutputStream( outFile ); XHTMLConverter.getInstance().convert( document, out, null ); } catch ( Throwable e ) { e.printStackTrace(); } System.out.println( "Generate DocxBig.htm with " + ( System.currentTimeMillis() - startTime ) + " ms." ); } } I get NullPointerException while loading the document. I am also not sure how Data.class.getResourceAsStream should work when my Data class is empty. --- exec-maven-plugin:1.2.1:exec (default-cli) @ DOC2HTML --- java.lang.NullPointerException: in is null at java.util.zip.ZipInputStream.(ZipInputStream.java:100) at java.util.zip.ZipInputStream.(ZipInputStream.java:79) at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:83) at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:228) at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39) at org.apache.poi.xwpf.usermodel.XWPFDocument.(XWPFDocument.java:120) at com.invicara.docbuilder.doc2html.DocHTML.main(DocHTML.java:29) Generate DocxBig.htm with 69 ms. Update: The docx file exists inside the package "com.example.project" where my DocHTML class resides.
tagged with: java
has comment: http://stackoverflow.com/comment/34874417
has comment: http://stackoverflow.com/comment/34874462
type: Question

http://stackoverflow.com/q/22905339
type: Question
has comment: http://stackoverflow.com/comment/34958389
has comment: http://stackoverflow.com/comment/34961175
upvote count: 6
favorite count: 0
linked to: http://stackoverflow.com/q/22570413
has answer: http://stackoverflow.com/a/22905873
answer count: 1
tagged with: reflection
has title: Java reflection vs code generation
tagged with: java
tagged with: metaprogramming
accepted answer: http://stackoverflow.com/a/22905873
type: AnsweredQuestion
has body: Today I was wondering why frameworks like `Hibernate use reflection instead of code generation (for example using libraries like BCEL or ASM) during compilation/application startup. Is it because of historical reasons (when Hibernate was being written there was no such library available that would allow byte code generation on the fly) and now everybody uses this approach? I would assume that the approach with generated code would be faster then the one that uses reflection.
downvote count: 0
score: 6

http://stackoverflow.com/q/22829154
has comment: http://stackoverflow.com/comment/34820334
has body: I have to create an android virtual device and run from my project done in java, for that I am using sdklib.jar, code that I have tried to do like this but it cannot create any virtual device, and I cannot create AvdManager object as in the link, it shows an error AvdManager has protected access in AvdManager, so how can I break this, please mention any other methods if you know. I need to run it programatically
has answer: http://stackoverflow.com/a/22829509
tagged with: android
linked to: http://stackoverflow.com/q/8603301
has answer: http://stackoverflow.com/a/22829248
type: UnansweredQuestion
tagged with: emulation
has title: Create and Run Android Virtual Device
tagged with: java
type: Question
answer count: 2
score: 0

http://stackoverflow.com/a/22837894
type: Answer
has body: Your Code : for(int counter = 0;found || counter &lt; ArrayToSearch.size();counter++) Write like : for(int counter = 0;counter &lt; ArrayToSearch.size();counter++)
answers question: http://stackoverflow.com/q/22837805
score: 0

http://stackoverflow.com/comment/36320713
has text: how do you get the path of the file?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22929375
type: AnswerComment

http://stackoverflow.com/a/22896647
answers question: http://stackoverflow.com/q/22896566
type: Answer
upvote count: 4
downvote count: 0
score: 4
has body: You need to create a main class to get your program started. Also, this line: t1.findArea(); needs to be placed inside a method. I propose you change the last two lines of code to this: public static void main(String[] args) { RightTriangle t1 = new RightTriangle (3, 4); t1.findArea(); }

http://stackoverflow.com/comment/34994704
type: Comment
type: QuestionComment
has text: You an check out your programs heap using `jvisualvm`, a tool located in the bin folder of your JDK. You can also call the GC from the program.
score: 0
comment on: http://stackoverflow.com/q/22925293

http://stackoverflow.com/comment/35037326
type: QuestionComment
has text: When posting a question asking for help with an error from some code, you really should include the error. Generally, the java compiler gives extremely useful error messages. A quick google search of javac errors usually turns up useful information.
type: Comment
comment on: http://stackoverflow.com/q/22948991
score: 0

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

http://stackoverflow.com/comment/35020483
type: QuestionComment
has text: Yes i initialized both in a global scope, when i press i button both get initialized.
score: 0
comment on: http://stackoverflow.com/q/22939209
type: Comment

http://stackoverflow.com/q/22893151
has body: i want to get the Number of Entries in a table in My java Project. This is my code: int count = 0; Statement st = Mysql.con.createStatement(); ResultSet rs= st.executeQuery("select count(*) from keys where spieler =" +p.getName()); while (rs.next()){ count = rs.getInt(1); } I am getting following SQLEXCEPTION: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'keys where spieler =Pit910' at line 1 What is worng? Thanks!
has answer: http://stackoverflow.com/a/22893324
has comment: http://stackoverflow.com/comment/34935721
type: UnansweredQuestion
tagged with: jdbc
has answer: http://stackoverflow.com/a/22893208
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/34935520
has comment: http://stackoverflow.com/comment/34935810
has title: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException | JAVA
score: 0
answer count: 2
tagged with: sql

http://stackoverflow.com/a/22809696
downvote count: 0
has body: You can do: String name = request.getParameter("Name") != null ? request.getParameter("Name") : ""; to ensure that name is not null. And then if (name.isEmpty()) { ... }
answers question: http://stackoverflow.com/q/22809629
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/39029874
downvote count: 0
has body: You can't extend JFrame and JPanel in one class because Java does not allow multiple inheritance. If you are unfamiliar with Swing Graphic, you should save yourself the trouble from graphic painting. You could do something like this to make your life easier. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class SudokuBoard extends JPanel implements ActionListener, MouseListener, ItemListener { private JPanel board; JTextField[] numberFields; public SudokuBoard() { super(); numberFields = new JTextField[81]; board = createContentPane(); } public JPanel getBoard() { return board; } private JPanel createContentPane() { JPanel board = new JPanel(); board.setLayout(new GridLayout(9, 9, 1, 1)); for (int i = 0; i &lt; numberFields.length; i++) { numberFields[i] = new JTextField(); numberFields[i].setHorizontalAlignment(JTextField.CENTER); numberFields[i].setFont(new Font("Ariel", Font.BOLD, 25)); numberFields[i].setText((i % 9)+1+""); //set border if ((i+1) % 3 == 0) { numberFields[i].setBorder(BorderFactory.createMatteBorder(1, 1, 1, 5, Color.black)); } if (i &gt; 17 &amp;&amp; i &lt; 27) { numberFields[i].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 1, Color.black)); } if (i &gt; 44 &amp;&amp; i &lt; 54) { numberFields[i].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 1, Color.black)); } board.add(numberFields[i]); } numberFields[20].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, Color.black)); numberFields[23].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, Color.black)); numberFields[26].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, Color.black)); numberFields[47].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, Color.black)); numberFields[50].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, Color.black)); numberFields[53].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, Color.black)); return board; } public JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu Menu = new JMenu("File")…
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22890999
score: 1

http://stackoverflow.com/a/22838777
downvote count: 0
has body: According to documentation In Java 7 : Annotations can be applied to declarations: declarations of classes, fields, methods, and other program elements. When used on a declaration, each annotation often appears, by convention, on its own line. As of the Java SE 8 release, annotations can also be applied to the use of types. : Class instance creation expression: new @Interned MyObject(); Type cast: myString = (@NonNull String) str; implements clause: class UnmodifiableList&lt;T&gt; implements @Readonly List&lt;@Readonly T&gt; { ... } Thrown exception declaration: void monitorTemperature() throws @Critical TemperatureException { ... }
score: 14
upvote count: 14
accepted answer of: http://stackoverflow.com/q/22838634
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22838634
type: Answer

http://stackoverflow.com/a/62891572
score: 1
has body: Found a workaround in eclipse bug 536592, to disable "Java/Compiler/Building/Build path problems/Abort build when build path errors occur". When doing this the "clean build" will take a long time but will finish successfully (after showing thousands of errors due to the mentioned random build path). Its the brute force building method ;)
answers question: http://stackoverflow.com/q/22905622
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34806230
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22820330
has text: @Tony: quote myself: "I ran two of these commands concurrently"...
type: Comment

http://stackoverflow.com/a/22910606
downvote count: 0
type: Answer
upvote count: 2
has body: Change in eclipse.ini -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.v20120913-144807 -product com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256M -showsplash com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Xms512m -Xmx512m -Dosgi.requiredJavaVersion=1.6 -Declipse.buildId=v22.3.0-887826 -XX:MaxPermSize=512M
answers question: http://stackoverflow.com/q/22909112
score: 2
accepted answer of: http://stackoverflow.com/q/22909112
type: AcceptedAnswer

http://stackoverflow.com/comment/34908239
comment on: http://stackoverflow.com/a/22877595
type: Comment
score: 0
has text: What does `paintComponent` do...it fills the graphics context with the background color of the component...just because you didn't override it doesn't mean it's not called...
type: AnswerComment

http://stackoverflow.com/q/22953714
possible better answer: http://stackoverflow.com/a/22956356
has answer: http://stackoverflow.com/a/22956356
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22956263
has comment: http://stackoverflow.com/comment/35049204
tagged with: rest
has comment: http://stackoverflow.com/comment/35046259
has body: I am trying to consume Java REST Webservice in windows phone 8.But it is always giving 404 (page not found) exception (system.net.http.httpexception).That means not able to connect to webservice. Following is the client code which i used for consuming webservice. try { HttpClient http = new HttpClient(); String result = await http.GetStringAsync("http://192.168.0.56:8078/sample/page/name"); MessageBox.Show(result); } catch (Exception e) { MessageBox.Show(e.ToString()); } Please help.Thanks in advance.
has comment: http://stackoverflow.com/comment/35046179
type: AnsweredQuestion
has title: How to consume java REST webservice in windows phone 8?
accepted answer: http://stackoverflow.com/a/22956263
tagged with: java
has comment: http://stackoverflow.com/comment/35046431
has comment: http://stackoverflow.com/comment/35049145
tagged with: windows-phone-8
tagged with: web-services
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/35046057

http://stackoverflow.com/a/34187419
answers question: http://stackoverflow.com/q/22841306
upvote count: 12
downvote count: 0
type: Answer
has body: Custom Serializers are no longer necessary - simply use GsonBuilder, and specify the date format, as such: Timestamp t = new Timestamp(System.currentTimeMillis()); String json = new GsonBuilder() .setDateFormat("yyyy-MM-dd hh:mm:ss.S") .create() .toJson(t); System.out.println(json);
score: 12

http://stackoverflow.com/q/22845699
accepted answer: http://stackoverflow.com/a/22951999
downvote count: 0
favorite count: 0
score: 38
has comment: http://stackoverflow.com/comment/34855871
has comment: http://stackoverflow.com/comment/34856742
upvote count: 38
linked to: http://stackoverflow.com/q/36338505
has comment: http://stackoverflow.com/comment/34894873
has title: Is it discouraged to use Java 8 parallel streams inside a Java EE container?
tagged with: java-8
has comment: http://stackoverflow.com/comment/34855089
has comment: http://stackoverflow.com/comment/34855322
possible better answer: http://stackoverflow.com/a/36375778
has comment: http://stackoverflow.com/comment/34849814
has answer: http://stackoverflow.com/a/36375778
tagged with: java-stream
has body: Given that spawning threads in Java EE containers are discouraged. Would using the Java 8 parallel streams, which may spawn threads, inside Java EE be discouraged too?
tagged with: java
type: Question
tagged with: jakarta-ee
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34855045
tagged with: ejb
has comment: http://stackoverflow.com/comment/34855575
linked to: http://stackoverflow.com/q/533783
has answer: http://stackoverflow.com/a/22951999
has comment: http://stackoverflow.com/comment/34955572
has comment: http://stackoverflow.com/comment/34985481
has comment: http://stackoverflow.com/comment/34855214
answer count: 2

swing
tags question: http://stackoverflow.com/q/22840602
tags question: http://stackoverflow.com/q/22937613
tags question: http://stackoverflow.com/q/22922368
tags question: http://stackoverflow.com/q/22858434
tags question: http://stackoverflow.com/q/22842999
tags question: http://stackoverflow.com/q/22941621
tags question: http://stackoverflow.com/q/22950346
tags question: http://stackoverflow.com/q/22920046
tags question: http://stackoverflow.com/q/22867838
tags question: http://stackoverflow.com/q/22885156
tags question: http://stackoverflow.com/q/22897469
tags question: http://stackoverflow.com/q/22920371
tags question: http://stackoverflow.com/q/22835290
tags question: http://stackoverflow.com/q/22918890
tags question: http://stackoverflow.com/q/22864008
tags question: http://stackoverflow.com/q/22874269
tags question: http://stackoverflow.com/q/22851809
tags question: http://stackoverflow.com/q/22814456
tags question: http://stackoverflow.com/q/22811277
tags question: http://stackoverflow.com/q/22914775
tags question: http://stackoverflow.com/q/22896077
tags question: http://stackoverflow.com/q/22830489
tags question: http://stackoverflow.com/q/22947766
tags question: http://stackoverflow.com/q/22901520
tags question: http://stackoverflow.com/q/22912446
tags question: http://stackoverflow.com/q/22833328
tags question: http://stackoverflow.com/q/22869380
tags question: http://stackoverflow.com/q/22926852
tags question: http://stackoverflow.com/q/22844472
tags question: http://stackoverflow.com/q/22812922
tags question: http://stackoverflow.com/q/22927818
tags question: http://stackoverflow.com/q/22824454
tags question: http://stackoverflow.com/q/22926170
tags question: http://stackoverflow.com/q/22897975
tags question: http://stackoverflow.com/q/22875101
tags question: http://stackoverflow.com/q/22903385
tags question: http://stackoverflow.com/q/22868890
tags question: http://stackoverflow.com/q/22869921
tags question: http://stackoverflow.com/q/22917572
tags question: http://stackoverflow.com/q/22864633
tags question: http://stackoverflow.com/q/22895344
tags question: http://stackoverflow.com/q/22924469
tags question: http://stackoverflow.com/q/22841559
tags question: http://stackoverflow.com/q/22822696
tags question: http://stackoverflow.com/q/22852591
tags question: http://stackoverflow.com/q/22839163
tags question: http://stackoverflow.com/q/22885751
tags question: http://stackoverflow.com/q/22817370
tags question: http://stackoverflow.com/q/22844430
tags question: http://stackoverflow.com/q/22888456
tags question: http://stackoverflow.com/q/22943588
tags question: http://stackoverflow.com/q/22859617
tags question: http://stackoverflow.com/q/22867992
tags question: http://stackoverflow.com/q/22823388
tags question: http://stackoverflow.com/q/22904353
tags question: http://stackoverflow.com/q/22923580
tags question: http://stackoverflow.com/q/22936229
tags question: http://stackoverflow.com/q/22910213
tags question: http://stackoverflow.com/q/22853070
tags question: http://stackoverflow.com/q/22898690
tags question: http://stackoverflow.com/q/22823446
tags question: http://stackoverflow.com/q/22884235
tags question: http://stackoverflow.com/q/22889058
tags question: http://stackoverflow.com/q/22849684
tags question: http://stackoverflow.com/q/22912282
tags question: http://stackoverflow.com/q/22911569
tags question: http://stackoverflow.com/q/22899457
tags question: http://stackoverflow.com/q/22962632
tags question: http://stackoverflow.com/q/22941214
tags question: http://stackoverflow.com/q/22839391
tags question: http://stackoverflow.com/q/22851022
tags question: http://stackoverflow.com/q/22838357
tags question: http://stackoverflow.com/q/22933507
tags question: http://stackoverflow.com/q/22868084
tags question: http://stackoverflow.com/q/22858498
tags question: http://stackoverflow.com/q/22967051
tags question: http://stackoverflow.com/q/22953122
tags question: http://stackoverflow.com/q/22845506
tags question: http://stackoverflow.com/q/22840402
tags question: http://stackoverflow.com/q/22906131

http://stackoverflow.com/comment/34877321
comment on: http://stackoverflow.com/q/22861107
score: 0
has text: yes some info on exception handling is required and what the different kinds of exception does java have and how you are supposed to use it in the code. clear case of not delcaring checked exceptions here.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34815967
has text: What would cause classes to load over the network? This class works fine in my project. It just doesn't work in the jUnit-related class.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22825471

http://stackoverflow.com/a/22886992
upvote count: 1
has body: You can't do this, because if the array is defined to containt integers, it doesn't make sense to add a String to it. Something you can do (but you should use it if you really know what you are doing) is to add the Unicode value of a character in the String: array[i][j] = "x".codePointAt(0);
type: Answer
answers question: http://stackoverflow.com/q/22886942
downvote count: 0
score: 1

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/22871845
tags question: http://stackoverflow.com/q/22899821
tags question: http://stackoverflow.com/q/22899101
tags question: http://stackoverflow.com/q/22825672
tags question: http://stackoverflow.com/q/22829510
tags question: http://stackoverflow.com/q/22869403
tags question: http://stackoverflow.com/q/22856594
tags question: http://stackoverflow.com/q/22928251
tags question: http://stackoverflow.com/q/22903448
tags question: http://stackoverflow.com/q/22902804
tags question: http://stackoverflow.com/q/22870094
tags question: http://stackoverflow.com/q/22851509
tags question: http://stackoverflow.com/q/22816242
tags question: http://stackoverflow.com/q/22955495
tags question: http://stackoverflow.com/q/22853607
tags question: http://stackoverflow.com/q/22832263
tags question: http://stackoverflow.com/q/22813538
tags question: http://stackoverflow.com/q/22964369
tags question: http://stackoverflow.com/q/22936367
tags question: http://stackoverflow.com/q/22939209
tags question: http://stackoverflow.com/q/22877111
tags question: http://stackoverflow.com/q/22812113
tags question: http://stackoverflow.com/q/22809249
tags question: http://stackoverflow.com/q/22820274
tags question: http://stackoverflow.com/q/22915640
tags question: http://stackoverflow.com/q/22937888
tags question: http://stackoverflow.com/q/22829633
tags question: http://stackoverflow.com/q/22933974
tags question: http://stackoverflow.com/q/22904111
tags question: http://stackoverflow.com/q/22922985
tags question: http://stackoverflow.com/q/22821145
tags question: http://stackoverflow.com/q/22916600
tags question: http://stackoverflow.com/q/22865815
tags question: http://stackoverflow.com/q/22881922
tags question: http://stackoverflow.com/q/22868429
tags question: http://stackoverflow.com/q/22860100
tags question: http://stackoverflow.com/q/22866653
tags question: http://stackoverflow.com/q/22830165
tags question: http://stackoverflow.com/q/22808916
tags question: http://stackoverflow.com/q/22860202
tags question: http://stackoverflow.com/q/22851462
tags question: http://stackoverflow.com/q/22914808
tags question: http://stackoverflow.com/q/22867521
tags question: http://stackoverflow.com/q/22953533
tags question: http://stackoverflow.com/q/22827960
tags question: http://stackoverflow.com/q/22853165
tags question: http://stackoverflow.com/q/22841306
tags question: http://stackoverflow.com/q/22962344
tags question: http://stackoverflow.com/q/22953348
type: Tag
tags question: http://stackoverflow.com/q/22828373
tags question: http://stackoverflow.com/q/22810868
tags question: http://stackoverflow.com/q/22957572
tags question: http://stackoverflow.com/q/22829505
tags question: http://stackoverflow.com/q/22954110
tags question: http://stackoverflow.com/q/22956739
tags question: http://stackoverflow.com/q/22945416
tags question: http://stackoverflow.com/q/22948173
tags question: http://stackoverflow.com/q/22888217
tags question: http://stackoverflow.com/q/22956014
tags question: http://stackoverflow.com/q/22813685
tags question: http://stackoverflow.com/q/22816335
tags question: http://stackoverflow.com/q/22920846
tags question: http://stackoverflow.com/q/22858231
tags question: http://stackoverflow.com/q/22917324
tag name: json
tags question: http://stackoverflow.com/q/22861856
tags question: http://stackoverflow.com/q/22827546
tags question: http://stackoverflow.com/q/22872112
tags question: http://stackoverflow.com/q/22875642
tags question: http://stackoverflow.com/q/22863806
tags question: http://stackoverflow.com/q/22964314
tags question: http://stackoverflow.com/q/22963859
tags question: http://stackoverflow.com/q/22893625
tags question: http://stackoverflow.com/q/22870584
tags question: http://stackoverflow.com/q/22857710
tags question: http://stackoverflow.com/q/22906218
tags question: http://stackoverflow.com/q/22938390
tags question: http://stackoverflow.com/q/22895289
tags question: http://stackoverflow.com/q/22869772

http://stackoverflow.com/a/23221044
type: Answer
has comment: http://stackoverflow.com/comment/35729311
answers question: http://stackoverflow.com/q/22838876
score: 0
has body: The setup is possible. There is no need to reengineer the whole code using JMS. It is possible to call remote ejb beans on different JBOSSAS7 servers from a single POJO client using your own custom Selector for the EJBClientContext. With the code mentioned, you are able to register different scopes for different servers See an example from the jboss developers here https://community.jboss.org/thread/223419?tstart=0 https://github.com/wfink/jboss-as-quickstart/blob/ejb-clients/ejb-clients/jboss-api/src/main/java/org/jboss/as/quickstarts/ejb/clients/selector/CustomScopeEJBClientContextSelector.java
has comment: http://stackoverflow.com/comment/97493037

http://stackoverflow.com/q/22864813
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22865382
tagged with: java
has answer: http://stackoverflow.com/a/22865382
score: 0
answer count: 2
tagged with: null
has title: Java: NullExceptionPointer in object[]
tagged with: arrays
has body: I am trying to check the state of cells for a true value. If the state is true, then I am going to save the X and Y of the element (2D Array). Here is the method I am using where c is the counter that counts how many cells are true: public void checkState(){ System.out.println("Checking State"); int c = 0; for(int y = 0; y &lt; GRID_Y; y++){ for(int x = 0;x &lt; GRID_X; x++){ if(state[x][y]==true){ //Error starts after this line coords[c].setX(x); coords[c].setY(y); c++; //DEBUG System.out.println(coords.getX()); System.out.println(coords.getY()); } } } System.out.println(c); } } The coords object is declared like this: private Coords[] coords = new Coords[totalCells]; (Tried changing totalCells to a small integer value like 10, still didn't work) Where Coords class is: public class Coords { int x,y; public Coords(){ x = 0; y = 0; } public void setX(int xIn){ x = xIn; } public void setY(int yIn){ y = yIn; } public int getX(){ return x; } public int getY(){ return y; } } I am getting the following error: Checking State java.lang.NullPointerException at game.GameOfLifeGUI.checkState(GameOfLifeGUI.java:116) at game.GameOfLifeGUI.&lt;init&gt;(GameOfLifeGUI.java:57) at game.GameOfLifeGUI$1.run(GameOfLifeGUI.java:32) 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.pumpEvents(Unknown So…
has answer: http://stackoverflow.com/a/22865013
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/34883982
has comment: http://stackoverflow.com/comment/34883965
has comment: http://stackoverflow.com/comment/34884323
accepted answer: http://stackoverflow.com/a/22865013
type: Question
tagged with: object

http://stackoverflow.com/comment/34955401
score: 0
has text: I just that that catch there a temporary measure since i'm not too familiar with error exceptions, and the highlighter method required it.
comment on: http://stackoverflow.com/q/22904006
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34975128
type: AnswerComment
comment on: http://stackoverflow.com/a/22911513
type: Comment
has text: actually, `while(paused)` is not needed here, you can use `if(paused)` instead, but `while` is traditional and more robust.
score: 1

http://stackoverflow.com/q/22852236
has comment: http://stackoverflow.com/comment/34862133
tagged with: localhost
type: AnsweredQuestion
has body: I made one android application that needs to connect one local database provided by wamp server. First using the android virtual device (AVD) my IP to connect the server first time used to be: 10.0.2.2. My AVD was connecting fine, but when I tried to connect direct on my device he wasn't finding the local server with this 10.0.2.2 IP. At this point I've changed IP to 192.168.1.5 which was my LAN cable IP, both device and AVD were running without problems... but sometimes I need to change my connection to wifi, which changes the IP..also, I realized that fix one IP in my source code will be a problem to release the android app, since other people will have other LAN IP address. To solve this problem, I've started to look for a solution, such as acquire the LAN IP dynamically. For this purpose I built this Java application as test: public class test { public static void main(String[] args) throws Exception { String roundHost = null; Enumeration&lt;NetworkInterface&gt; n = NetworkInterface.getNetworkInterfaces(); for (; n.hasMoreElements();) { NetworkInterface e = n.nextElement(); Enumeration&lt;InetAddress&gt; a = e.getInetAddresses(); for (; a.hasMoreElements();) { InetAddress addr = a.nextElement(); if (addr.isSiteLocalAddress()){ String pureHost = addr.getByName(addr.getHostName()).toString(); roundHost = addr.getHostAddress(); pureHost = pureHost.substring(addr.getHostName().length()+1); if(!roundHost.equals(pureHost)) break; } } } System.out.println(roundHost); } } As output, this java application gives me my correct LAN wifi IP or even my LAN cable IP which is 192.168.1.3 or 192.168.1.7. From here I made one "IPParser" to use on my android app: public class IPParser { String pureHost, roundHost = null; public IPParser() throws UnknownHostException{ Enumeration&lt;NetworkInterface&gt; n = null; try { n = NetworkInterface.getNetworkInterfaces(); } catch (SocketException e1) { e1.printStackTrace(); } for (; n.hasMoreElements();) { NetworkInterface e = n.nextElement…
tagged with: java
has answer: http://stackoverflow.com/a/22852634
tagged with: ip
type: Question
tagged with: network-programming
has comment: http://stackoverflow.com/comment/34862027
score: 0
accepted answer: http://stackoverflow.com/a/22852634
answer count: 1
has title: Java application getting different IP from android application - Why?
has comment: http://stackoverflow.com/comment/34862891
linked to: http://stackoverflow.com/q/5806220
tagged with: android

http://stackoverflow.com/comment/34935438
comment on: http://stackoverflow.com/q/22892975
score: 1
type: Comment
type: QuestionComment
has text: FYI http://stackoverflow.com/q/17396796/298389

http://stackoverflow.com/a/22824858
has comment: http://stackoverflow.com/comment/34812658
has comment: http://stackoverflow.com/comment/34825014
type: AcceptedAnswer
upvote count: 26
type: Answer
accepted answer of: http://stackoverflow.com/q/22824843
has comment: http://stackoverflow.com/comment/133045197
downvote count: 0
answers question: http://stackoverflow.com/q/22824843
has body: It means the implementation of the specification that should demonstrate the concepts. Mostly it is implemented by the same guys/company that designed the specification. You may think of specification as a standard that is needed to allow other possible implementation to be compatible with the rest of the world. And the reference implementation of a proof-of-concept kind piece of software that should show how to do that and encourage others to create their own implementations. In the JDBC context it means, that there are some interfaces (CachedRowSet) prescribing some methods and there is a reference implementation to these interfaces done in Sun/Oracle.
score: 26

http://stackoverflow.com/q/22879548
tagged with: if-statement
tagged with: jsp
has title: How to show different web content depending on <c:if> with variable in a jsp page
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
type: UnansweredQuestion
has body: I'm trying to show different web content in a jsp page depending on the user's access level (admin or user). I have a session with the attribute "access" that is = 1 if the user is an admin, otherwise = 2; this works because I can see the access level in the page by <%out.print("access = "+session.getAttribute("access"));%> I tried <c:if> using var TEST in this way: <%String test = session.getAttribute("access").toString();%> <%out.print("test = "+test);%> With <c:if test="1"> Content Admin (table for example) <c:else> ..... </c:else> </c:if> it never shows what you put in If statement on the page. Is there a solution for that? Thank you.
has answer: http://stackoverflow.com/a/22879587
tagged with: java
type: Question

http://stackoverflow.com/a/22842806
has comment: http://stackoverflow.com/comment/135689571
has comment: http://stackoverflow.com/comment/132608049
has comment: http://stackoverflow.com/comment/41553543
answers question: http://stackoverflow.com/q/22842743
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34844422
has comment: http://stackoverflow.com/comment/121512334
has comment: http://stackoverflow.com/comment/79050221
score: 660
has comment: http://stackoverflow.com/comment/40345123
type: Answer
has comment: http://stackoverflow.com/comment/126415339
has comment: http://stackoverflow.com/comment/113214160
has comment: http://stackoverflow.com/comment/133501940
has comment: http://stackoverflow.com/comment/139023366
has comment: http://stackoverflow.com/comment/79011001
has comment: http://stackoverflow.com/comment/123892342
has comment: http://stackoverflow.com/comment/124560010
has body: If you're using bash, all you have to do is: echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile If you're using zsh (which probably means you're running macOS Catalina or newer), then it should instead be: echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.zshrc In either case, restart your shell. If you have multiple JDK versions installed and you want it to be a specific one, you can use the -v flag to java_home like so: echo export "JAVA_HOME=\$(/usr/libexec/java_home -v 1.7)" >> ~/.bash_profile
has comment: http://stackoverflow.com/comment/40345415
upvote count: 666
has comment: http://stackoverflow.com/comment/131189680
has comment: http://stackoverflow.com/comment/122500460
has comment: http://stackoverflow.com/comment/34844554
downvote count: 6
has comment: http://stackoverflow.com/comment/49755126
accepted answer of: http://stackoverflow.com/q/22842743

http://stackoverflow.com/a/23144640
has comment: http://stackoverflow.com/comment/35389871
has body: The command you said was incorrect is actually valid. The one that was given instead is deprecated (but still works).
type: Answer
has comment: http://stackoverflow.com/comment/37106748
has comment: http://stackoverflow.com/comment/37133787
upvote count: 2
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37107286
answers question: http://stackoverflow.com/q/22845120
has comment: http://stackoverflow.com/comment/35410438

http://stackoverflow.com/a/22844496
has comment: http://stackoverflow.com/comment/34891090
type: AcceptedAnswer
downvote count: 0
has body: Don't use a KeyListener. Swing was designed to be used with Key Bindings. The probable problem is that the panel doesn't have focus and doesn't respond to the KeyEvents. See Motion Using the Keyboard for more information and a solution using Key Bindings. Another possible problem is that you don't override the getPreferredSize() method of your panel to return an appropriate Dimension, so the size is 0 so Swing thinks there is nothing to paint.
accepted answer of: http://stackoverflow.com/q/22844430
answers question: http://stackoverflow.com/q/22844430
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/34892529
score: 2
has comment: http://stackoverflow.com/comment/34850988
has comment: http://stackoverflow.com/comment/34880033
has comment: http://stackoverflow.com/comment/34847679

http://stackoverflow.com/comment/35053822
type: Comment
comment on: http://stackoverflow.com/q/22920276
type: QuestionComment
has text: Have you checked the `file` for being _null_? By the way, what is the line 125 in your client?
score: 0

http://stackoverflow.com/comment/36596957
type: Comment
has text: It depends on provider used. For BouncyCastle it could be both EC and ECDSA. For Sun Provider it could be EC only, I don't use it much.
comment on: http://stackoverflow.com/a/23369629
score: 2
type: AnswerComment

http://stackoverflow.com/comment/35034923
score: 0
type: Comment
type: QuestionComment
has text: I suggest you open this file with a hex editor, try to recognize your values in the beginning at least, and then you can see how they are stored with each method you use. When you know this, then you can design an appropriate C/C++ struct to contain each tuple in the file
comment on: http://stackoverflow.com/q/22947345

http://stackoverflow.com/comment/34838211
type: Comment
comment on: http://stackoverflow.com/q/22839459
score: 0
type: QuestionComment
has text: Well what does the log show?

http://stackoverflow.com/q/22888670
has title: Java HW, Printing out a multidimensional array of Ints, with Strings/characters
accepted answer: http://stackoverflow.com/a/22888685
type: Question
tagged with: n-queens
possible better answer: http://stackoverflow.com/a/22888698
tagged with: java
has comment: http://stackoverflow.com/comment/34927708
has answer: http://stackoverflow.com/a/22888699
has comment: http://stackoverflow.com/comment/34927644
has answer: http://stackoverflow.com/a/22888698
has comment: http://stackoverflow.com/comment/34927741
score: 0
has body: I did an N queens java project that required me to print out a multidimensional array showing where I can place the queens. My array is of Ints. It prints out 1s and 0s in respectable positions. I was wondering if there was a way that I could print out a Q for queens in the place of a 1 and a space in the place of a 0, without changing my array to type String. I went back and changed my array to String type and I got nulls in the place of some 0's. I tried converting the int to is ASCII character (81 would be a Q). I also tried copying the Int array into a String array, but java doesnt allow that. Any Ideas? public void print(){ for(int i = 0; i &lt; a.length; i++) { for(int j = 0; j &lt; a[i].length; j++) { if (a[i][j]==1){ a[i][j]=((char)81); } System.out.print(a[i][j]); if(j &lt; a[i].length - 1) System.out.print(" "); } System.out.println(); } } Solution : 0 0 0 0 0 81 0 0 81 0 0 0 0 0 0 0 0 0 0 0 0 0 81 0 0 0 0 81 0 0 0 0 0 81 0 0 0 0 0 0 0 0 0 0 81 0 0 0 0 0 0 0 0 0 0 81 0 0 81 0 0 0 0 0
tagged with: multidimensional-array
answer count: 3
has answer: http://stackoverflow.com/a/22888685
type: AnsweredQuestion

http://stackoverflow.com/a/22902786
score: 2
has comment: http://stackoverflow.com/comment/34953355
has body: Obviously you get a NPE because: You initialize ltrAra as array of 1000 items, but you read in less than 1000 items within method readLetters(). So at the end of this array some null references remain un-initialized (remember array-creation does itself not set the single items to any objects). Therefore following sorting-method gets some null-references => NPE. Suggested solution: You should use an ArrayList instead of an array because that will automatically prevent you from accessing too much items due to internal range check.
accepted answer of: http://stackoverflow.com/q/22902712
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34986929
has comment: http://stackoverflow.com/comment/34986456
answers question: http://stackoverflow.com/q/22902712
type: Answer
has comment: http://stackoverflow.com/comment/34953327
upvote count: 2

http://stackoverflow.com/q/22837730
has answer: http://stackoverflow.com/a/23235907
accepted answer: http://stackoverflow.com/a/23235907
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: swt
tagged with: eclipse
type: Question
answer count: 2
has body: What I am currently facing is an Exception Access Violation in some Eclipse applications we are running in a Citrix Environment on Windows 2008 server R2. The call starts in org.eclipse.swt.widgets.FileDialog.open(), which calls methods in org.eclipse.swt.internal.win32.OS.GetSaveFileNameW and then goes down to native libraries. It fails with a # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x68931bab, pid=9208, tid=7616 with siginfo: ExceptionCode=0xc0000005, ExceptionInformation=0x00000008 0x68931bab Analyzing the created minidump, I end in the thumbcache.dll thumbcache.dll!CThumbnailCache::CThumbnailCache(int) Unknown thumbcache.dll!ThumbnailCacheCreateInstance(int,struct _GUID const &amp;,void * *) Unknown thumbcache.dll!CThumbCacheClassFactory::CreateInstance(struct IUnknown *,struct _GUID const &amp;,void * *) Unknown ole32.dll!CServerContextActivator::CreateInstance(IUnknown * pUnkOuter, IActivationPropertiesIn * pInActProperties, IActivationPropertiesOut * * ppOutActProperties) Line 1000 C++ ole32.dll!ActivationPropertiesIn::DelegateCreateInstance(IUnknown * pUnkOuter, IActivationPropertiesOut * * ppActPropsOut) Line 1917 C++ ole32.dll!CApartmentActivator::CreateInstance(IUnknown * pUnkOuter, IActivationPropertiesIn * pInActProperties, IActivationPropertiesOut * * ppOutActProperties) C++ ole32.dll!CProcessActivator::CCICallback(unsigned long dwContext, IUnknown * pUnkOuter, ActivationPropertiesIn * pActIn, IActivationPropertiesIn * pInActProperties, IActivationPropertiesOut * * ppOutActProperties) Line 1737 C++ ole32.dll!CProcessActivator::AttemptActivation(ActivationPropertiesIn * pActIn, IUnknown * pUnkOuter, IActivationPropertiesIn * pInActProperties, IActivationPropertiesOut * * ppOutActProperties, HRESULT (unsigned long, IUnknown *, ActivationPropertiesIn *, IActivationPropertiesIn *, IActivationPropertiesOut * *) * pfnCtxActCallback, unsigned long dwContext) Line 1630 C++ ole32.dll!CProcessActivator::ActivateByContext(ActivationPropertiesIn * pActIn, …
tagged with: eclipse-rcp
upvote count: 1
possible better answer: http://stackoverflow.com/a/22982987
has answer: http://stackoverflow.com/a/22982987
favorite count: 0
has title: Occasional JVM crashes from FileDialog.open() deep in native code
tagged with: windows

http://stackoverflow.com/comment/34974925
type: AnswerComment
score: 0
has text: A sample that helps how?
type: Comment
comment on: http://stackoverflow.com/a/22915051

http://stackoverflow.com/a/22964288
has comment: http://stackoverflow.com/comment/35068297
has comment: http://stackoverflow.com/comment/35133214
score: 3
has comment: http://stackoverflow.com/comment/35140475
has comment: http://stackoverflow.com/comment/35065967
has comment: http://stackoverflow.com/comment/35072823
upvote count: 3
has comment: http://stackoverflow.com/comment/35065098
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35082642
accepted answer of: http://stackoverflow.com/q/22964093
has body: Alright, wrap your ExpandBar in a ScrolledComposite and let it handle scrolling. The advantage of this is that ScrolledComposite has a method called .setOrigin(int, int) which you can use to scroll to a position. Here is some example code: public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); shell.setText("ExpandBar Example"); final ScrolledComposite scrolledComp = new ScrolledComposite(shell, SWT.V_SCROLL); final ExpandBar bar = new ExpandBar(scrolledComp, SWT.NONE); for (int i = 0; i &lt; 3; i++) { Composite composite = new Composite(bar, SWT.NONE); composite.setLayout(new GridLayout()); for (int j = 0; j &lt; 10; j++) new Label(composite, SWT.NONE).setText("Label " + i + " " + j); ExpandItem item = new ExpandItem(bar, SWT.NONE, 0); item.setText("Item " + i); item.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); item.setControl(composite); } bar.getItem(1).setExpanded(true); bar.setSpacing(8); /* Make sure to update the scrolled composite when we collapse/expand * items */ Listener updateScrolledSize = new Listener() { @Override public void handleEvent(Event arg0) { display.asyncExec(new Runnable() { @Override public void run() { scrolledComp.setMinSize(bar.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } }); } }; bar.addListener(SWT.Expand, updateScrolledSize); bar.addListener(SWT.Collapse, updateScrolledSize); scrolledComp.setContent(bar); scrolledComp.setExpandHorizontal(true); scrolledComp.setExpandVertical(true); scrolledComp.setMinSize(bar.computeSize(SWT.DEFAULT, SWT.DEFAULT)); shell.setSize(400, 200); shell.open(); /* Jump to the end */ scrolledComp.setOrigin(0, scrolledComp.getSize().y); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } Looks like this after running: As you can see it's scrolled to the end. Update Ok, if you want to jump to the position of a specific item, do the following: Add a But…
answers question: http://stackoverflow.com/q/22964093
type: Answer

http://stackoverflow.com/comment/94453019
type: AnswerComment
comment on: http://stackoverflow.com/a/22829786
type: Comment
has text: Both Google and Bingo have quotes?
score: 0

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/22889139
tags question: http://stackoverflow.com/q/22880571
tags question: http://stackoverflow.com/q/22923913
tags question: http://stackoverflow.com/q/22869598
tags question: http://stackoverflow.com/q/22944919
tags question: http://stackoverflow.com/q/22870365
tags question: http://stackoverflow.com/q/22966769
tags question: http://stackoverflow.com/q/22849011
tags question: http://stackoverflow.com/q/22929696
type: Tag
tags question: http://stackoverflow.com/q/22835290
tags question: http://stackoverflow.com/q/22905370
tags question: http://stackoverflow.com/q/22824454
tags question: http://stackoverflow.com/q/22896840
tags question: http://stackoverflow.com/q/22821143
tags question: http://stackoverflow.com/q/22886007
tags question: http://stackoverflow.com/q/22847992

android-mediaplayer
tags question: http://stackoverflow.com/q/22913265
tag name: android-mediaplayer
type: Tag
tags question: http://stackoverflow.com/q/22966849

http://stackoverflow.com/comment/34895752
has text: I'm still getting the deprecated warning ("The type HttpParams is deprecated" for example)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22864802
type: Comment

hibernate
tags question: http://stackoverflow.com/q/22872362
tags question: http://stackoverflow.com/q/22866527
tags question: http://stackoverflow.com/q/22913477
tags question: http://stackoverflow.com/q/22942614
tags question: http://stackoverflow.com/q/22841246
tags question: http://stackoverflow.com/q/22956302
tags question: http://stackoverflow.com/q/22926075
tags question: http://stackoverflow.com/q/22843408
tags question: http://stackoverflow.com/q/22868032
tags question: http://stackoverflow.com/q/22851126
tags question: http://stackoverflow.com/q/22811932
tags question: http://stackoverflow.com/q/22816817
tags question: http://stackoverflow.com/q/22901925
tags question: http://stackoverflow.com/q/22960268
tags question: http://stackoverflow.com/q/22846410
tags question: http://stackoverflow.com/q/22967097
tags question: http://stackoverflow.com/q/22865723
tags question: http://stackoverflow.com/q/22896743
tags question: http://stackoverflow.com/q/22881058
tags question: http://stackoverflow.com/q/22934467
tags question: http://stackoverflow.com/q/22862100
tags question: http://stackoverflow.com/q/22935615
tags question: http://stackoverflow.com/q/22921687
tags question: http://stackoverflow.com/q/22905280
tags question: http://stackoverflow.com/q/22953224
tags question: http://stackoverflow.com/q/22964985
tags question: http://stackoverflow.com/q/22921797
tags question: http://stackoverflow.com/q/22815010
tags question: http://stackoverflow.com/q/22844988
tags question: http://stackoverflow.com/q/22861105
tags question: http://stackoverflow.com/q/22966029
tags question: http://stackoverflow.com/q/22896124
tags question: http://stackoverflow.com/q/22880012
tags question: http://stackoverflow.com/q/22832346
tags question: http://stackoverflow.com/q/22847853
tags question: http://stackoverflow.com/q/22837325
tag name: hibernate
tags question: http://stackoverflow.com/q/22892744
tags question: http://stackoverflow.com/q/22905798
tags question: http://stackoverflow.com/q/22945544
tags question: http://stackoverflow.com/q/22836616
tags question: http://stackoverflow.com/q/22828045
tags question: http://stackoverflow.com/q/22958552
tags question: http://stackoverflow.com/q/22934974
tags question: http://stackoverflow.com/q/22954213
tags question: http://stackoverflow.com/q/22879169
tags question: http://stackoverflow.com/q/22845761
tags question: http://stackoverflow.com/q/22821695
tags question: http://stackoverflow.com/q/22955481
tags question: http://stackoverflow.com/q/22950786
tags question: http://stackoverflow.com/q/22943144
tags question: http://stackoverflow.com/q/22820166
tags question: http://stackoverflow.com/q/22865670
tags question: http://stackoverflow.com/q/22894727
tags question: http://stackoverflow.com/q/22919459
tags question: http://stackoverflow.com/q/22967763
tags question: http://stackoverflow.com/q/22832672
tags question: http://stackoverflow.com/q/22963458
tags question: http://stackoverflow.com/q/22917486
tags question: http://stackoverflow.com/q/22930736
tags question: http://stackoverflow.com/q/22867822
tags question: http://stackoverflow.com/q/22818306
tags question: http://stackoverflow.com/q/22895368
tags question: http://stackoverflow.com/q/22862006
tags question: http://stackoverflow.com/q/22959373
tags question: http://stackoverflow.com/q/22815500
tags question: http://stackoverflow.com/q/22863708
tags question: http://stackoverflow.com/q/22919153
tags question: http://stackoverflow.com/q/22862727
tags question: http://stackoverflow.com/q/22830430
tags question: http://stackoverflow.com/q/22862358
tags question: http://stackoverflow.com/q/22960901
tags question: http://stackoverflow.com/q/22955882
tags question: http://stackoverflow.com/q/22960361
tags question: http://stackoverflow.com/q/22956942
type: Tag
tags question: http://stackoverflow.com/q/22864994
tags question: http://stackoverflow.com/q/22913725
tags question: http://stackoverflow.com/q/22924607
tags question: http://stackoverflow.com/q/22890578

http://stackoverflow.com/q/22885387
has body: I have a .data file that looks like this: I want my main method to be able to read the file and store it into a 2-dimensional int array, there is a "?" in the data I want it to be converted to a 0. I have this code so far, but it doesn't work and I get a null pointer exception (probably from initializing my 2-d array to null). The problem is if I don't initialize my 2-d array to null it gives me errors EDIT(this answers part of the problem, but how can I get java to get the size of the number of rows in the data and then initialize dataSet to int[number of rows][numbers in each row], I can't even get java to read the file in the first place) public static void main(String[] args){ int[][] dataSet = null; try { Scanner inFile = new Scanner(new File("C:\\Data Folder\\file.data")); while (inFile.hasNextInt()){ for (int i = 0; i &lt; dataSet.length; i++){ for (int j = 0; j &lt; dataSet[i].length;){ dataSet[i][j] = inFile.nextInt(); } System.out.println(dataSet[i]); } } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } I have never tinkered around with files on Java so this is all new to me. Any advice is appreciated EDIT: 3:11 p.m. So I changed my 2-d array to array list instead, thanks Masud: public static void main(String[] args){ List&lt;Integer&gt; dataSet; try { Scanner inFile = new Scanner(new File("C:\\Data Folder\\file.data")); while (inFile.hasNextInt()){ for (int i = 0; i &lt; dataSet.size(); i++){ dataSet.add(inFile.nextInt()); } } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Eclipse is still asking me to set dataSet = null. How would I get the size of the number of rows and number of numbers in each row from the .data file? EDIT: 3:23 pm Thank you Merlin for implementing Masud's suggestion, I have updated my main method to represent your code just to see if it works. I keep getting this error: Exception in thread "main" java.lang.NumberFormatException: For input stri…
type: Question
possible better answer: http://stackoverflow.com/a/22885437
answer count: 2
has answer: http://stackoverflow.com/a/22885437
tagged with: arrays
has comment: http://stackoverflow.com/comment/34921943
score: 0
has answer: http://stackoverflow.com/a/22885536
has comment: http://stackoverflow.com/comment/34922074
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/34921832
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22885536
tagged with: file
has comment: http://stackoverflow.com/comment/34922149
has title: Trying to get values from a .data file and store them into an int[][] array

http://stackoverflow.com/comment/34922353
type: Comment
has text: @IanRoberts : Sorry this is the first time I am trying to parse a JSON, Are you asking about the JSON Parser : JSONParsing or you asking about "DOM" builder. Please help me to understand it.
comment on: http://stackoverflow.com/q/22885015
score: 0
type: QuestionComment

http://stackoverflow.com/a/22864188
downvote count: 0
score: 1
has body: Is it something like this that you are after? public class SchedulerServlet extends HttpServlet { public void init(ServletConfig config) throws ServletException { long interval = Long.parseLong(config.getInitParameter("interval")) * 60 * 1000; MyAction action = new MyAction(this); Timer timer = new Timer(); timer.schedule(action, new Date(), interval); } public void updateSomething(Object obj) { //This gets called from your timertask } } import java.util.TimerTask; public class MyAction extends TimerTask { SchedulerServlet servlet; public MyAction(SchedulerServlet servlet) { this.servlet = servlet; } public void run() { //Do something here... //Send something back to your servlet class this.servlet.updateSomething(obj) } }
upvote count: 1
answers question: http://stackoverflow.com/q/22862663
type: Answer

http://stackoverflow.com/a/22854468
has comment: http://stackoverflow.com/comment/34866221
has comment: http://stackoverflow.com/comment/34866677
score: 0
answers question: http://stackoverflow.com/q/22854054
has body: Please add the code of transform(s,n) to this question. Why this? for (n = N; n &gt;= 4; n &gt;&gt;= 1) {} It seems to be easier: for (int n = N; n &gt;= 4; n--) {} This is crazy: List&lt;double[]&gt; If you'd like to use a list of doubles then use this: List&lt;double&gt; What is the result that you would like to see?
type: Answer

http://stackoverflow.com/q/22811277
answer count: 2
has answer: http://stackoverflow.com/a/22815179
score: 0
has answer: http://stackoverflow.com/a/22813689
has body: I've found a working Sound class online and am using it to play sound in a game I'm making. However, I wanted to continuously play the file so I decided just to use a Swing Timer and it works, the only problem is my game window freezes and won't even let you exit it out without using task manager. Can you please take a look at it and tell me where I went wrong? By the way main is just my object variable for my Sound class, and maindelay is just my int for the delay. public static void loopSound(){ Timer maintime = new Timer(maindelay, new ActionListener(){ public void actionPerformed(ActionEvent e){ main.run(); } }); maintime.start(); } The Sound class I've found: public class Sound extends Thread { private String filename; private Position curPosition; private final int EXTERNAL_BUFFER_SIZE = 524288; // 128Kb enum Position { LEFT, RIGHT, NORMAL }; public Sound(String wavfile) { filename = wavfile; curPosition = Position.NORMAL; } public Sound(String wavfile, Position p) { filename = wavfile; curPosition = p; } public void run() { File soundFile = new File(filename); if (!soundFile.exists()) { System.err.println("Wave file not found: " + filename); return; } AudioInputStream audioInputStream = null; try { audioInputStream = AudioSystem.getAudioInputStream(soundFile); } catch (UnsupportedAudioFileException e1) { e1.printStackTrace(); return; } catch (IOException e1) { e1.printStackTrace(); return; } AudioFormat format = audioInputStream.getFormat(); SourceDataLine auline = null; DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); try { auline = (SourceDataLine) AudioSystem.getLine(info); auline.open(format); } catch (LineUnavailableException e) { e.printStackTrace(); return; } catch (Exception e) { e.printStackTrace(); return; } if (auline.isControlSupported(FloatControl.Type.PAN)) { FloatControl pan = (FloatControl) auline .getControl(FloatControl.Type.PAN); if (curPosition == Position.RIGHT) pan.setValue(1.0f); else if (curPosition == Position.LEF…
tagged with: timer
type: UnansweredQuestion
tagged with: multithreading
tagged with: swing
tagged with: audio
tagged with: java
has comment: http://stackoverflow.com/comment/34791403
has title: Thread loop freezes game window
type: Question

http://stackoverflow.com/comment/34927711
comment on: http://stackoverflow.com/q/22888681
score: 0
has text: Instance variable are by default initialized. its zero for int.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22927337
has title: Simple math to java practice
tagged with: algorithm
has comment: http://stackoverflow.com/comment/35000405
has answer: http://stackoverflow.com/a/22927379
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/34998051
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34998106
has comment: http://stackoverflow.com/comment/35025086
has comment: http://stackoverflow.com/comment/34998057
has comment: http://stackoverflow.com/comment/34998081
has comment: http://stackoverflow.com/comment/34997897
has body: The assignment is to: Create the java statement that will produce f(x) = 2x3 - 8x2 + x + 16. Write a Java program that will find the extrema (both high and low) for the function in part 1 across the closed interval (-1, 3). I don't know what I am doing wrong here exactly but I am getting an infinite number of 9.09.09 and so on. import java.util.*; import java.math.*; public class Extrema { public static void main(String[] args) { double step = 0.00001; double x = -1.0; double xn = 3; double highest = calc(x); while (x &lt;= xn) { double f = calc(x); if (f &gt; highest) { highest = f; } step++; System.out.print(highest); } } public static double calc(double x) { double f = 2*Math.pow(x, 1/3) - 8*Math.pow(x, 2) + x + 16; return f; } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34998154
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/34997927
accepted answer: http://stackoverflow.com/a/22927379
linked to: http://stackoverflow.com/q/7220681
type: Question

http://stackoverflow.com/q/22965673
type: Question
tagged with: eclipse
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22965807
tagged with: dex
has answer: http://stackoverflow.com/a/22965807
has answer: http://stackoverflow.com/a/22965827
tagged with: android
has body: i enabled proguard by adding below line into project.properties, proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt But i dont understand that when i click Run button, compiler uses proguard or not ? If it is not, i need compiler to use proguard every project compiling, because i cant run my project or debeug my project. i am getting an error from dex compiler, "[2014-04-09 16:46:04 - Dex Loader] Unable to execute dex: method ID not in [0, 0xffff]: 65536 [2014-04-09 16:46:04 - project] Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536" I found some article which says this problem can be solved by using proguard. eclipse Version : 4.2.1 ADT Version : 22.3.0.v201310242005-887826 Thank you very much Talha
accepted answer: http://stackoverflow.com/a/22965827
type: AnsweredQuestion
tagged with: compiler-errors
tagged with: java
has title: Is eclipse uses proguard every built of project?

http://stackoverflow.com/q/22948156
answer count: 1
tagged with: push
linked to: http://stackoverflow.com/q/9930683
score: 0
tagged with: android
has title: Push Notification or Polling Service in an Android app
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22953115
has body: I am developing an Android app that allows sports team coaches to update the attendance for events like training/matches. A feature I would like to add would be to display a notification on the device to remind them that they need to update the attendance for the event when it has started. I have been reading online a bit and it seems that push is the preferred method for data that is changing. But because i know the start times of the events, would it be better to create a background service using something like the following? https://stackoverflow.com/a/9933130/2039505 I basically want the user to receive a vibrate notification which when they click on it, it will open the events attendance screen. Hopefully someone will have some insight into which option is best!
type: Question
tagged with: java
tagged with: alarmmanager
tagged with: android-service
has answer: http://stackoverflow.com/a/22953115

http://stackoverflow.com/comment/35030597
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22945539
has text: If it's a standalone file, my [comment](http://stackoverflow.com/questions/22945416/json-create-a-web-page-with-json-data?noredirect=1#comment35030555_22945416) above shows the way to do it in Apache.

http://stackoverflow.com/a/22952582
score: 0
has comment: http://stackoverflow.com/comment/35049578
has body: You need to add sum = 0; after for(int row=0; row&lt;figures.length; ++row) { otherwise the totals are wrong when you calculate the average.
has comment: http://stackoverflow.com/comment/35050505
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35046966
has comment: http://stackoverflow.com/comment/35051425
type: Answer
accepted answer of: http://stackoverflow.com/q/22952446
answers question: http://stackoverflow.com/q/22952446

http://stackoverflow.com/q/22927913
answer count: 1
has comment: http://stackoverflow.com/comment/34999983
has answer: http://stackoverflow.com/a/22928300
has comment: http://stackoverflow.com/comment/34998998
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/35025761
type: Question
has body: Scenario: I run a Java program that paints something in a JPanel when a timer stops. Then I open a PowerPoint presentation in full screen. When my java app opens the JPanel (that is when the timer has stopped), the PowerPoint presentation exits full screen. Problem: my PowerPoint goes out of full screen when I try to do this, but that's exactly what I don't want. I want to keep my PowerPoint presentation in full screen while my Java app is shown over it. Thanks in advance.
has title: Keep a program in full screen while opening a java application

http://stackoverflow.com/comment/34974710
type: Comment
comment on: http://stackoverflow.com/a/22914465
type: AnswerComment
has text: Hello Nathan, thanks for the response. I've tried creating separate classes for each method, and it worked but I might need to run several methods that are in same class in the future. I've checked AfterMethod and it doesn't take dataProvider as parameter. Can you go in more details for that annotation? Thanks
score: 0

http://stackoverflow.com/comment/35046711
score: 0
type: AnswerComment
has text: take out the three dots after Boolean result parameters
type: Comment
comment on: http://stackoverflow.com/a/22954737

http://stackoverflow.com/q/22866179
tagged with: logging
score: 2
has title: how to truncate long exception message in java
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34908416
has comment: http://stackoverflow.com/comment/34886833
has comment: http://stackoverflow.com/comment/34886605
has body: I have long hierarchy of exceptions, one of it add long message with binary data. I can't change it in throw place, since it's in library. How can i truncate it, without losing another exceptions messages? code example: throw new RuntimeException("msg", new RuntimeException(generateLongErrorMessage(), new RuntimeException("short message", new RuntimeException("important message")) ) ); desired output: Exception in thread "main" java.lang.RuntimeException: msg at xxx.excpetionMessageTruncator(Erofeev.java:18) at xxx.main(Erofeev.java:14) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.RuntimeException: long message long message ...(truncated, original size: 100) ... 7 more Caused by: java.lang.RuntimeException: short message ... 7 more Caused by: java.lang.RuntimeException: important message ... 7 more
tagged with: exception
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22866807
upvote count: 2
type: UnansweredQuestion

jsp
tags question: http://stackoverflow.com/q/22841246
tags question: http://stackoverflow.com/q/22880555
tags question: http://stackoverflow.com/q/22951780
tags question: http://stackoverflow.com/q/22914398
tags question: http://stackoverflow.com/q/22906966
tags question: http://stackoverflow.com/q/22860257
tags question: http://stackoverflow.com/q/22906098
tags question: http://stackoverflow.com/q/22848515
tags question: http://stackoverflow.com/q/22832524
tags question: http://stackoverflow.com/q/22894154
tags question: http://stackoverflow.com/q/22965810
tags question: http://stackoverflow.com/q/22922301
tags question: http://stackoverflow.com/q/22846361
tags question: http://stackoverflow.com/q/22918270
tags question: http://stackoverflow.com/q/22835757
tags question: http://stackoverflow.com/q/22812572
tags question: http://stackoverflow.com/q/22824190
tags question: http://stackoverflow.com/q/22877860
tags question: http://stackoverflow.com/q/22922245
tags question: http://stackoverflow.com/q/22912887
tags question: http://stackoverflow.com/q/22950403
tags question: http://stackoverflow.com/q/22935243
tags question: http://stackoverflow.com/q/22869225
tags question: http://stackoverflow.com/q/22905422
tags question: http://stackoverflow.com/q/22950016
tags question: http://stackoverflow.com/q/22928214
tags question: http://stackoverflow.com/q/22907647
tags question: http://stackoverflow.com/q/22935136
tags question: http://stackoverflow.com/q/22930480
tags question: http://stackoverflow.com/q/22957346
tags question: http://stackoverflow.com/q/22816328
tags question: http://stackoverflow.com/q/22838225
tags question: http://stackoverflow.com/q/22854419
tags question: http://stackoverflow.com/q/22912150
tags question: http://stackoverflow.com/q/22915320
tags question: http://stackoverflow.com/q/22964601
tags question: http://stackoverflow.com/q/22919854
tags question: http://stackoverflow.com/q/22842848
tags question: http://stackoverflow.com/q/22868481
tags question: http://stackoverflow.com/q/22918397
tags question: http://stackoverflow.com/q/22901364
tags question: http://stackoverflow.com/q/22913010
tags question: http://stackoverflow.com/q/22878562
tags question: http://stackoverflow.com/q/22881297
tags question: http://stackoverflow.com/q/22878771
tags question: http://stackoverflow.com/q/22909222
tags question: http://stackoverflow.com/q/22911806
tags question: http://stackoverflow.com/q/22900816
tags question: http://stackoverflow.com/q/22872994
tags question: http://stackoverflow.com/q/22855661
tags question: http://stackoverflow.com/q/22901206
tags question: http://stackoverflow.com/q/22812604
tags question: http://stackoverflow.com/q/22868236
type: Tag
tags question: http://stackoverflow.com/q/22880560
tags question: http://stackoverflow.com/q/22869995
tags question: http://stackoverflow.com/q/22940879
tags question: http://stackoverflow.com/q/22902065
tags question: http://stackoverflow.com/q/22967162
tags question: http://stackoverflow.com/q/22966871
tags question: http://stackoverflow.com/q/22928025
tags question: http://stackoverflow.com/q/22908835
tags question: http://stackoverflow.com/q/22926847
tags question: http://stackoverflow.com/q/22914599
tags question: http://stackoverflow.com/q/22808798
tags question: http://stackoverflow.com/q/22855578
tags question: http://stackoverflow.com/q/22856853
tags question: http://stackoverflow.com/q/22879367
tags question: http://stackoverflow.com/q/22883596
tags question: http://stackoverflow.com/q/22908264
tags question: http://stackoverflow.com/q/22923996
tags question: http://stackoverflow.com/q/22959325
tags question: http://stackoverflow.com/q/22928427
tags question: http://stackoverflow.com/q/22891275
tags question: http://stackoverflow.com/q/22925572
tags question: http://stackoverflow.com/q/22829448
tag name: jsp
tags question: http://stackoverflow.com/q/22932933
tags question: http://stackoverflow.com/q/22929033
tags question: http://stackoverflow.com/q/22882887

http://stackoverflow.com/comment/34907753
has text: See on your question I posted answer.
comment on: http://stackoverflow.com/a/22876777
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34849546
type: QuestionComment
comment on: http://stackoverflow.com/q/22845480
type: Comment
score: 1
has text: Can you post the stack trace. I just looked over the classes and they seem fine. I have a suspicion about the way you are reading in the values though - it is looking for the input in the next line but you are reading it in the same line (as System.out.print does not return a new line)

http://stackoverflow.com/a/22841483
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22841368
has body: You basically have two options: 1) Make your int volatile 2) Use an atomic type like AtomicInt using a normal int without synchronization is not thread safe at all.

http://stackoverflow.com/comment/34930872
type: QuestionComment
comment on: http://stackoverflow.com/q/22890400
score: 1
has text: Make sure to fix your constructor too. Should be suit = s and value = v.
type: Comment

http://stackoverflow.com/q/22824071
tagged with: java
tagged with: fileoutputstream
answer count: 1
tagged with: while-loop
type: UnansweredQuestion
score: 0
has body: Having a bit of trouble with file outputs and using try/catch. I'm trying to basically say that if the user inputs an existing filename, keep looping until valid filename is entered. However, i cant seem to get it to work. Any hints on where im going wrong? Tried moving the initial prompt around try block but wouldnt that make the scope only available in the try block? So essentially, i should have the prompt outside so its available to all the try/catch blocks? Not sure though. import java.util.Scanner; import java.io.File; import java.io.IOException; import java.io.PrintWriter; public class TestAccountWithException { public static void main(String[] args) throws IOException { // variable declaration String fileName; String firstName; String lastName; double balance; int id = 1122; final double RATE = 4.50; Scanner input = new Scanner(System.in); System.out.print("Please enter file name: "); fileName = input.next(); File fw = new File(fileName); try { // check if file already exists while(fw.exists()) { System.out.print("File already exists. Enter valid file name: "); fileName = input.next(); fw = new File(fileName); } System.out.print("Enter your first name: "); firstName = input.next(); System.out.print("Enter your last name: "); lastName = input.next(); System.out.print("Input beginnning balance: "); balance = input.nextDouble(); // pass object to printwriter and use pw to write to the file PrintWriter pw = new PrintWriter(fw); // print to created file pw.println(firstName); pw.println(lastName); pw.println(balance); pw.println(id); pw.println(RATE); pw.close(); // System.out.print("Run program? (1) Yes (2) No: "); // cont = input.nextInt(); } catch (IOException e) { e.printStackTrace(); } } // end main } // end class
has title: File output with loop check and try catch block
type: Question
has answer: http://stackoverflow.com/a/22824483
tagged with: try-catch

http://stackoverflow.com/q/22949488
type: Question
tagged with: swingworker
tagged with: java
has title: Getting a deadlock in Swing, unsure how to proceed
has comment: http://stackoverflow.com/comment/35046687
has body: In my Java Swing application I have the following code that is called when a button is clicked: class MyWorker extends SwingWorker&lt;String, Object&gt; { @Override protected String doInBackground() throws Exception { loadMasterFile(); judgeFileListModel = new DefaultListModel(); // Refresh model return "Done."; } @Override protected void done() { LB.setVisible(false); } } new MyWorker().execute(); In the called code I open a JFileChooser. The first time it runs great - If I then press the button again after the code has finished it hangs. If I then debug and pause when that happens I appear to have a deadlock. I have no clue how to handle this - still a student. I'd absolutely love some help if possible. EDIT: I've fixed it! To anyone having a similar issue - it's due to the JFileChooser being inside the loadMasterFile() method. It apparently violates swing rules having any GUI code inside doInBackground() so I refactored it out of there and it works great.
score: 0
has comment: http://stackoverflow.com/comment/35039301
has comment: http://stackoverflow.com/comment/35039153
has comment: http://stackoverflow.com/comment/35037944
has comment: http://stackoverflow.com/comment/35038675
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
linked to: http://stackoverflow.com/q/7053865
tagged with: swing
has comment: http://stackoverflow.com/comment/35037852

http://stackoverflow.com/comment/35054704
type: AnswerComment
has text: I tried it but still its throwing error.. Not able to connect to DB
type: Comment
comment on: http://stackoverflow.com/a/22959109
score: 0

http://stackoverflow.com/a/22918122
has body: You can use ScheduledThreadPoolExecutor. For example: var scheduler = Executors.newScheduledThreadPool(1); var scheduledFuture = scheduler.schedule(this::method, 5, TimeUnit.SECONDS); public String method() { System.out.println("Executed!"); return "Called!"; } First a ScheduledExecutorService is created with one thread in. Then an anonymous implementation of the Callable interface is created and passed to the schedule() method. The two last parameters specify that the Callable should be executed after 5 seconds.
accepted answer of: http://stackoverflow.com/q/22918059
type: Answer
has comment: http://stackoverflow.com/comment/34980452
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/22918059
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34972876
type: Comment
type: QuestionComment
has text: i think they are different things. adobe poi seems to be just a wrapper around apache poi
score: 1
comment on: http://stackoverflow.com/q/22913687

http://stackoverflow.com/q/22963154
type: Question
score: -2
has comment: http://stackoverflow.com/comment/35061637
tagged with: eclipse
has answer: http://stackoverflow.com/a/22963265
answer count: 2
linked to: http://stackoverflow.com/q/5446565
upvote count: 0
has answer: http://stackoverflow.com/a/22963369
tagged with: android-activity
possible better answer: http://stackoverflow.com/a/22963265
favorite count: 0
accepted answer: http://stackoverflow.com/a/22963369
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35061519
has title: How to check if the activity is open
tagged with: java
downvote count: 2
has body: I would like to somehow check if the activity is open. I have got activity1.java and activity2.java. If the user will open activity 1, textview will be green else textview will be blue(I know how to change background dynamically). I want to do it this way! If (activity1 is open) { tv.setBackgroundColor(COLOR.GREEN); } else if(activity2 is open) { tv.setBackgroundColor(COLOR.BLUE); }

struts2
tags question: http://stackoverflow.com/q/22814580
tags question: http://stackoverflow.com/q/22881297
tags question: http://stackoverflow.com/q/22869995
tags question: http://stackoverflow.com/q/22875725
tags question: http://stackoverflow.com/q/22856853
tags question: http://stackoverflow.com/q/22959325
tags question: http://stackoverflow.com/q/22827906
tag name: struts2
tags question: http://stackoverflow.com/q/22929033
tags question: http://stackoverflow.com/q/22819908
tags question: http://stackoverflow.com/q/22818036
tags question: http://stackoverflow.com/q/22828322
tags question: http://stackoverflow.com/q/22880555
tags question: http://stackoverflow.com/q/22914326
tags question: http://stackoverflow.com/q/22848515
tags question: http://stackoverflow.com/q/22937358
tags question: http://stackoverflow.com/q/22924607
tags question: http://stackoverflow.com/q/22853521
tags question: http://stackoverflow.com/q/22894510
tags question: http://stackoverflow.com/q/22966069
tags question: http://stackoverflow.com/q/22815438
tags question: http://stackoverflow.com/q/22810214
tags question: http://stackoverflow.com/q/22841246
tags question: http://stackoverflow.com/q/22854346
tags question: http://stackoverflow.com/q/22894137
tags question: http://stackoverflow.com/q/22835757
type: Tag
tags question: http://stackoverflow.com/q/22812841
tags question: http://stackoverflow.com/q/22927262

http://stackoverflow.com/q/22828189
answer count: 2
tagged with: jstl
has body: I am sending Object with help of ModdelAndView in Spring controller, but i am not able to read it on jsp? JSP: &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; Tried with EL: ${user} Try with JSTL: &lt;c:out value="${user}"&gt;&lt;/c:out&gt; &lt;/body&gt; &lt;/html&gt; controller: @Controller public class StudentHome { @RequestMapping(value = "/auth/Home") public ModelAndView RedirectLogin() { ModelAndView modelAndView = new ModelAndView("/auth/Home"); modelAndView.addObject("user", "Alex"); return modelAndView; } } I have tried both Spring EL and jstl its not working. Do i need to include anything else?
downvote count: 0
has title: Not able to read Model passed by controller on jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/22833666
has answer: http://stackoverflow.com/a/22833666
tagged with: spring-el
accepted answer: http://stackoverflow.com/a/22828336
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22828336

http://stackoverflow.com/comment/34993614
has text: Yes. Put your variables in the JobConf and override `configure` in your Mapper to access them. http://hadoop.apache.org/docs/r1.1.1/api/org/apache/hadoop/mapred/Mapper.html
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22924613
type: QuestionComment

http://stackoverflow.com/comment/34890162
has text: Don't be confused by the difference between what your JVM actually does on any particular day with what a correctly implemented JVM is _allowed_ to do.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22865761

http://stackoverflow.com/q/22940414
type: AnsweredQuestion
has title: Failing in assertion using PowerMockito when testing Singleton
tagged with: java
has comment: http://stackoverflow.com/comment/35025219
type: Question
has comment: http://stackoverflow.com/comment/35025949
tagged with: mocking
has comment: http://stackoverflow.com/comment/35024747
tagged with: mockito
accepted answer: http://stackoverflow.com/a/22946588
downvote count: 0
answer count: 1
has body: Assuming the follow tests: public void testSingleton1() { Mock1 mock1 = PowerMockito.mock(Mock1.class); Mock2 mock2 = PowerMockito.mock(Mock2.class); PowerMockito.whenNew(Mock1.class).withNoArguments().thenReturn(mock1); PowerMockito.when(mock1.getMock2()).thenReturn(mock2); PowerMockito.when(mock2.method1("A", "B", "C")).thenReturn("D"); Singleton singleton = Singleton.getInstance(); assertEquals("D", singleton.method1("A", "B", "C")); Mockito.verify(mock1, Mockito.times(1)).getMock2(); Mockito.verify(mock2, Mockito.times(1)).method1("A", "B", "C"); } public void testSingleton2() { Mock1 mock1 = PowerMockito.mock(Mock1.class); Mock2 mock2 = PowerMockito.mock(Mock2.class); PowerMockito.whenNew(Mock1.class).withNoArguments().thenReturn(mock1); PowerMockito.when(mock1.getMock2()).thenReturn(mock2); PowerMockito.when(mock2.method1("B", "C", "D")).thenReturn("F"); Singleton singleton = Singleton.getInstance(); assertEquals("F", singleton.method1("B", "C", "D")); Mockito.verify(mock1, Mockito.times(1)).getMock2(); Mockito.verify(mock2, Mockito.times(1)).method1("B", "C", "D"); } The first test is passing successfuly but the second fails in assertion, returning null. I think that the problem is because i'm testing a singleton and the new expectation (PowerMockito.when(mock2.method1("B", "C", "D")).thenReturn("F");) is not working. PS: When i run only the testSingleton2() it's working correctly.
favorite count: 0
tagged with: powermock
upvote count: 2
has comment: http://stackoverflow.com/comment/35026118
has answer: http://stackoverflow.com/a/22946588
score: 2

http://stackoverflow.com/comment/34926234
type: Comment
has text: java.library.path and LD_LIBRARY_PATH have to point to _directories_ containing the .so file(s), not the file(s) themselve(s).
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22887779

http://stackoverflow.com/comment/35157088
type: Comment
has text: I am glad it works. Repay? No. I am even proud about that green hook left to the question :P
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22963045

actionlistener
tags question: http://stackoverflow.com/q/22868890
tags question: http://stackoverflow.com/q/22929970
tags question: http://stackoverflow.com/q/22863842
tags question: http://stackoverflow.com/q/22893034
tags question: http://stackoverflow.com/q/22865976
tags question: http://stackoverflow.com/q/22885751
tags question: http://stackoverflow.com/q/22902545
tags question: http://stackoverflow.com/q/22827609
tags question: http://stackoverflow.com/q/22881007
tags question: http://stackoverflow.com/q/22885858
tags question: http://stackoverflow.com/q/22876768
tags question: http://stackoverflow.com/q/22966183
tags question: http://stackoverflow.com/q/22857194
tags question: http://stackoverflow.com/q/22829386
type: Tag
tags question: http://stackoverflow.com/q/22824582
tag name: actionlistener
tags question: http://stackoverflow.com/q/22903159
tags question: http://stackoverflow.com/q/22965482
tags question: http://stackoverflow.com/q/22926852
tags question: http://stackoverflow.com/q/22889227
tags question: http://stackoverflow.com/q/22853459
tags question: http://stackoverflow.com/q/22869744

http://stackoverflow.com/q/22864106
type: AnsweredQuestion
downvote count: 0
tagged with: logging
type: Question
tagged with: java
has title: logback not logging to file
tagged with: logback
upvote count: 2
answer count: 1
favorite count: 0
has body: trying to get logback to log to a .log file, but it's only outputting to the console... any ideas? heres the logback-test.xml <?xml version="1.0" encoding="UTF-8"?> %-4relative [%thread] %-5level %logger{35} - %msg %n C:/Users/aahmad/Desktop/logbackTestFiel.log false %-4r %-5level %logger{35}: %msg%n <appender-ref ref="STDOUT" /> <appender-ref ref="FILE"/> and heres the code package log.back.test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.core.util.StatusPrinter; public class HelloWorld2 { public static void main(String[] args) { Logger logger = LoggerFactory.getLogger("chapters.introduction.HelloWorld2"); logger.debug("Hello world."); logger.info("Hello file"); logger.error("Hello 2 world."); // print internal state // LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); // StatusPrinter.print(lc); } } thank you for the help... also, anyone know what the logback equivalent of org.apache.log4j.helpers.OnlyOnceErrorHandler? I'm actually doing a migration and log4j declares this <errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler" /> but idk what the logback version of this is
has answer: http://stackoverflow.com/a/22865316
accepted answer: http://stackoverflow.com/a/22865316
tagged with: log4j
score: 2

http://stackoverflow.com/comment/34797229
comment on: http://stackoverflow.com/a/22816417
score: 0
has text: Then you're gonna have a problem because if your clazz is a List<Something> it won't work
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35099404
has text: I would suggest using http://www.mybringback.com/series/android-basics/ for the basics. That's where I started. I know that this does not answer your question, but I thought that it could help you out
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22929038

http://stackoverflow.com/q/22872046
has title: Duplicate calls received to RestFul web service method with Jersey in weblogic
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/26232816
upvote count: 2
has comment: http://stackoverflow.com/comment/41143016
type: UnansweredQuestion
tagged with: web-services
has body: I have RestFul web service method developed using jersey-bundle(1.1.1,1.17.1) and deployed to weblogic server 10.3.4.0. I get duplicate calls for some of the call when client made. I get my rest service getting called twice when it actually made one. I have capture some of the network logs using wireshark and found that it happens whenever stats [RST, ACK] sent by the server. What could be the reason for server sending back [RST] for some of the calls from client?
score: 2
tagged with: java
tagged with: duplicates
type: Question
tagged with: client-server
downvote count: 0
answer count: 1

multithreading
tags question: http://stackoverflow.com/q/22874061
tags question: http://stackoverflow.com/q/22817672
tags question: http://stackoverflow.com/q/22933521
tags question: http://stackoverflow.com/q/22893381
tags question: http://stackoverflow.com/q/22901822
tags question: http://stackoverflow.com/q/22879321
tags question: http://stackoverflow.com/q/22926992
tags question: http://stackoverflow.com/q/22939209
tags question: http://stackoverflow.com/q/22924925
tags question: http://stackoverflow.com/q/22899461
tags question: http://stackoverflow.com/q/22898062
tags question: http://stackoverflow.com/q/22862226
type: Tag
tags question: http://stackoverflow.com/q/22847309
tags question: http://stackoverflow.com/q/22934691
tags question: http://stackoverflow.com/q/22929502
tags question: http://stackoverflow.com/q/22914548
tags question: http://stackoverflow.com/q/22852007
tags question: http://stackoverflow.com/q/22900548
tags question: http://stackoverflow.com/q/22886591
tags question: http://stackoverflow.com/q/22923492
tags question: http://stackoverflow.com/q/22895417
tags question: http://stackoverflow.com/q/22854622
tags question: http://stackoverflow.com/q/22841368
tags question: http://stackoverflow.com/q/22879631
tags question: http://stackoverflow.com/q/22830528
tags question: http://stackoverflow.com/q/22820330
tags question: http://stackoverflow.com/q/22858434
tags question: http://stackoverflow.com/q/22846484
tags question: http://stackoverflow.com/q/22894885
tags question: http://stackoverflow.com/q/22914882
tags question: http://stackoverflow.com/q/22871599
tags question: http://stackoverflow.com/q/22937592
tags question: http://stackoverflow.com/q/22811277
tags question: http://stackoverflow.com/q/22967585
tags question: http://stackoverflow.com/q/22864673
tags question: http://stackoverflow.com/q/22865969
tags question: http://stackoverflow.com/q/22827114
tags question: http://stackoverflow.com/q/22866058
tags question: http://stackoverflow.com/q/22958771
tags question: http://stackoverflow.com/q/22958042
tags question: http://stackoverflow.com/q/22850485
tags question: http://stackoverflow.com/q/22843984
tags question: http://stackoverflow.com/q/22874126
tags question: http://stackoverflow.com/q/22966973
tags question: http://stackoverflow.com/q/22918280
tags question: http://stackoverflow.com/q/22852760
tags question: http://stackoverflow.com/q/22945150
tags question: http://stackoverflow.com/q/22809940
tags question: http://stackoverflow.com/q/22873026
tags question: http://stackoverflow.com/q/22950249
tags question: http://stackoverflow.com/q/22834614
tags question: http://stackoverflow.com/q/22925526
tags question: http://stackoverflow.com/q/22859292
tags question: http://stackoverflow.com/q/22943122
tags question: http://stackoverflow.com/q/22904987
tags question: http://stackoverflow.com/q/22898756
tags question: http://stackoverflow.com/q/22913800
tags question: http://stackoverflow.com/q/22956866
tags question: http://stackoverflow.com/q/22851716
tags question: http://stackoverflow.com/q/22896441
tags question: http://stackoverflow.com/q/22962711
tags question: http://stackoverflow.com/q/22946260
tags question: http://stackoverflow.com/q/22877238
tags question: http://stackoverflow.com/q/22914270
tags question: http://stackoverflow.com/q/22923370
tags question: http://stackoverflow.com/q/22953760
tags question: http://stackoverflow.com/q/22823672
tags question: http://stackoverflow.com/q/22902279
tags question: http://stackoverflow.com/q/22929078
tags question: http://stackoverflow.com/q/22848691
tags question: http://stackoverflow.com/q/22949488
tags question: http://stackoverflow.com/q/22911395
tags question: http://stackoverflow.com/q/22908520
tags question: http://stackoverflow.com/q/22930287
tags question: http://stackoverflow.com/q/22865783
tags question: http://stackoverflow.com/q/22913193
tags question: http://stackoverflow.com/q/22852377
tags question: http://stackoverflow.com/q/22875028
tags question: http://stackoverflow.com/q/22879721

http://stackoverflow.com/comment/35070389
score: 0
type: AnswerComment
type: Comment
has text: Thank you for your answer, this is what i'm looking for, but i still don't have a right clarity on the content of packages io and domain.
comment on: http://stackoverflow.com/a/22968022

http://stackoverflow.com/a/22827432
score: 0
accepted answer of: http://stackoverflow.com/q/22826153
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35049504
type: Answer
answers question: http://stackoverflow.com/q/22826153
has body: Ok, this is a very simple example, and does not efficiently handle View recycling, data manipulation, etc. activity_main.xml list_item.xml <ImageView android:id="@+id/imageView1" android:layout_width="60dp" android:layout_height="60dp" android:src="@drawable/ic_launcher" /> <TextView android:id="@+id/textView_Name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginTop="5dp" android:layout_toRightOf="@+id/imageView1" android:text="Linsey Sexton" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="@android:color/white" /> <TextView android:id="@+id/textView_RecentMessage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView_Name" android:layout_below="@+id/textView_Name" android:text="Hey baby, I love you..." android:textColor="@android:color/white" /> MainActivity.java public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView listView = (ListView) findViewById(R.id.listView); final ArrayList<Entry> entries = new ArrayList<Entry>(); entries.add(new Entry("Linsey Sexton", "Hey baby, I love you...")); entries.add(new Entry("Joe Schmoe", "<Insert standard response here>")); entries.add(new Entry("Linsey Sexton", "Joe, what are you saying?!")); entries.add(new Entry("Joe Schmoe", "We're done, baby!")); ArrayAdapter adapter = new ArrayAdapter(this, R.layout.list_item, R.id.textView_Name, entries) { @Override public View getView(int position, View convertView, ViewGroup parent) { View view = super.getView(position, convertView, parent); ImageView image = (ImageView) view.findViewById(R.id.imageView1); TextView text1 = (TextView) view.findViewById(R.id.textView_Name); TextView text2 = (TextView) view.findViewById(R.id.textView_RecentMessage); image.se…

http://stackoverflow.com/q/22872625
has comment: http://stackoverflow.com/comment/34923980
has answer: http://stackoverflow.com/a/22888678
type: AnsweredQuestion
has title: Processing sketch works fine in Java mode, but not in Processing.js
has body: I like to publish some of the Processing sketches I make on my web site using Processing.js. This particular one I made, however, doesn't work right in JavaScript mode. At first I thought it was because it used the ArrayList class, which is generic, and generic classes weren't supported in Processing until relatively recently. But then I remembered that another sketch I made that uses that same class works fine in Processing.js. Here's the code that's giving me problems: ArrayList&lt;Point&gt; line; class Point { float x, y, z; Point(float x, float y, float z) { this.x = x; this.y = y; this.z = z; } Point copy() { return new Point(x, y, z); } } Point cursor; void setup() { line = new ArrayList&lt;Point&gt;(); size(400, 400, P3D); cursor = new Point(width/2, height/2, 0); line.add(cursor.copy()); frameRate(60); } void draw() { background(0); camera(); noSmooth(); float coefficient = 0.05; cursor.x = map(coefficient, 0.0, 1.0, cursor.x, mouseX); cursor.y = map(coefficient, 0.0, 1.0, cursor.y, mouseY); if (mousePressed &amp;&amp; (mouseButton == LEFT)) cursor.z -= 5.0; if (mousePressed &amp;&amp; (mouseButton == RIGHT)) cursor.z += 5.0; if (mousePressed &amp;&amp; (mouseButton == CENTER)) { cursor = new Point(width/2, height/2, 0); line.clear(); } line.add(cursor.copy()); rotate(sin(frameCount / 60.0) * 0.2, 0, 1, 0); noFill(); stroke(255, 255, 0); pushMatrix(); translate(200, 200, 0); box(400, 400, 400); popMatrix(); // Draw the line stroke(0, 255, 0); Point last = null; for (Point p : line) { if (last != null) { line(last.x, last.y, last.z, p.x, p.y, p.z); } last = p; } // Draw the cursor float radius = 24; stroke(255, 0, 0); line(cursor.x - radius, cursor.y, cursor.z, cursor.x + radius, cursor.y, cursor.z); line(cursor.x, cursor.y - radius, cursor.z, cursor.x, cursor.y + radius, cursor.z); line(cursor.x, cursor.y, cursor.z - radius, cursor.x, cursor.y, cursor.z + radius); } And here is the live page that doesn't work. What's causing this problem, and more importantl…
tagged with: java
has comment: http://stackoverflow.com/comment/34905239
upvote count: 1
tagged with: processing.js
has comment: http://stackoverflow.com/comment/34899703
type: Question
tagged with: processing
has comment: http://stackoverflow.com/comment/34905565
accepted answer: http://stackoverflow.com/a/22888678
has comment: http://stackoverflow.com/comment/34918645
tagged with: javascript
tagged with: webgl
has comment: http://stackoverflow.com/comment/34924160
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34907761

http://stackoverflow.com/q/22868268
tagged with: spring
tagged with: properties
type: AnsweredQuestion
tagged with: java
tagged with: annotations
accepted answer: http://stackoverflow.com/a/22868353
has body: In a Spring MVC anotation driven web app I have this as my container config @EnableWebMvc @Configuration @ComponentScan("com.mobiusinversion.web") public class Config { @Value("${jdbc.driverClassName}") private String driverClassName; @Value("${jdbc.url}") private String url; @Value("${jdbc.username}") private String username; @Value("${jdbc.password}") private String password; and in my application.properties, I have ################### JDBC Configuration ########################## jdbc.driverClassName=org.hsqldb.jdbcDriver jdbc.url=jdbc:hsqldb:file:db/myDB;shutdown=true jdbc.username=david jdbc.password= But when I deploy my war in the webapps directory of my jetty server, I get this error: Caused by: java.lang.ClassNotFoundException: ${jdbc.driverClassName} at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:436) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:389) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) So clearly this property is not getting processed. How do I use the @Value annotation correctly to configure this property?
type: Question
linked to: http://stackoverflow.com/q/22750449
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22868353
has title: @Value Annotation Syntax Issue

http://stackoverflow.com/q/22860793
tagged with: java
has title: JavaMail - How to set SMTP “RCPT TO:” that will not match “To:” Header in DATA
has body: In my small project, I want to setup the "RCPT TO" and "To" look like this: RCPT TO: &lt;user-signup-123123123@bounces.example.com&gt; DATA 354 Go ahead vw9sm7458976pbc.68 - gsmtp Date: Thu, 02 Mar 2012 14:06:02 +0200 (ICT) To: +10xxxxxxxxxx And I tried with the following code JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); mailSender.setHost("HOST"); mailSender.setPort("PORT"); mailSender.setUsername("USERNAME"); mailSender.setPassword("PASSWORD"); MimeMessage mimeMessage = mailSender.createMimeMessage(); try { mimeMessage.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress("user-signup-123123123@bounces.example.com")); MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); helper.setTo("+10xxxxxxxxxx"); } catch(Exception e) { System.out.println(e.getMessage()); } And the log I got MAIL FROM:&lt;abc@xxxxx.com&gt; 250 2.1.0 OK x5sm16625925pbw.26 - gsmtp RCPT TO:&lt;user-signup-123123123@bounces.example.com&gt; 250 2.1.5 OK x5sm16625925pbw.26 - gsmtp RCPT TO:&lt;+10xxxxxxxxxx&gt; As you see, the program created a new "RCPT TO" value with "+10xxxxxxxxxx". How can I set "RCPT TO" value that will not match with "To" header in DATA?
tagged with: jakarta-mail
has answer: http://stackoverflow.com/a/22865824
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
score: 3
tagged with: email
accepted answer: http://stackoverflow.com/a/22865824
upvote count: 3
answer count: 2
possible better answer: http://stackoverflow.com/a/31327240
tagged with: spring
has answer: http://stackoverflow.com/a/31327240

http://stackoverflow.com/comment/35070639
comment on: http://stackoverflow.com/a/22968086
type: Comment
has text: no modifier in C# is the equivalent of `private` in other languages, *and* it's the equivalent of `private` in C#. That is, `private` is the default. However, that's only true for class members, I believe top level classes default to internal. I should probably edit to include that info.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/97078160
has text: It doesn't even need to be an argument captor. Any argument matcher works with the `timeout` function.
comment on: http://stackoverflow.com/a/24003733
score: 5
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22884335
has answer: http://stackoverflow.com/a/22884755
downvote count: 0
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/22884779
has comment: http://stackoverflow.com/comment/34919947
has title: Java ArrayList Iterator next() not working as intended
upvote count: 1
has body: I am trying to create an algorithm that determines if one array list (s1) is a sub-sequence of another array list (s2). The elements in the first list all need to be in the second list and must be in the same order. So s1 is a sub-sequence of s2, but s1 is not a sub-sequence of s2. I need to use iterators to go through each list, and I should only go through each list once (since it has to be in the same order). I seem to have an issue with the next() becoming void ?? What would cause this/how can I fix this? The code I currently have seems to work as I would hope with the exception of not going to the next element in the first array list. import dataStructures.*; public class Subsequence2 { public static void main(String[] args) { ArrayList&lt;Character&gt; s1 = new ArrayList&lt;Character&gt;(); s1.add('n'); s1.add('p'); s1.add('a'); ArrayList&lt;Character&gt; s2 = new ArrayList&lt;Character&gt;(); s2.add('a'); s2.add('n'); s2.add('b'); s2.add('p'); s2.add('c'); s2.add('a'); Subsequence2 one = new Subsequence2(); System.out.print("S1 is a subsequence of S2 is a "); System.out.print(one.subSequence(s1, s2)); System.out.print(" statment."); } //end main public static &lt;T&gt; boolean subSequence(ArrayList&lt;T&gt; s1, ArrayList&lt;T&gt; s2) { //if s1 is empty or if s1 and s2 are empty it is a subsequence if(s1.isEmpty() || (s1.isEmpty() &amp;&amp; s2.isEmpty())) { return true; } //if s2 is empty and s1 is not is is not a subsequence. else if(s2.isEmpty()) { return false; } else { int s1Count = 0; //count items matched Iterator&lt;T&gt; itr1 = s1.iterator(); Iterator&lt;T&gt; itr2 = s2.iterator(); while(itr1.hasNext()) //for(Iterator&lt;T&gt; itr1 = s1.iterator(); itr1.hasNext();) //traverse s1 { T c1 = itr1.getCurrent(); itr1.next(); //go to next element of s1 while(itr2.hasNext()) //traverse s2 { T c2 = itr2.getCurrent(); //if items are equal check the next item and add 1 to count of items matched if(c1.equals(c2)) { itr2.next(); ++s1Count; //used for testing- just…
accepted answer: http://stackoverflow.com/a/22884779
has comment: http://stackoverflow.com/comment/34920005
type: AnsweredQuestion
tagged with: algorithm
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34921336
has comment: http://stackoverflow.com/comment/34921316
has comment: http://stackoverflow.com/comment/34920124
type: Question
has comment: http://stackoverflow.com/comment/34921066
possible better answer: http://stackoverflow.com/a/22884755
tagged with: iterator
answer count: 2

http://stackoverflow.com/comment/34908416
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22866179
has text: i was aiming for something very much like mbred said below - if you know the code location where its caught you can rebuild the exception and strip out the long message, of just "peel" the outer layers and leave just the root cause. your only other option is a custom logger/appender

http://stackoverflow.com/comment/34902593
score: 1
comment on: http://stackoverflow.com/a/22874548
type: AnswerComment
type: Comment
has text: What do you mean with the "team player"? What if this was part of a library used by some random person ? I would say there is something wrong with the architecture of his solution. A way better approach would be to enforce permission checking before returning an object of the class containing setPermission() to an "authenticated" client

http://stackoverflow.com/q/22902924
has body: This code is a table that has an option to Inert name, delete, show, and quit . this code run's well but my only problem is on how to delete a chosen name in a node class Node{ Node in; String name; public Node(){ in = null; } public Node(String n){ in = null; name = n; } public void setIn(Node n){ in = n; } public Node getIn(){ return in; } public void setName(String n){ name = n; } public String getName(){ return name; } public class Main{ public static void main(String args[]){ Scanner scan = new Scanner(System.in); LinkedList bi = new LinkedList(); while(true){ System.out.println("Choose!\n[a] Insert Name\n[b] Delete\n[c] Show\n[d] Exit"); char c = scan.next().charAt(0); System.out.println(); if(c == 'a'){ System.out.print("Enter Name: "); bi.insert(scan.next()); System.out.println(); } else if(c == 'b'){ System.out.print("Enter Name to delete: "); bi.delete(scan.next()); System.out.println(); } else if(c == 'c'){ bi.show(); System.out.println(); } else if(c == 'd'){ System.exit(0); } } } } class LinkedList{ private Node root; public LinkedList(){ root = null; } public void insert(String n){ root = insert(root, n); } private Node insert(Node n, String r){ if(n == null){ n = new Node(r); } else{ n.in = insert(n.in, r); } return n; } public void delete(String n){ root = delete(root, n); } private Node delete(Node n, String r){ } public void show(){ show(root); } private Node show(Node n){ if(n == null){ System.out.println("Empy list!"); } else{ while(n!=null){ System.out.println(n.getName()); n = n.getIn(); } } return n; } } *i don't know how to delete a node . What should i put on my delete method? public void delete(String n){ root = delete(root, n); } private Node delete(Node n, String r){ }
tagged with: linked-list
downvote count: 0
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/22903004
accepted answer: http://stackoverflow.com/a/22903004
upvote count: 3
has answer: http://stackoverflow.com/a/22902969
has answer: http://stackoverflow.com/a/59112781
favorite count: 0
has answer: http://stackoverflow.com/a/22902958
possible better answer: http://stackoverflow.com/a/22902969
has comment: http://stackoverflow.com/comment/34953568
has title: java - how to delete a node from linkedlist?
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/35102919
type: AnswerComment
comment on: http://stackoverflow.com/a/22934824
type: Comment
has text: your code is working properly but when I added the scaling code again I didn't got anything.Please check the updated code in question section.
score: 0

http://stackoverflow.com/q/22868084
tagged with: constants
type: AnsweredQuestion
tagged with: swing
upvote count: 7
has comment: http://stackoverflow.com/comment/34891617
type: Question
has comment: http://stackoverflow.com/comment/34889955
has answer: http://stackoverflow.com/a/22868335
has comment: http://stackoverflow.com/comment/34890282
score: 7
tagged with: java
answer count: 1
downvote count: 0
has body: I was making a swing application, and realized I had a handful of classes that needed access to the same set of constants. I couldnt bring myself to declare one the primary holder of them and place them all in there and have the others reference it; I thought, hey, I'll just have them all inherit from some common place, but Java doesnt do multiple inheritence, BUT I can put infinity interfaces on things. So the idea came to me to dump them all into an interface (it's true, it just naturally occurred to me without doing any research). I later learned that this is heresy. "In fact, it's such a bad idea that there's a name for it: the Constant Interface Antipattern" - as discussed here (along with an alternate solution (which I opted to employ)). I was just fine with this until I was looking at the source code for JDialog and JFrame, which read thusly: public class JDialog extends Dialog implements WindowConstants, Accessible, RootPaneContainer, TransferHandler.HasGetTransferHandler { ... and public class JFrame extends Frame implements WindowConstants, Accessible, RootPaneContainer, TransferHandler.HasGetTransferHandler { ... Maybe it's just me, but I sure see a constant interface in there. Even more interesting was one of the author declarations in JDialog, i.e. James Gosling. The father of the language allowed this alleged mistake on his watch? (Another notable example - SwingConstans) If the constant interface antipattern is such a bad idea, then why is it so heavily employed in one of the most famous packages of the language (i.e. swing)?
has title: If the constant interface anti-pattern is such a crime, why does Swing do it?
tagged with: anti-patterns
favorite count: 0
has comment: http://stackoverflow.com/comment/34890302
accepted answer: http://stackoverflow.com/a/22868335
tagged with: interface
has comment: http://stackoverflow.com/comment/34889948
has comment: http://stackoverflow.com/comment/34890248

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

http://stackoverflow.com/comment/34991354
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22923492
has text: Either you don't have anything that gathers things up - i.e. more asynchronous. Or you simply use `invokeAll` and wait for everything to complete - it will remain in the order you passed in the data.

http://stackoverflow.com/q/22902705
has answer: http://stackoverflow.com/a/22902763
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/34954053
has title: How to handle null string in java
has comment: http://stackoverflow.com/comment/34953231
favorite count: 0
has comment: http://stackoverflow.com/comment/34953226
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/22902833
has body: I am .net programmer and completely new in java. I am facing problem in handling null string in java. I am assigning value from string array to string variable completeddate. I tried all this but that didn't work. String COMPLETEDATE; COMPLETEDATE = country[23]; if(country[23] == null &amp;&amp; country[23].length() == 0) { // ... } if (COMPLETEDATE.equals("null")) { // ... } if(COMPLETEDATE== null) { // ... } if(COMPLETEDATE == null || COMPLETEDATE.equals("null")) { // ... }
answer count: 4
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/41932907
has answer: http://stackoverflow.com/a/22902759
downvote count: 4
has comment: http://stackoverflow.com/comment/34953144
has comment: http://stackoverflow.com/comment/34953157

http://stackoverflow.com/comment/34857253
type: Comment
type: AnswerComment
has text: I plan on using a .tmx file to add a tiled map. Do you have any idea how I would be able to implement this? Thanks.
comment on: http://stackoverflow.com/a/22846668
score: 0

http://stackoverflow.com/comment/35037317
type: AnswerComment
comment on: http://stackoverflow.com/a/22948440
type: Comment
score: 0
has text: I would simply say that if you find your code is a mess, there are reasons. Make sure you target the reasons in your next - or even this - go. Taking advantage of strong typing will reduce your debugging time.

http://stackoverflow.com/comment/35004301
has text: I was able to resolve the issue with this request: `code Bundle params = new Bundle(); params.putString("id", id); params.putString("fields", "name"); Request request = new Request(nsession, "search", params, HttpMethod.GET, new Request.Callback() { public void onCompleted(Response response) { try { JSONObject res = response.getGraphObject().getInnerJSONObject().getJSONArray("data").getJSONObject(0); final String nname = (String) res.get("name"); `
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22897862
score: 0

http://stackoverflow.com/comment/34978259
score: 1
comment on: http://stackoverflow.com/a/22916432
type: AnswerComment
type: Comment
has text: Some beans are plugins but not all of them. Eventually, you'll need some way to identify the plugins which are visible/installed/active.

http://stackoverflow.com/comment/34994581
has text: Why are you passing three arrays ?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22925361

http://stackoverflow.com/comment/34907867
comment on: http://stackoverflow.com/a/22877595
type: Comment
score: 0
has text: GetGraphics is not how custom painting is done; this likely violating the single thread rules of Swing; you should not dispose of a Graphics context you did not create, this can prevent what was painted from been painted to the screen on some systems; this could just as easily be accomplished with a Swing Timer or even better, a animation library like Trident or TiminggFramework
type: AnswerComment

http://stackoverflow.com/comment/34868439
type: Comment
comment on: http://stackoverflow.com/a/22855671
type: AnswerComment
score: 0
has text: +1 - Thanks Madhav link was very helpful. Yes, you are right for non-standard solution but i will try to not implement them unless and until it is do and die case.

http://stackoverflow.com/comment/34895643
type: AnswerComment
has text: spring-asm-3.1.0.RELEASE.jar spring-beans-3.1.0.RELEASE.jar spring-context-3.1.0.RELEASE.jar spring-context-support-3.1.0.RELEASE.jar spring-core-3.1.0.RELEASE.jar org.springframework .expression-3.0.5.RELEASE.jar ... Please suggest what should i do to correct the mismatch
type: Comment
comment on: http://stackoverflow.com/a/22870058
score: 0

http://stackoverflow.com/q/22917147
accepted answer: http://stackoverflow.com/a/22917235
has comment: http://stackoverflow.com/comment/34979020
has comment: http://stackoverflow.com/comment/34979312
has body: I got the red and blue values of a pixel from get.RGB and using bitwise operators: red = (rgb[i][j] &gt;&gt; 8) &amp; 0xFF; blue = rgb[i][j] &amp; 0xFF; But how do I recolour the pixel in question with the "average of red and blue values"? This means I have to exclude the green. The only required import is BufferedImage.
score: 0
tagged with: java
tagged with: bufferedimage
answer count: 1
has comment: http://stackoverflow.com/comment/34979154
has comment: http://stackoverflow.com/comment/34979211
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22917235
has title: Using Red and Blue values to colour a pixel (BufferedImage)?
type: Question

http://stackoverflow.com/comment/34797029
type: AnswerComment
score: 0
type: Comment
has text: I am not clear on the mechanics of the loop there, but if you do a simple assignment (not up to Integer.MAX_VALUE), the assignment itself is faster. Because you keep re-assigning a new array of Object size 6 up to Integer.MAX_VALUE when all you need to do is array = newArray. There is no need for the second loop.
comment on: http://stackoverflow.com/a/22815568

http://stackoverflow.com/q/22921799
has comment: http://stackoverflow.com/comment/35094010
type: Question
tagged with: hadoop
answer count: 2
has comment: http://stackoverflow.com/comment/35031148
has answer: http://stackoverflow.com/a/35694001
has answer: http://stackoverflow.com/a/23080427
score: 0
has comment: http://stackoverflow.com/comment/35104028
has title: Hive table created, however map task is failing with exception
type: UnansweredQuestion
has body: I have created a tweets table in Hive(hive-0.10.0 on CDH 4.6), stuck with the below error when try to execute query hive&gt; select * from tweets where id='442990122795929600'; Total MapReduce jobs = 1 Launching Job 1 out of 1 Number of reduce tasks is set to 0 since there's no reduce operator Starting Job = job_201404071250_0010, Tracking URL = http://swapnil:50030/jobdetails.jsp?jobid=job_201404071250_0010 Kill Command = /usr/lib/hadoop/bin/hadoop job -kill job_201404071250_0010 Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0 2014-04-08 00:45:24,755 Stage-1 map = 0%, reduce = 0% 2014-04-08 00:46:25,892 Stage-1 map = 0%, reduce = 0% 2014-04-08 00:47:06,691 Stage-1 map = 100%, reduce = 100% Ended Job = job_201404071250_0010 with errors Error during job, obtaining debugging information... Job Tracking URL: http://swapnil:50030/jobdetails.jsp?jobid=job_201404071250_0010 Examining task ID: task_201404071250_0010_m_000002 (and more) from job job_201404071250_0010 Task with the most failures(4): ----- Task ID: task_201404071250_0010_m_000000 URL: http://swapnil:50030/taskdetails.jsp?jobid=job_201404071250_0010&amp;tipid=task_201404071250_0010_m_000000 ----- Diagnostic Messages for this Task: java.lang.RuntimeException: Error in configuring object at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:109) at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:75) at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:133) at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:413) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:332) at org.apache.hadoop.mapred.Child$4.run(Child.java:268) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:416) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1438) at org.apache.hadoop.mapred.Child.main(Child.java:262) Caused by: java.lang.reflect.Inv…
tagged with: hive
tagged with: cloudera-cdh
linked to: http://stackoverflow.com/q/14353394
tagged with: java

http://stackoverflow.com/q/22967658
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35075056
has body: In order to solve a problem I am currently working on, I need to find out what is the default height of a JLabel. I am using a dummy approach: JLabel label = new JLabel(); Dimension dim = label.getPreferredSize(); Is there a way to get the default height without instantiating JLabel?
type: Question
has comment: http://stackoverflow.com/comment/35070975
has comment: http://stackoverflow.com/comment/35069752
has comment: http://stackoverflow.com/comment/35071742
has answer: http://stackoverflow.com/a/22968124
tagged with: java
has title: What is the correct way of getting the default JLabel dimensions?
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/35069628
has comment: http://stackoverflow.com/comment/35073761
accepted answer: http://stackoverflow.com/a/22968124
type: AnsweredQuestion

http://stackoverflow.com/a/22865846
score: 0
answers question: http://stackoverflow.com/q/22853168
has body: See the following which works fine. Replace the &lt;jpa:repositories/&gt; (Spring Data API specific) with &lt;context:component-scan base-package="your.base.package" /&gt; https://github.com/alanhay/spring-data-jpa-bootstrap/blob/master/src/main/resources/applicationContextRepository.xml assumes minimal persistence.xml in default location: https://github.com/alanhay/spring-data-jpa-bootstrap/blob/master/src/main/resources/META-INF/persistence.xml
type: Answer

http://stackoverflow.com/comment/34975480
type: AnswerComment
type: Comment
has text: Are you using JMX? The trace shows that something (a MBean) is trying to be registered and maybe the name is incorrect.
comment on: http://stackoverflow.com/a/22910349
score: 0

memory-model
tag name: memory-model
tags question: http://stackoverflow.com/q/22862226
type: Tag

http://stackoverflow.com/q/22962667
type: Question
upvote count: 4
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jdbc
tagged with: ucanaccess
has title: Reading .mdb files with UCanAccess returns column names in all UPPERCASE
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35103679
has comment: http://stackoverflow.com/comment/35099419
score: 4
tagged with: java
has body: I'm in the middle from migrating from the JDBC-ODBC bridge driver to the UCanAccess driver. In doing this, I'm facing the following problem: The UCanAccess driver returns all columnames in UPPERCASE, but I need them to be CamelCase. Any ideas? Thx!
has comment: http://stackoverflow.com/comment/35079464
has answer: http://stackoverflow.com/a/23160963

http://stackoverflow.com/comment/35192593
type: Comment
comment on: http://stackoverflow.com/a/23031415
score: 2
type: AnswerComment
has text: Thanks for clarification. One question left: What exactly do you mean by saying "very little observable difference"? Should there be a difference at all? I am still wondering why there are two classes where `IsoFields` (the week-related fields in class `IsoFields`) could just be seen as specialized week-fields for the ISO-case of the class `WeekFields`.

http://stackoverflow.com/q/22882703
tagged with: java
type: Question
has body: I have a listView and a timer iterates through each list item. Ideally I'd like to have the currently selected item to automatically center in the listView. I've played around with smoothScrollToPosition() but am lost on how to work out centering the current item. My corrected code (thanks to Matej Spili): // Smooth scroll the list item try { scrollView.smoothScrollBy(scrollView.getChildAt().getTop(‌​) - (scrollView.getHeight() / 2) + (scrollView.getChildAt().getHeight() / 2), 1500); } catch (NullPointerException e) { System.out.println("NULL POINTER DEALT WITH"); }
has title: Centering a list item on the screen when selected in Android?
accepted answer: http://stackoverflow.com/a/22882767
tagged with: listview
score: 0
tagged with: android
answer count: 1
tagged with: centering
has answer: http://stackoverflow.com/a/22882767
type: AnsweredQuestion

http://stackoverflow.com/q/22874977
favorite count: 0
possible better answer: http://stackoverflow.com/a/22875065
has comment: http://stackoverflow.com/comment/34903409
has comment: http://stackoverflow.com/comment/34903449
has answer: http://stackoverflow.com/a/22875065
accepted answer: http://stackoverflow.com/a/22875132
has comment: http://stackoverflow.com/comment/34903511
type: AnsweredQuestion
has title: Modifying data from an Async task in an entirely different class
score: 1
tagged with: java
has body: I would like to know just out of curiosity if there are any convenient ways of pulling data out of an async task created inside a class, and then modifying the data in another class (Without extending classes) I have a way to do it, but it involves making methods static along with the Async task itself for example, here I'm just making a string "text" in the Async task public class Main extends Activity{ //Context ctx; static class MyAsyncTask extends AsyncTask&lt;Void,String,String&gt;{ static String result; private static Context context; public MyAsyncTask(Context m) { this.context = m; } @Override protected String doInBackground(Void... noArgs) { result = "text"; return result; } protected void onPostExecute(String result) { super.onPostExecute(result); } public static String getStr() { return result; } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText et = (EditText)findViewById(R.id.editText1); Button btn = (Button)findViewById(R.id.button1); MyAsyncTask task = new MyAsyncTask(this); task.execute(); final Test t = new Test(); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { et.append(t.modifiedString()); } }); } } and in a new class I make a simple String method to modify that data from the async task public class Test{ public String modifiedString() { // Main main = null; // MyAsyncTask task = new MyAsyncTask(main.ctx); // task.execute(); String s = (String)Main.MyAsyncTask.getStr(); return "modified " + s + "\n"; } } I'm wondering, is there a way I can do this without having to make the async task static? Perhaps with sharing contexts or something? by the way I'm not doing this to solve any particular problem, I'm only doing it out of curiosity
upvote count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/22875737
has answer: http://stackoverflow.com/a/22875132
answer count: 3
tagged with: android

http://stackoverflow.com/comment/34810048
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22823252
type: AnswerComment
has text: " Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at arrayprime.main(arrayprime.java:28)" And line 28 s that line with the initialization of the squareroot of the value in Array[i]

http://stackoverflow.com/a/22885595
has body: JPanel temp = new JPanel(); By default a JPanel uses a FlowLayout. a FlowLayout vertically centers the components added to the panel. If you don't like this behaviour then try a different layout manager like a horizontal BoxLayout, which will allow you to align the component at the top/center/bottom depending on the components vertical alignment. However, using a JPanel is not the best approach. Instead you should be adding the line number component to the row header of the scroll pane. See Text Component Line Number for an example of this approach.
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22884632

http://stackoverflow.com/a/22914121
upvote count: 1
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/35108142
has comment: http://stackoverflow.com/comment/35002308
type: Answer
has comment: http://stackoverflow.com/comment/35104030
has comment: http://stackoverflow.com/comment/35009902
has body: Kivy uses python-for-android to compile APKs for you. It also provides pyjnius to wrap Android/Java API calls. This lets you access things like the Location API. The Plyer project is a cross platform layer that uses pyjnius for the Android part. There is a GPS example in Plyer which you can compile and use on Android if you have Kivy and Buildozer set up properly. Or you can read the source code of the GPS for Android part of Plyer to make your calls via pyjnius.
answers question: http://stackoverflow.com/q/22905896

http://stackoverflow.com/comment/34938748
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22867806
has text: "If you want to see picture still pixelated when you scale it use Texture filter" - How would I scale it? The image is nested in a TextButton, so I'm not exactly sure how to.
type: AnswerComment

http://stackoverflow.com/comment/34873448
type: AnswerComment
type: Comment
has text: This is my flex code. private var fr:FileReference; var request:URLRequest = new URLRequest(); request.url = UPLOAD_URL; request.contentType="multipart/form-data"; fr.upload(request); I am not aware of how to specify enctype="multipart/form-data" in flex forms.So I am sending request to JSP like this. But I am getting the same error. Also in JSP, List<FileItem> items = upload.parseRequest(request); When I try to print items,I am getting the size as 0.
score: 0
comment on: http://stackoverflow.com/a/22858554

http://stackoverflow.com/q/22931476
tagged with: delaunay
upvote count: 1
score: 0
tagged with: triangulation
downvote count: 1
tagged with: opengl-es
favorite count: 0
type: UnansweredQuestion
has body: Let take a look at this image: the left is frame 5 while the right is frame 0 Click here is you want to view the higher resolution of frame 5 or frame 0 Frame 0 means there is no rotation while frame 5 means it's rotated 5 degrees from frame 0. In each frame, there is a list of edge (2D) from delaunay triangulation (which is displayed as a mesh as you see). I also have list of edge (2D) from delaunay triangulation for frame 1 (rotate 1 degree from frame 0), frame 2, frame 3, frame 4. With these parameter, could anyone tell me how to generate image (bitmap) of frame 1, 2, 3,4 so that when scroll from frame 0 to frame 5, it looks smooth. Any help would be appreciated. --
has answer: http://stackoverflow.com/a/22935008
has answer: http://stackoverflow.com/a/23031383
has title: How to generate bitmap from 2 bitmaps?
tagged with: java
tagged with: image
type: Question
answer count: 2

http://stackoverflow.com/a/48186387
downvote count: 0
has body: Find any digit is Armstrong number or not using loop for(int arm_num = 0 ; arm_num &lt; 100000 ; arm_num++) { String[] data = String.valueOf(arm_num).split("(?&lt;=.)"); int lngth = String.valueOf(arm_num).length(); int arm_t_num = 0; int ary[] = new int[lngth]; for(int i = 0 ; i &lt; lngth ; i++) { ary[i] = Integer.parseInt(data[i]); for(int x = 0 ; x &lt; lngth-1 ; x++) { ary[i] = ary[i] * Integer.parseInt(data[i]); } arm_t_num+=ary[i]; } if(arm_num == arm_t_num) { System.out.println("Number is ArmStrong : "+arm_num); } }
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22895936

http://stackoverflow.com/comment/35038675
type: Comment
type: QuestionComment
has text: Sorry, I think I have been a little hasty here. If the method is defined in `MyWorker` itself then this is not the strong hint that I assumed. Still you seem to access objects that seem to be elsewhere (`LB`, which is a bad variable name btw). If you do so in `loadMasterFile` also this _may_ be part of the problem. You need to show us more of the context of the specific call that fails.
comment on: http://stackoverflow.com/q/22949488
score: 0

http://stackoverflow.com/comment/34923106
comment on: http://stackoverflow.com/q/22886103
score: 0
type: Comment
type: QuestionComment
has text: Here is the code in two files, it is very simple: http://pastebin.com/FGFu2cDr and http://pastebin.com/y2eKQNmg

http://stackoverflow.com/comment/35006877
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22932212
score: 0
has text: There are no restrictions, I only try things out, as I never worked with Java graphics before. The only thing is, that I would like to use the setRGB method, and not just drawing lines and arcs.

http://stackoverflow.com/q/22813486
has title: Correct use of Lucene BooleanQuery?
tagged with: java
type: Question
has body: I'm trying to nest one BooleanQuery inside of another. The inner BooleanQuery is created with the following code and added to topBQuery. BooleanQuery topBQuery = new BooleanQuery(); // add a numeric range query on loan amount. if( row.getLoan_amt() &gt; 0 ){ BooleanQuery loanBQuery = new BooleanQuery(); Double loanMin = 0.0; Double loanMax = 0.0; Double loanAmt = row.getLoan_amt(); // Range should be within +- 5% of loan amount. loanMin = loanAmt - (loanAmt * .05); loanMax = loanAmt + (loanAmt * .05); loanBQuery.add(NumericRangeQuery.newDoubleRange(TitleRecordColumns.SR_LOAN_VAL_1.toString(), loanMin, loanMax, true, true), BooleanClause.Occur.SHOULD); loanBQuery.add(NumericRangeQuery.newDoubleRange(TitleRecordColumns.SR_LOAN_VAL_2.toString(), loanMin, loanMax, true, true), BooleanClause.Occur.SHOULD); loanBQuery.add(NumericRangeQuery.newDoubleRange(TitleRecordColumns.SR_LOAN_VAL_3.toString(), loanMin, loanMax, true, true), BooleanClause.Occur.SHOULD); topBQuery.add(loanBQuery, BooleanClause.Occur.MUST); } Another field is added to topBQuery with the following: if( !row.getPropertykey_tx().isEmpty() ){ //TitleRecordColumns is an enum topBQuery.add(new TermQuery(new Term(TitleRecordColumns.SA_SITE_ADDR.toString(), row.getPropertykey_tx())), BooleanClause.Occur.SHOULD); } I only want documents that match the ranges I've created in any of the SR_LOAN_VAL fields. A record should also match the provided address. Am I creating the BooleanQuery properly? Is there also a better way to do this kind of search? I'm using Lucene 4.7. I've looked at my index with Luke and I am confident that I've indexed the fields properly. Thank you! Edit: This is the code I am using to generate the "final query" that I use to search the index with. Most examples I've seen do something like this. Is this correct? StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_47); Query finalQuery = new QueryParser(Version.LUCENE_47, TitleRecordColumns.SA_SITE_ADDR.toString(), analyzer).parse(t…
has answer: http://stackoverflow.com/a/22814162
tagged with: lucene
score: 0
answer count: 1
type: UnansweredQuestion

maven
tags question: http://stackoverflow.com/q/22871450
tags question: http://stackoverflow.com/q/22860835
tags question: http://stackoverflow.com/q/22851637
tags question: http://stackoverflow.com/q/22907294
type: Tag
tags question: http://stackoverflow.com/q/22871879
tags question: http://stackoverflow.com/q/22945589
tags question: http://stackoverflow.com/q/22830946
tags question: http://stackoverflow.com/q/22894499
tags question: http://stackoverflow.com/q/22935840
tags question: http://stackoverflow.com/q/22963720
tags question: http://stackoverflow.com/q/22840269
tags question: http://stackoverflow.com/q/22913316
tags question: http://stackoverflow.com/q/22870422
tags question: http://stackoverflow.com/q/22872093
tags question: http://stackoverflow.com/q/22930811
tags question: http://stackoverflow.com/q/22968266
tags question: http://stackoverflow.com/q/22824608
tags question: http://stackoverflow.com/q/22839590
tags question: http://stackoverflow.com/q/22861957
tags question: http://stackoverflow.com/q/22930171
tags question: http://stackoverflow.com/q/22864465
tags question: http://stackoverflow.com/q/22912472
tags question: http://stackoverflow.com/q/22829125
tags question: http://stackoverflow.com/q/22877020
tags question: http://stackoverflow.com/q/22870361
tags question: http://stackoverflow.com/q/22960319
tags question: http://stackoverflow.com/q/22924981
tags question: http://stackoverflow.com/q/22967008
tags question: http://stackoverflow.com/q/22873675
tags question: http://stackoverflow.com/q/22942189
tags question: http://stackoverflow.com/q/22833557
tags question: http://stackoverflow.com/q/22880414
tags question: http://stackoverflow.com/q/22908398
tags question: http://stackoverflow.com/q/22880979
tags question: http://stackoverflow.com/q/22906840
tags question: http://stackoverflow.com/q/22946626
tags question: http://stackoverflow.com/q/22857478
tags question: http://stackoverflow.com/q/22961085
tags question: http://stackoverflow.com/q/22920122
tags question: http://stackoverflow.com/q/22938746
tags question: http://stackoverflow.com/q/22860812
tags question: http://stackoverflow.com/q/22829358
tags question: http://stackoverflow.com/q/22842000
tags question: http://stackoverflow.com/q/22956085
tags question: http://stackoverflow.com/q/22855744
tags question: http://stackoverflow.com/q/22947168
tags question: http://stackoverflow.com/q/22896338
tags question: http://stackoverflow.com/q/22814573
tags question: http://stackoverflow.com/q/22884795
tags question: http://stackoverflow.com/q/22963323
tags question: http://stackoverflow.com/q/22935500
tags question: http://stackoverflow.com/q/22940304
tags question: http://stackoverflow.com/q/22942435
tags question: http://stackoverflow.com/q/22814352
tags question: http://stackoverflow.com/q/22839716
tags question: http://stackoverflow.com/q/22817629
tags question: http://stackoverflow.com/q/22861740
tags question: http://stackoverflow.com/q/22873574
tags question: http://stackoverflow.com/q/22912015
tags question: http://stackoverflow.com/q/22896243
tags question: http://stackoverflow.com/q/22893309
tags question: http://stackoverflow.com/q/22945673
tags question: http://stackoverflow.com/q/22846430
tags question: http://stackoverflow.com/q/22934140
tags question: http://stackoverflow.com/q/22935388
tags question: http://stackoverflow.com/q/22910257
tags question: http://stackoverflow.com/q/22868647
tags question: http://stackoverflow.com/q/22876460
tags question: http://stackoverflow.com/q/22835563
tags question: http://stackoverflow.com/q/22960874
tags question: http://stackoverflow.com/q/22959124
tags question: http://stackoverflow.com/q/22870804
tags question: http://stackoverflow.com/q/22938124
tags question: http://stackoverflow.com/q/22946631
tags question: http://stackoverflow.com/q/22897547
tags question: http://stackoverflow.com/q/22936404
tags question: http://stackoverflow.com/q/22888273
tags question: http://stackoverflow.com/q/22840845
tags question: http://stackoverflow.com/q/22914446

http://stackoverflow.com/comment/34939597
score: 0
comment on: http://stackoverflow.com/q/22895000
type: QuestionComment
type: Comment
has text: @HotLicks It seems that not all he wants, though. He wants that single method to enforce its signature on all methods of an implementing class (At least, that's what I got out of it).

http://stackoverflow.com/comment/35010994
score: 0
type: Comment
type: QuestionComment
has text: I referring to a workspace which was created using Eclipse.
comment on: http://stackoverflow.com/q/22909433

http://stackoverflow.com/comment/34953621
score: 0
has text: @WillNewton Yes, that would make this whole thing easier, but my professor doesn't want us to make a method but do it with loops instead, he just likes making life more complicated....
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22902892

http://stackoverflow.com/q/22916822
favorite count: 0
has title: Get two different class instances and compare them (Java)
upvote count: 1
type: AnsweredQuestion
has body: I am receiving input from my Ext JS application on the front end and I want to compare two records on the java side, the record prior to a form update on the UI side and the record after setting all the new values. I have made two references to the same type of object, one before setting new values (oldRecord) and one after (newRecord) and compare these but when I try to use oldRecord.getClass() on the old record it will show the new field values. Is there any way to have access to the old values? I also tried making two field arrays and passing those into my method. private static Map&lt;String, List&lt;String&gt;&gt; changes; public static &lt;T&gt; Map&lt;String, List&lt;String&gt;&gt; getChanges (T oldRecord, T newRecord) { changes = new HashMap&lt;String, List&lt;String&gt;&gt;(); try { if(oldRecord instanceof UserInfo &amp;&amp; oldRecord.getClass().equals(newRecord.getClass())) { Field field = oldRecord.getClass().getDeclaredField("name"); field.setAccessible(true); System.out.println(field.get(oldRecord)); field = newRecord.getClass().getDeclaredField("name"); field.setAccessible(true); System.out.println(field.get(newRecord)); // will loop through all fields in both records and compare } } catch (Exception e) { System.err.println("Exception"); } return changes; }
tagged with: reflection
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22916961
type: Question
has answer: http://stackoverflow.com/a/22916961
has answer: http://stackoverflow.com/a/22916943
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/64036
accepted answer: http://stackoverflow.com/a/22916943
has comment: http://stackoverflow.com/comment/34978236

http://stackoverflow.com/q/22952061
tagged with: concurrenthashmap
has body: My current code is iterating the ConcurrentHashMap using the for-each Java 5 loop. In the below code since the implicit iterator is fail-safe, I don't run into ConcurrentModificationException. Map&lt;Long,String&gt; map = new ConcurrentHashMap &lt;Long,String&gt;(); map.put(1L, "1"); map.put(2L, "2"); System.out.println("map size before" + map.size()); for ( Long id : map.keySet()) { map.remove(id); } System.out.println("map size after" + map.size()); Is there any reason as to why I should change the code to use an explicit iterator and run an iterator.remove()
tagged with: java.util.concurrent
type: Question
tagged with: hashmap
tagged with: concurrency
accepted answer: http://stackoverflow.com/a/22952106
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/38728042
has answer: http://stackoverflow.com/a/38728042
score: 2
type: AnsweredQuestion
has title: Iterating ConcurrentHashmap
has answer: http://stackoverflow.com/a/22952106
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/35056929
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22960832
has text: You can't do that directly in a `List`; at least not with Java 7. With Java 8 you could use `.stream().allMatch()`. With Java 7 you have to loop and extract; or if you use Guava, `Iterables.filter()` through a `Predicate`
score: 0

http://stackoverflow.com/a/22931927
type: Answer
answers question: http://stackoverflow.com/q/22928638
score: 0
has body: As the last parameter in the constructor calls, you wrote Duelist aaron = new Duelist("Aaron",(1/3)); There you are dividing an int by another int, and the result will be 0 in this case. This has to be changed to Duelist aaron = new Duelist("Aaron",(1.0/3.0)); so that double values are used (and the result will be 0.3333, as desired). Most of your Duelist class does not seem to be "wrong", but the shootAtTarget method could be improved. A general hint: I'd recommend you to never use Math.random(). This will deliver unpredictable results. Instead, you should use an instance of java.util.Random. This can be initialized with a certain random seed, so that it always provides the same sequence of random numbers. This makes debugging much easier. Additonally, some tests have been redundant. When the probabilityOfHitting is 1.0, then there is no special test required: The random number will always be less-than-or-equal to 1.0. You are also occasionally calling target.getAlive() for no apparent reason. So in the end, the method could look like this: private static Random random = new Random(0); //need to create a method for the duelists to shoot at each other public void shootAtTarget(Duelist target) { double randomNum = random.nextDouble(); if (randomNum &lt;= this.probabilityOfHitting) { target.setAlive(false); } } However, the main problem was in your Test class. I'm not sure about general recommendations here. One could go very far in terms of abstraction. (A Java Enterprise Architect would probably end up with writing a AbstractDuelistStrategyFactory somewhere...). But to put it simply: At the moment, you are doing at most one shot. After one shot, nobody can have won. And you don't know how many shots have to be taken before there is only one duelist remaining. Much of this could be made more elegant and flexible if you placed the Duelists into a List&lt;Duelist&gt;. But without that, an approach that is "structurally close to what you started" could look like this: i…

http://stackoverflow.com/comment/35060057
comment on: http://stackoverflow.com/q/22958559
type: Comment
type: QuestionComment
has text: @Carsten @biesior the default user agent used by AHC seems to be `NING/1.0`. I don't know which user agent is used by `openStream()`
score: 0

http://stackoverflow.com/comment/34836107
comment on: http://stackoverflow.com/a/22837145
type: AnswerComment
type: Comment
has text: This does not answer the question.
score: 0

http://stackoverflow.com/q/22948158
upvote count: 2
answer count: 1
downvote count: 0
favorite count: 0
score: 2
tagged with: netbeans
type: UnansweredQuestion
has title: How do I get StringBuilder documentation back in netbeans?
has body: For some inexplicable reason my NetBeans install 7.4 beta stopped showing the StringBuilder methods in my Java classes. I haven't messed with anything at all it just stopped working. Any suggestions?
tagged with: java
tagged with: javadoc
has answer: http://stackoverflow.com/a/22948549
has comment: http://stackoverflow.com/comment/35062169
type: Question

http://stackoverflow.com/comment/34922174
score: 0
comment on: http://stackoverflow.com/q/22884474
type: Comment
type: QuestionComment
has text: did you pass any command line args?

http://stackoverflow.com/q/22951012
has comment: http://stackoverflow.com/comment/35040312
tagged with: java
has title: Java NullPointerException on Applet
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35040945
has comment: http://stackoverflow.com/comment/35040482
score: 0
has answer: http://stackoverflow.com/a/22956211
accepted answer: http://stackoverflow.com/a/22956211
answer count: 1
has comment: http://stackoverflow.com/comment/35049105
tagged with: applet
has comment: http://stackoverflow.com/comment/35040293
has comment: http://stackoverflow.com/comment/35041262
has comment: http://stackoverflow.com/comment/35040374
tagged with: nullpointerexception
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/35041416
has comment: http://stackoverflow.com/comment/35040359
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35040364
has comment: http://stackoverflow.com/comment/35040393
has body: I am trying to embed an applet into an HTML for demonstration in my Uni class. Every time I try to run the execute the applet, I get a NullPointerException dialog. What am I doing wrong? This is my Pacman! The repository. This is the main class for the applet. The jar contains multiple classes also. package pacman; import java.applet.Applet; import java.awt.Color; import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferStrategy; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.net.URL; import java.util.Random; @SuppressWarnings("serial") public class InitialClass extends Applet implements Runnable, KeyListener { private final int WIDTH = 224; private final int HEIGHT = 288; private Map map; private Hero pacman; private Blinky blinky; private Graphics second; private Image image, bg, current,current_bl, pm1, pm2, pm3, pm4, pm5, pm6, pm7, pm8, pm9,bl1,bl2,bl3,bl4,bl5,bl6,bl7,bl8; private URL base; private int counter; public void init() { setSize(WIDTH, HEIGHT); setBackground(Color.BLACK); setFocusable(true); addKeyListener(this); Frame frame = (Frame) this.getParent().getParent(); frame.setTitle("Pac-Man"); frame.setResizable(false); try { base = getDocumentBase(); System.out.println(base); } catch (Exception e) { } pm1 = getImage(base, "data/pac_1.png"); pm2 = getImage(base, "data/pac_2.png"); pm3 = getImage(base, "data/pac_3.png"); pm4 = getImage(base, "data/pac_4.png"); pm5 = getImage(base, "data/pac_5.png"); pm6 = getImage(base, "data/pac_6.png"); pm7 = getImage(base, "data/pac_7.png"); pm8 = getImage(base, "data/pac_8.png"); pm9 = getImage(base, "data/pac_9.png"); bl1 = getImage(base, "data/bl_1.png"); bl2 = getImage(base, "data/bl_2.png"); bl3 = getImage(base, "data/bl_3.png"); bl4 = getImage(base, "data/bl_4.png"); bl5 = getImage(base, "data/bl_5.png"); bl6 = getImage(base, "data/bl_6.png"); bl7 = getImage(base, "data/bl_7.png"); bl8 = getImage(base, "data/bl_…
has comment: http://stackoverflow.com/comment/35040794
type: Question

http://stackoverflow.com/comment/34984776
score: 0
type: Comment
has text: David Conrad,Iterator<Element> ite = table.select("FONT[style=FONT-SIZE: 10pt]").iterator(); get iterator. I know that asList() was incorrectly
type: QuestionComment
comment on: http://stackoverflow.com/q/22920125

http://stackoverflow.com/comment/35037344
type: Comment
comment on: http://stackoverflow.com/q/22941593
has text: It is not an exact duplicate. In fact, I even mention that one discussion here. I use the same code, but I am attacking the problem on a different angle, thus a new discussion.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34873377
comment on: http://stackoverflow.com/q/22856643
score: 0
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22821905
linked to: http://stackoverflow.com/q/2663980
has comment: http://stackoverflow.com/comment/34807346
answer count: 2
possible better answer: http://stackoverflow.com/a/22821925
favorite count: 0
has comment: http://stackoverflow.com/comment/34807725
has comment: http://stackoverflow.com/comment/34807306
has answer: http://stackoverflow.com/a/22822064
accepted answer: http://stackoverflow.com/a/22822064
has body: I am implementing a simple switch case which will switch on an Enum value. Following is the code ScheduleType scheduleType = ScheduleType.valueOf(scheduleTypeString); switch (scheduleType) { case ScheduleType.CRON_EXPRESSION: System.out.println("Cron"); break; } But I am getting the following error in my IDE: The qualified case label ScheduleType.CRON_EXPRESSION must be replaced with the unqualified enum constant CRON_EXPRESSION Can somebody explain why do I get this error and what's wrong with the code. I know the right way to do is to remove the ClassName, but why do I need to do that? Because generally in comparisons I do use it like for example in equals and all. Thanks
tagged with: spring
upvote count: 4
linked to: http://stackoverflow.com/q/14325481
has comment: http://stackoverflow.com/comment/34807815
downvote count: 6
has comment: http://stackoverflow.com/comment/34808551
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22821925
has comment: http://stackoverflow.com/comment/34807310
linked to: http://stackoverflow.com/q/10161408
has comment: http://stackoverflow.com/comment/34807499
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/34807564
tagged with: enums
score: -2
has comment: http://stackoverflow.com/comment/34807404
tagged with: java
has title: Using enums for switch case in Java
has comment: http://stackoverflow.com/comment/34807808

http://stackoverflow.com/a/22868789
has comment: http://stackoverflow.com/comment/35526581
type: Answer
answers question: http://stackoverflow.com/q/22867286
has body: The short answer is you can't. The exception is coming from FileTreeWalker.visit. To be precise, it is trying to build a newDirectoryStream when it fails (this code is out of your control): // file is a directory, attempt to open it DirectoryStream&lt;Path&gt; stream = null; try { stream = Files.newDirectoryStream(entry); } catch (IOException ioe) { return new Event(EventType.ENTRY, entry, ioe); // ==&gt; Culprit &lt;== } catch (SecurityException se) { if (ignoreSecurityException) return null; throw se; } Maybe you should submit a bug.
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/q/22877111
has answer: http://stackoverflow.com/a/22877244
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 0
answer count: 2
has title: Parsing a json string format = {TEST:[1,2,3,4]} by Gson
has body: How do i parse the following String into json. String jsonString=" {\"TEST64\":[1,0,16,0],\"TEST59\":[2,0,17,0],\"TEST65\":[2,0,16,0],\"TEST57\":[1,0,16,0],\"TEST66\":[2,0,17,0],\"TEST67\":[1,0,18,0], \"TEST58\":[2,0,13,0],\"TEST55\":[1,0,17,0],\"TEST68\":[1,0,16,0],\"TEST69\":[2,0,18,0],\"TEST56\":[1,0,16,0],\"TEST53\":[2,0,13,0], \"TEST54\":[1,0,17,0],\"TEST70\":[2,0,17,0],\"TEST52\":[2,0,16,0],\"TEST51\":[1,0,16,0],\"TEST61\":[2,0,16,0],\"TEST60\":[2,0,14,0], \"TEST63\":[2,0,18,0],\"TEST62\":[1,0,18,0]}"; I am using gson, and trying to convert into MAP but get an exception: new Gson().fromJson(jsonString, HashMap.class); and get exception: Exception in thread "main" com.google.gson.JsonParseException: Expecting array but found object: java.lang.Object@4c5e176f at com.google.gson.JsonArrayDeserializationVisitor.startVisitingObject(JsonArrayDeserializationVisitor.java:89) at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:119) at com.google.gson.JsonDeserializationContextDefault.fromJsonArray(JsonDeserializationContextDefault.java:67) at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:52) at com.google.gson.MapTypeAdapter.deserialize(MapTypeAdapter.java:68) at com.google.gson.MapTypeAdapter.deserialize(MapTypeAdapter.java:33) at com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:51) at com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:92) at com.google.gson.JsonDeserializationVisitor.visitUsingCustomHandler(JsonDeserializationVisitor.java:80) at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:101) at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:76) at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:54) at com.google.gson.Gson.fromJson(Gson.java:551) at com.google.gson.Gson.fromJson(G…
has comment: http://stackoverflow.com/comment/34908584
has answer: http://stackoverflow.com/a/22877330

http://stackoverflow.com/q/22877469
has title: Uploading Excel file in swing
tagged with: excel
type: Question
accepted answer: http://stackoverflow.com/a/22880641
tagged with: java
linked to: http://stackoverflow.com/q/8343593
has body: I am upload the Excel file and read that file according to format, but problem is that that file is not read. I am getting exception. I am adding all required jar file (dom4j-1.6.1,poi-3.9-20121203,poi-ooxml-3.9-20121203,poi-ooxml-schemas-3.9-20121203,xmlbeans-2.3.0). Please suggest me what I getting wrong. Exception is below. public class Csv_Upload extends JFrame implements ActionListener { public static JFrame f; JPanel panel; JButton b1,b2,b3,b4; JTextField txt1; JLabel l1; Font g,g1; JFileChooser fc; JTextArea log; File file1 ; String str; DBConnection connect=new DBConnection(); static private final String newline = "\n"; 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); txt1=new JTextField(); txt1.setBounds(480, 150,200,40); panel.add(txt1); fc = new JFileChooser(); b1=new JButton("Browse File"); b1.setBounds(50, 150,200,40); b1.setFont(g1); b1.setForeground(Color.RED); panel.add(b1); b2=new JButton("Upload File"); b2.setBounds(260, 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(50, 230,50,30); b3.setForeground(Color.RED); b3.setFont(g1); panel.add(b3); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); // b4.addActionListener(this); } @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); } //Handle save button action. } if(e.getSource()==b2) { try { FileInputStream file = new FileInputStream(new File(str)); System.out.printl…
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22880641
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: swing

http://stackoverflow.com/comment/35076309
comment on: http://stackoverflow.com/q/22955178
score: 2
has text: I am not too surprised that Java is a bit faster than C++ iostreams. The iostreams design suffers from being object oriented and using virtual functions. Unlike a Java virtual machine, C++ cannot translate virtual calls into inline calls. You get better performance by using the C stdio functions which just read data rather than trying to support virtual data sources and virtual format operations.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34859010
type: AnswerComment
comment on: http://stackoverflow.com/a/22850326
type: Comment
score: 0
has text: I don't know the subtleties between Object and Class Adapters. I just know how to use Adapters, as I've linked in my answer. It seems there is confusion.

bufferedreader
tags question: http://stackoverflow.com/q/22922628
tags question: http://stackoverflow.com/q/22882363
tags question: http://stackoverflow.com/q/22879001
tags question: http://stackoverflow.com/q/22830958
tags question: http://stackoverflow.com/q/22823740
tags question: http://stackoverflow.com/q/22945548
tags question: http://stackoverflow.com/q/22832324
tags question: http://stackoverflow.com/q/22889561
tags question: http://stackoverflow.com/q/22938738
tags question: http://stackoverflow.com/q/22840689
tag name: bufferedreader
tags question: http://stackoverflow.com/q/22846081
tags question: http://stackoverflow.com/q/22812381
type: Tag
tags question: http://stackoverflow.com/q/22916636
tags question: http://stackoverflow.com/q/22826254

http://stackoverflow.com/q/22841375
tagged with: c++
has answer: http://stackoverflow.com/a/22843948
has comment: http://stackoverflow.com/comment/34841718
has answer: http://stackoverflow.com/a/22841563
has answer: http://stackoverflow.com/a/22841488
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22841583
downvote count: 0
has comment: http://stackoverflow.com/comment/34841787
tagged with: java
tagged with: set
has title: Is adding to a set O(n)?
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/22841650
has comment: http://stackoverflow.com/comment/34841775
has answer: http://stackoverflow.com/a/22841521
accepted answer: http://stackoverflow.com/a/22841521
has answer: http://stackoverflow.com/a/22841647
has comment: http://stackoverflow.com/comment/34841699
tagged with: data-structures
possible better answer: http://stackoverflow.com/a/22841650
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/53922768
has body: Since sets can only have unique values does this mean every time you add an element to a set it has to check whether it is equal to every element there and is hence O(n)? Since this would make them much slower than arrayLists if this is the case, is the only time you should ever actually use them is when making sure your elements are all unique or is there any other advantage of them?

http://stackoverflow.com/a/22941194
accepted answer of: http://stackoverflow.com/q/22940803
answers question: http://stackoverflow.com/q/22940803
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/45317309
type: Answer
has comment: http://stackoverflow.com/comment/45317415
downvote count: 0
has body: Only the org.eclipse.core.runtime.products extension supports the life cycle class, you can't define life cycles for plugins or fragments. If you want to define OSGi services you can do that with a Component Definition. OSGi services are automatically added to the IEclipseContext. You can also use a ContextFunction to lazily add to the context. see here You can also add to the context using an Addon
score: 1

http://stackoverflow.com/q/22877341
linked to: http://stackoverflow.com/q/19154607
has answer: http://stackoverflow.com/a/22878828
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22888358
upvote count: 1
favorite count: 0
has body: I have ~10 millions domain objects which has to stay for all application lifetime in memory but can be added or removed any time one by one. Main storage is HashMap&lt;Long, MyDO&gt; My processing can be done in basic foreach loops but i can optimize some of operations by creating indexes via mapping some object fields like HashMap&lt;String, ArrayList&lt;MyDO&gt;&gt; which will reduce iteration count for 30-100x but processing more like 2-5x in total So question is how much slower will be GC for ~10 millions long living objects if i have not one map i store them but 5 maps and thus creating like 5x times references to same objects? UPD In short: Is it feasable to use generic java collections with boxed keys for indexes in case there are ~10M object with ~1K objects added/removed per second?
type: UnansweredQuestion
tagged with: garbage-collection
has title: Will GC be much slower if i have mulitple references for each of millions of my business objects?
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/22962812
has body: Is there any way by which i can forward any parameters in the URL (query parameters) from my JAVA Client to CAS? Example: http://www.myclient.com?name=A&amp;age=23 Presently when my request is forwarded to CAS then the query parameters are dropped and CAS has no idea about the parameters. I want to send these parameters to CAS. Or say i want that the service url that CAS receives is the complete url including all the parameters it has. Kindly suggest.
has comment: http://stackoverflow.com/comment/35104284
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35103413
type: Question
has comment: http://stackoverflow.com/comment/35103955
has comment: http://stackoverflow.com/comment/35103579
upvote count: 1
answer count: 1
has title: Forwarding url parameter to CAS
tagged with: cas
favorite count: 0
has comment: http://stackoverflow.com/comment/38027878
has answer: http://stackoverflow.com/a/24796345
has comment: http://stackoverflow.com/comment/35061306
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/22813685
tagged with: spring
answer count: 1
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22821568
has title: Parse web page content, not source code
tagged with: parsing
type: Question
has body: I'm working on an android project where I collect data from a web stream and use it within the app. Another member is working on the web side of the project which pushes the data I'm using to a webpage for me to collect. The data is in JSON format and I've written a parser that parses the data as I need it. trouble is, when I connect to the URL that I'm want, I cannot get the JSON data from it. The user interface of the web page displays the JSON that I need, but its not in the source code. When I grab the web page all I get is the source code without the data here's the URL i'm connecting to: http://ec2-54-194-27-150.eu-west-1.compute.amazonaws.com:8080/eirwig-spring-mvc/tweeter-single here's a sample display of what I need: { "id": "451355222041182208", "text": "And @Andrewgobrien_ !", "user": "darraghosulliv4", "profileImageUrl": "http://pbs.twimg.com/profile_images/441638045100834816/8xZggJsT_normal.jpeg", "con": "Ireland", "lat": 51.86972925, "lng": -8.42925046, "countries": {"United Kingdom":2442,"Ireland":8401}, "tweetCount": 10843 } and here's the source code of the URL: Latest Tweet : Is there any way I can collect the data from the user side of the page instead of the source code side?

http://stackoverflow.com/comment/34831187
has text: Also make sure that you are pointing to the right JDK. `Window > Preferences > Java > Installed JREs`. Just ensure that it is pointing to the folder with 1.7 installed.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22835030
type: AnswerComment

http://stackoverflow.com/q/22906443
type: Question
tagged with: bitbucket-server
score: 0
tagged with: java
tagged with: git
has comment: http://stackoverflow.com/comment/34961008
has comment: http://stackoverflow.com/comment/48606801
has comment: http://stackoverflow.com/comment/34960793
has comment: http://stackoverflow.com/comment/48606969
has title: Java - Get git directory list
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34960429
linked to: http://stackoverflow.com/q/24963084
has comment: http://stackoverflow.com/comment/34959641
has body: We recently changed from svn to git. Now I have to change a zip-generator which needs a directory list. With svn it was very easy but what is the best way in java to get a list of directories in a specific path? I tried with the stash-api but didn't get an usable result. Thanks for helping. Edit: The structure on git looks like this. Now I need the directories 1.0.0 - 1.1.1 in java to work with. ├── project │ ├── database │ │ ├── scripts │ │ │ ├── 1.0.0 │ │ │ ├── 1.0.1 │ │ │ ├── 1.1.0 │ │ │ └── 1.1.1 Edit2: Old way File file = new File(this.source); File[] files = file.listFiles(); this.source = path to svn folder
has comment: http://stackoverflow.com/comment/34959821
answer count: 0
tagged with: directory
has comment: http://stackoverflow.com/comment/34960218

http://stackoverflow.com/a/22960581
upvote count: 1
downvote count: 1
type: Answer
has body: For code that use syncronized on that object - yes. For code, that don't use syncronized keyword for that object - no.
has comment: http://stackoverflow.com/comment/35061978
answers question: http://stackoverflow.com/q/22960524
has comment: http://stackoverflow.com/comment/35091532
score: 0

http://stackoverflow.com/q/22945344
type: UnansweredQuestion
has title: Best way to include a large array of constants in Java?
has comment: http://stackoverflow.com/comment/35029865
tagged with: java
type: Question
has body: I have a Java app that has an array of 2.6 million values which never change. What is the best way to initialize it? The obvious answer is to put it in code - i.e. something like: int[] BigArray = new int[] {1, 2, 3, &lt;...&gt;, 2599999, 2600000}; but I am under the impression that this violates some size limit. I have seen this post that mentions key/value pairs in Properties, but that doesn't seem particularly intuitive - I don't see why I need to have each array entry saved as a key (for the array index) and a value; I should be able to have just the values in order. The next best way appears to be having the data saved as a file, and then to load the file into the array (or use a List) on startup, with each value on its own line (yes, the line separators take up 2.6MB, but so would 2.6 million commas). Is this a time-intensive way of doing it?
has comment: http://stackoverflow.com/comment/35030766
has comment: http://stackoverflow.com/comment/35029862
linked to: http://stackoverflow.com/q/816142
has comment: http://stackoverflow.com/comment/35030621
has comment: http://stackoverflow.com/comment/35030082
has comment: http://stackoverflow.com/comment/35032433
score: 0
has comment: http://stackoverflow.com/comment/35030001
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/22946599
linked to: http://stackoverflow.com/q/2763422

http://stackoverflow.com/comment/35016308
score: 0
type: AnswerComment
type: Comment
has text: Overall, I have to exchange `Container pane = getContentPane(); pane.setLayout(new GridBagLayout());` with `JPanel myMapPanel = new Jpanel(); myMapPanel.setLayout(new GridBagLayout());` Add elements inside the loop to JPanel. And afterwards : `JScrollPane thePane = new JScrollPane(myMapPanel); pane.add(thePane, c);` Did I understand right?
comment on: http://stackoverflow.com/a/22937780

http://stackoverflow.com/a/22849562
answers question: http://stackoverflow.com/q/22844503
type: Answer
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22844503
has body: Let's make it an official answer shall we? Here is a phone number parser/validator put out by Google code.google.com/p/libphonenumber

http://stackoverflow.com/a/22822514
has body: Mockito matchers are static methods and calls to those methods, which stand in for arguments during calls to when and verify. Hamcrest matchers (archived version) (or Hamcrest-style matchers) are stateless, general-purpose object instances that implement Matcher<T> and expose a method matches(T) that returns true if the object matches the Matcher's criteria. They are intended to be free of side effects, and are generally used in assertions such as the one below. /* Mockito */ verify(foo).setPowerLevel(gt(9000)); /* Hamcrest */ assertThat(foo.getPowerLevel(), is(greaterThan(9000))); Mockito matchers exist, separate from Hamcrest-style matchers, so that descriptions of matching expressions fit directly into method invocations: Mockito matchers return T where Hamcrest matcher methods return Matcher objects (of type Matcher<T>). Mockito matchers are invoked through static methods such as eq, any, gt, and startsWith on org.mockito.Matchers and org.mockito.AdditionalMatchers. There are also adapters, which have changed across Mockito versions: For Mockito 1.x, Matchers featured some calls (such as intThat or argThat) are Mockito matchers that directly accept Hamcrest matchers as parameters. ArgumentMatcher<T> extended org.hamcrest.Matcher<T>, which was used in the internal Hamcrest representation and was a Hamcrest matcher base class instead of any sort of Mockito matcher. For Mockito 2.0+, Mockito no longer has a direct dependency on Hamcrest. Matchers calls phrased as intThat or argThat wrap ArgumentMatcher<T> objects that no longer implement org.hamcrest.Matcher<T> but are used in similar ways. Hamcrest adapters such as argThat and intThat are still available, but have moved to MockitoHamcrest instead. Regardless of whether the matchers are Hamcrest or simply Hamcrest-style, they can be adapted like so: /* Mockito matcher intThat adapting Hamcrest-style matcher is(greaterThan(...)) */ verify(foo).setPowerLevel(intThat(is(greaterThan(9000)))); In the above statement: fo…
has comment: http://stackoverflow.com/comment/135850181
type: Answer
has comment: http://stackoverflow.com/comment/135867737
upvote count: 268
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22822512
has comment: http://stackoverflow.com/comment/135504462
answers question: http://stackoverflow.com/q/22822512
has comment: http://stackoverflow.com/comment/135843866
has comment: http://stackoverflow.com/comment/48402714
score: 268
type: AcceptedAnswer

http://stackoverflow.com/comment/35052601
type: AnswerComment
comment on: http://stackoverflow.com/a/22911001
type: Comment
has text: I really mixed up array1.equals() and Arrays.equals(). In fact, Arrays.equals() returns true, what I did wrong is passing 3rd argument as 0 to bmp factory: BitmapFactory.decodeByteArray(bytes, 0, 0); instead should be: BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
score: 0

http://stackoverflow.com/comment/34821499
has text: Do u mean `SampleObject` could be any model class?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22829633

http://stackoverflow.com/q/22870094
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22874553
type: Question
tagged with: jakarta-ee
possible better answer: http://stackoverflow.com/a/54364284
answer count: 2
tagged with: glassfish
upvote count: 3
tagged with: rest
has comment: http://stackoverflow.com/comment/34901048
has title: How do I return a List<String> from Rest call
favorite count: 0
has answer: http://stackoverflow.com/a/54364284
has body: I'm trying to return a List in a few different media types. I'm hosting this on glassfish 4. @GET @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN}) public List<String> getSessions(){ return Arrays.asList("foo","bar"); } If I do a plain GET without specifying the type, I get a 500 internal server error. Specifying application/json also gives me a 500 internal server error. The server log shows absolutely no errors. If I do a GET with Accept: text/plain, I get the following: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=text/plain, type=class java.util.Arrays$ArrayList, genericType=java.util.List. I would have thought glassfish could figure out what to do with basic collection classes here. They silently fail when I try to parse them into json and apparently don't have a messagebodywriter to turn them into strings. Am I missing something obvious? Update I've added Jackson as a jaxrs json provider using the instructions here: https://github.com/FasterXML/jackson-jaxrs-providers Apparently with the current release, I do not need to specifically register JacksonFeature.class, nor am I able to, because there is no JacksonFeature class, just a JacksonFeatures interface. I added this dependency to my project: com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider 2.3.0 I am now able to return json if I do so through a Response object as follows: @GET @Produces(MediaType.APPLICATION_JSON) public Response getSessions(){ Response r = Response.ok(Arrays.asList("foo","bar")).build(); return r; } However, attempting to return List still fails with a 500 internal server error and no message to the server error log. I'm willing to use the Response method if this is the correct approach, but it seems like the other way should work.
accepted answer: http://stackoverflow.com/a/22874553
type: AnsweredQuestion
score: 3
downvote count: 0

http://stackoverflow.com/q/22870060
tagged with: java
has title: bing translate api not working
tagged with: eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34893621
answer count: 1
has answer: http://stackoverflow.com/a/24478701
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34894282
has body: My app crashes as soon as this activity starts. It doesn't crash on clicking the button. The code is as follows package com.example.testing; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import com.memetix.mst.language.Language; import com.memetix.mst.translate.Translate; public class TranslateActivity extends Activity implements OnClickListener { EditText etInput; EditText etOutput; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_translate); Translate.setClientId("hidden"); Translate.setClientSecret("hidden"); Button Trans = (Button)findViewById(R.id.translate); Trans.setOnClickListener(this); etInput = (EditText)findViewById(R.id.input); etOutput = (EditText)findViewById(R.id.output); } @Override public void onClick(View v) { //get the text entered String In =etInput.getText().toString(); //String Out; try { String Out = Translate.execute(In, Language.AUTO_DETECT, Language.FRENCH); etInput.setText(Out); etOutput.setText(Out); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } ClientId and Client Secret are string,so I placed them in between " "...Is that right.... Logcat is as follows: 04-04 14:05:45.250: D/dalvikvm(1002): GC_FOR_ALLOC freed 68K, 5% free 2888K/3040K, paused 242ms, total 263ms 04-04 14:05:45.260: I/dalvikvm-heap(1002): Grow heap (frag case) to 4.726MB for 1920016-byte allocation 04-04 14:05:45.360: D/dalvikvm(1002): GC_FOR_ALLOC freed 2K, 4% free 4760K/4916K, paused 91ms, total 91ms 04-04 14:05:47.860: E/MediaPlayer(1002): Should have subtitle controller already set 04-04 14:05:48.610: D/gralloc_goldfish(1002): Emulator without GPU emulation detected. 04-04 14:05:49.500: D/dalvikvm(1002): GC_FOR_ALLOC freed 12K, 2% free 4904K/4996K, paused 35ms, total 36ms 04-04 14:05:50.330: I/Choreographer(1002):…
has comment: http://stackoverflow.com/comment/34982004

http://stackoverflow.com/q/22834650
score: -1
type: Question
has comment: http://stackoverflow.com/comment/34829679
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22835520
favorite count: 0
tagged with: regex
has body: I need to parse a filter String containing something with "&gt;53" "&gt; 53" " &gt;53" " &gt;53 " "&gt;53.21" and extract the Double 53.21 EDIT Pattern p = Pattern.compile("s/^ *&gt; *\\([0-9][.0-9]*\\) *$/\\1/p"); Matcher m = p.matcher("filterValue"); if (m.find()) { myVal = Double.parseDouble(m.group(1)); } Riccardo -- In unix I did echo '&gt; 53.21 ' | sed -n 's/^ *&gt; *\([0-9][.0-9]*\) *$/\1/p'
has comment: http://stackoverflow.com/comment/34829786
has answer: http://stackoverflow.com/a/22835520
downvote count: 1
has comment: http://stackoverflow.com/comment/34829853
type: AnsweredQuestion
tagged with: java
has title: parse REGEXP in Java

http://stackoverflow.com/comment/34933512
has text: I think I need to play with this more to be truly convinced. As I said, your argument just hasn't 100% convinced me yet.
type: Comment
comment on: http://stackoverflow.com/a/22891640
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35069011
comment on: http://stackoverflow.com/q/22966098
has text: @abc "partitioning" refers to partitioning the array around the pivot. This is an operation typically pushed in a separate function that gets called recursively as TheodoreNorvell pointed out. You should not need to create new arrays as partition is usually implemented in place.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22893045
tagged with: bluetooth
has answer: http://stackoverflow.com/a/22919834
has comment: http://stackoverflow.com/comment/34935435
score: 0
has comment: http://stackoverflow.com/comment/34935424
has body: I have to connect RFID reader with my java project. I installed all necesary driver for this device and imported all necesary Libraries. I used Eclipse program to writing my java project. Am beginner with RFID readers. The below code doesn't work. Please help me. package com.caen.RFIDLibrary; import com.caen.RFIDLibrary.CAENRFIDException; import com.caen.RFIDLibrary.CAENRFIDLogicalSource; import com.caen.RFIDLibrary.CAENRFIDPort; import com.caen.RFIDLibrary.CAENRFIDReader; import com.caen.RFIDLibrary.CAENRFIDReaderInfo; import com.caen.RFIDLibrary.CAENRFIDTag; public class reader_com { public static void main (String[] args) throws CAENRFIDException{ CAENRFIDReader MyReader = new CAENRFIDReader(); //Create myObject CAENRFIDReaderInfo Info = MyReader.GetReaderInfo(); // Create Object for reader info String Model = Info.GetModel(); //Get info about model String SerialNumber=Info.GetSerialNumber(); // Get info about serialNumber String FWRelease = MyReader.GetFirmwareRelease(); // Get info about FW MyReader.Connect(CAENRFIDPort.CAENRFID_USB, "COM13"); // Open a connection CAENRFIDLogicalSource MySource = MyReader.GetSource("Source_0, Source_1"); // Choose Source 0--&gt;RFID tags 1--&gt;Barcode MySource.SetQ_EPC_C1G2(3); // set Q Value CAENRFIDTag[] MyTags = MySource.InventoryTag(); if (MyTags.length &gt; 0){ System.out.println(Model); System.out.println(SerialNumber); System.out.println(FWRelease); } MyReader.Disconnect(); } } And i get back this error: Exception in thread "main" java.lang.NullPointerException at com.caen.RFIDLibrary.CAENRFIDReader$IOBuffer.access$1800(CAENRFIDReader.java:228) at com.caen.RFIDLibrary.CAENRFIDReader$CAENRFIDOutPacket.AddHeader(CAENRFIDReader.java:2701) at com.caen.RFIDLibrary.CAENRFIDReader.GetReaderInfo(CAENRFIDReader.java:3183) at com.caen.RFIDLibrary.reader_com.main(reader_com.java:20)
has title: Connect R1240IB qID Wearable Bluetooth UHF RFID Barcode reader with Java programme through USB?
has comment: http://stackoverflow.com/comment/34935369
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21568729
tagged with: java
tagged with: usb
has comment: http://stackoverflow.com/comment/34935478
type: Question
answer count: 1
tagged with: rfid

http://stackoverflow.com/comment/34832956
score: 0
comment on: http://stackoverflow.com/q/22835983
type: Comment
type: QuestionComment
has text: possible duplicate of [Fixed decimal numbers with JAVA](http://stackoverflow.com/questions/4377209/fixed-decimal-numbers-with-java)

http://stackoverflow.com/comment/34910149
type: Comment
type: QuestionComment
has text: Unfortunately I don't have `AbstractPersonType` with methods. I have more then 10 `personTypes`. When I see code, I'm very frustrated.
comment on: http://stackoverflow.com/q/22878711
score: 0

http://stackoverflow.com/a/22831147
type: AcceptedAnswer
downvote count: 0
has body: The permissions.perm does not specify what the bundle may do. It specifies what the bundle wants to do: See http://www.javacodegeeks.com/2012/11/permissions-in-osgi.html So this file seems to be there to be able to fail fast if permissions are missing. You can even leave it out if this is not necessary for you. The real security settings have to be done on the framework. See this for felix: https://felix.apache.org/documentation/subprojects/apache-felix-framework-security.html
accepted answer of: http://stackoverflow.com/q/22830344
type: Answer
answers question: http://stackoverflow.com/q/22830344
score: 2
upvote count: 2

http://stackoverflow.com/q/22843080
has answer: http://stackoverflow.com/a/22843148
has title: How to display two tables side by side
tagged with: java
type: Question
has body: I am having a little bit of difficulty. How do I display two tables side by side? More specifically I need to display one table with two columns, miles and kilometers. The miles will count up by one while the equal number of kilometers are displayed (one mile is 1.609 kilometers). The table would stop at 10 miles. It would look something like this: mile kilometers 1 1.609 2 3.218 ... 10 16.090 The second table would start with 20 kilometers and go up by multiple of 5's to 65. It would look something like this: kilometer miles 20 12.430 25 15.538 ... 65 40.398
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/34844981
has answer: http://stackoverflow.com/a/22843201
has comment: http://stackoverflow.com/comment/34844791
type: UnansweredQuestion

http://stackoverflow.com/q/22854508
has answer: http://stackoverflow.com/a/22854577
has answer: http://stackoverflow.com/a/22854618
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22854653
tagged with: android
favorite count: 0
score: -1
has title: The application stopped unexpectedly please try again later-Force close
type: Question
has comment: http://stackoverflow.com/comment/34866847
answer count: 3
has comment: http://stackoverflow.com/comment/34865767
downvote count: 1
has comment: http://stackoverflow.com/comment/34866902
has body: Now just trying to create an android application to login using eclipse. But when i run the code getting the above mentioned error.Whil lookin at logcat it shows the error in line 36 but no idea for me to how to recover it, here is my code: package com.example.login; import java.util.ArrayList; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; 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; import android.app.Activity; public class MainActivity extends ActionBarActivity { EditText un,pw; TextView error; Button ok; /** Called when the activity is first created. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pw=(EditText)findViewById(R.id.et_pw); ok=(Button)findViewById(R.id.btn_login); error=(TextView)findViewById(R.id.tv_error); ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ArrayList&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;(); postParameters.add(new BasicNameValuePair("username", un.getText().toString())); postParameters.add(new BasicNameValuePair("password", pw.getText().toString())); String response = null; try { response = CustomHttpClient.executeHttpPost("&lt;target page url&gt;", postParameters); String res=response.toString(); res= res.replaceAll("\\s+",""); if(res.equals("1")) error.setText("Correct Username or Password"); else error.setText("Sorry!! Incorrect Username or Password"); } catch (Exception e) { un.setText(e.toString()); } } }); } } and …
tagged with: java

http://stackoverflow.com/a/22912575
has body: Try this out, see if it works for you. You can just grab the dialog class code. All you need to do is pass to it the parent frame, true for modality and seconds you want. You also may want to pretty it up. I'm just providing the functionality import java.awt.BorderLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.border.EmptyBorder; public class CountDownTimer { public CountDownTimer() { final JFrame frame = new JFrame(); JButton button = new JButton("Open Dilaog"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { new CountDownTimerDialog(frame, true, 5); } }); frame.add(button); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } private class CountDownTimerDialog extends JDialog { private int count; public CountDownTimerDialog(JFrame parent, boolean modal, int seconds) { super(parent, modal); count = seconds; final JLabel countLabel = new JLabel(String.valueOf(seconds), JLabel.CENTER); countLabel.setFont(new Font("impact", Font.PLAIN, 36)); JLabel message = new JLabel("Wait to Start Game"); message.setFont(new Font("verdana", Font.BOLD, 20)); JPanel wrapper = new JPanel(new BorderLayout()); wrapper.setBorder(new EmptyBorder(10, 10, 10, 10)); wrapper.add(countLabel); wrapper.add(message, BorderLayout.SOUTH); add(wrapper); Timer timer = new Timer(1000, new ActionListener(){ public void actionPerformed(ActionEvent e) { if (count == -1) { dispose(); } else { countLabel.setText(String.valueOf(count)); count--; } } }); timer.setInitialDelay(0); timer.start(); pack(); setLocationRelativeTo(parent); setVisible(true); } } public static void main(String[] args) { SwingUtilities.invokeLater(n…
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22911611
answers question: http://stackoverflow.com/q/22911611
type: Answer

http://stackoverflow.com/comment/34828616
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22830016
has text: look at this link http://www.vogella.com/tutorials/AndroidSQLite/article.html
score: 0

http://stackoverflow.com/comment/35047764
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22955427
has text: `==` is referential equality. `a == b` is true only if `a` and `b` are *the same reference*. It doesn't matter how big they are or what's in them.

http://stackoverflow.com/comment/34913953
type: QuestionComment
has text: Maybe because credentials were cached? You initially had the code then commented it out right?
score: 0
comment on: http://stackoverflow.com/q/22881112
type: Comment

http://stackoverflow.com/comment/34974592
type: Comment
comment on: http://stackoverflow.com/a/22914897
has text: Thanks, I'll try this solution and say if it worked. Just curious, why doesn't the setting-size-through-constructor work? It's supposed to, isn't it? Does it maybe depend on the layout manager?
type: AnswerComment
score: 0

cisco
type: Tag
tag name: cisco
tags question: http://stackoverflow.com/q/22855195

http://stackoverflow.com/comment/35143794
has text: As I said before, I'm not a JBoss expert, I commented to prompt you to add important information to your question that would allow someone with enough knowledge of debugging JBoss deployment errors to help you. All I can do is take wild guesses at what may be wrong, which isn't helpful for you.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22860114
type: Comment

http://stackoverflow.com/comment/35475995
comment on: http://stackoverflow.com/q/22876287
has text: It's the latest version @MarcoAcierno
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22947724
answer count: 1
tagged with: warbler
tagged with: ruby
type: AnsweredQuestion
tagged with: java
has body: I've been trying to get a JRuby script that is very simple in nature that requires Net::SSH to perform a task on a remote computer and exit. When I issue the command jruby testssh.rb, the program works flawlessly, however, when I use Warbler to compile it into a JAR, I receive errors about not being able to load Net::SSH. &gt; java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) &gt; pik use jruby-1.7.1 &gt; jruby -S warble jar C:/ruby/jruby-1.7.10/lib/ruby/gems/shared/gems/rawr-1.7.0/lib/zip/zip.rb:28: Use RbConfig instead of obsolete and deprecated Config. rm -f test-ssh.jar Creating test-ssh.jar &gt; java -jar test-ssh.jar LoadError: no such file to load -- net/ssh require at org/jruby/RubyKernel.java:1085 require at file:/C:/Users/User/AppData/Local/Temp/jruby4935218336857439685extract/jruby-stdlib-complete-1.7.11.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55 (root) at test-ssh.rb:7 load at org/jruby/RubyKernel.java:1101 (root) at file:/C:/Users/User/Dropbox/programming/ruby/jruby/net-ssh/test-ssh/test-ssh.jar!/META-INF/main.rb:1 require at org/jruby/RubyKernel.java:1085 (root) at file:/C:/Users/User/AppData/Local/Temp/jruby4935218336857439685extract/jruby-stdlib-complete-1.7.11.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1 require at file:/C:/Users/User/AppData/Local/Temp/jruby4935218336857439685extract/jruby-stdlib-complete-1.7.11.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55 error: org.jruby.embed.EvalFailedException: (LoadError) no such file to load -- net/ssh I then put the files into a gem, and added the spec.add_runtime_dependency = "net-ssh" to the gemspec, and: require 'net/ssh' gem "net-ssh" into the Gemfile. Then when I run jruby -S warble, I get a different error. I also noticed, Bundler, and Ruby didn't play well with the '-' in the name, so I had to…
type: Question
accepted answer: http://stackoverflow.com/a/22948374
has title: JRuby Warbler not creating usable executable JAR files
score: 0
tagged with: bundler
has answer: http://stackoverflow.com/a/22948374
tagged with: jruby

http://stackoverflow.com/comment/34927654
has text: I appreciate your help and effort and I have tested the suggestion and it works fine, but what I am doing here is that I am matching the headers and then storing the data under each header as a token and adding it to an array list, so should I be writing the result to another CSV file and progress?
comment on: http://stackoverflow.com/a/22888540
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34982258
comment on: http://stackoverflow.com/q/22919096
score: 1
type: QuestionComment
has text: if it's complete use [Code Review](http://codereview.stackexchange.com/) instead
type: Comment

http://stackoverflow.com/comment/34863044
has text: I have no idea what was wrong with it, i did everything you said, not to be ungrateful for all the work you put into this (it looks like alot) however someone else suggested using three dimensional arrays to do it so that is what i am going to try. Thanks again for all your help.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22852562

http://stackoverflow.com/q/22898979
has body: public Game() { gameState = OVERWORLD; objects = new ArrayList&lt;GameObject&gt;(); remove = new ArrayList&lt;GameObject&gt;(); battleObjects = new ArrayList&lt;GameObject&gt;(); battleRemove = new ArrayList&lt;GameObject&gt;(); player = new Player(Display.getWidth() / 2 - player.SIZE / 2, Display.getHeight() / 2 - player.SIZE / 2); objects.add(player); objects.add(new Circle(32, 32, player)); objects.add(new Imp(300, 100, player)); } public void update() { if (gameState == BATTLE) { for (GameObject i : battleObjects) { if (!i.isRemoved()) i.update(); else battleRemove.add(i); } } else { for (GameObject i : objects) { if (!i.isRemoved()) i.update(); else remove.add(i); } } } public void render() { if (gameState == BATTLE) { for (GameObject i : battleObjects) i.render(); } else { for (GameObject i : objects) i.render(); } } public static void createNewBattle(Player p, Monster m) { battleObjects.add(p); battleObjects.add(m); gameState = BATTLE; } I completely understand why its happening but I cannot for the life of me find a way to fix the problem... Can anyone help me??? I sat here for hours trying to find another way of doing this. I was think of just creating an array with the battle objects.
answer count: 1
has comment: http://stackoverflow.com/comment/34946831
linked to: http://stackoverflow.com/q/223918
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22899013
tagged with: java
tagged with: lwjgl
has title: java.util.ConcurrentModificationException Cant fix
type: Question
linked to: http://stackoverflow.com/q/11177348
has comment: http://stackoverflow.com/comment/34946756
linked to: http://stackoverflow.com/q/993025
tagged with: arraylist
score: 0

http://stackoverflow.com/comment/34875130
type: Comment
comment on: http://stackoverflow.com/a/22837724
score: 0
has text: I'm using this website since long time but signed up in this site yesterday. That's why I've not the right to upvote any answer right now. While click the button to upvote "Vote Up requires 15 reputation" this message is shown. What can I do to increase my reputation in this website?
type: AnswerComment

http://stackoverflow.com/a/22923856
answers question: http://stackoverflow.com/q/22923739
score: 2
upvote count: 2
has body: For your first question, try finding out how to replace " " which is a whitespace into "" which is nothing (there are also string functions for this in case you've seen this in your classes already) For your second question it might help to know that a string is an array of characters, again, in case you have seen string functions already you should probably look into the documentation you've gotten around that (or google it) I hope you don't mind me not giving you straight up answers, seeing as this is a homeworks assignment you should probably just find it yourself, I just thought i'd get you on the right track.
downvote count: 0
type: Answer

http://stackoverflow.com/q/22859890
accepted answer: http://stackoverflow.com/a/22912279
score: 0
tagged with: windows
tagged with: windows-server-2008
tagged with: excel
has answer: http://stackoverflow.com/a/22912279
has title: Run Excel from Windows service
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34959570
tagged with: windows-services
type: Question
linked to: http://stackoverflow.com/q/16815956
has comment: http://stackoverflow.com/comment/34875519
has comment: http://stackoverflow.com/comment/34897376
has body: I have a Java application installed as Windows Service using Apache Common Daemon (windows server 2008). I need to run excel.exe command within my application, so I set up my service in order to be capable of interacting with desktop (by checking the box in Logon tab on service's properties). In this way, when I call start() method of ProcessBuilder the popups shown here appear to me. Is there a way to avoid this? My intention is to run my java app as service and run multiple instances of excel.exe in parallel in order to process several .xlsm files simultaneously, but I do not want to interact in any way. I have already read this article about Session 0 Isolation, so I'm wondering if it is really possible to start many excel.exe (or any other "GUI command") from a Windows service on WinServer 2008? Thank you.
answer count: 1

http://stackoverflow.com/comment/34894281
comment on: http://stackoverflow.com/a/22864607
score: 0
type: AnswerComment
has text: I have updated my answer. Please have a look. If you need any sample then please let me know.
type: Comment

maps
tags question: http://stackoverflow.com/q/22891242
tag name: maps
tags question: http://stackoverflow.com/q/22873597
tags question: http://stackoverflow.com/q/22815971
type: Tag

http://stackoverflow.com/comment/35039438
has text: Wow looks really good. I'm going to try this now, sorry for the late reply been really busy with my other subjects in school (Physics to be exact lol, its a killer!). @JasonC
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22901024
type: AnswerComment

http://stackoverflow.com/comment/34973305
has text: Since you said the script works when using a web browser and java code is showing total "bytesRead" is zero, problem very likely is in the java code. What is the value of bufferSize?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22909163

http://stackoverflow.com/comment/34912615
type: Comment
has text: How do you expect this to work? Remove the dependency in the parent.
comment on: http://stackoverflow.com/q/22880414
score: 1
type: QuestionComment

http://stackoverflow.com/a/22884779
has comment: http://stackoverflow.com/comment/34950340
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34945744
has comment: http://stackoverflow.com/comment/34920983
has comment: http://stackoverflow.com/comment/34950271
type: AcceptedAnswer
has body: The condition on the inner loop should not just be itr2.hasNext(). You want the inner loop to iterate so long as itr2.hasNext() AND the next item is not the same as the current item of itr1. Once you find (within itr2) the current item of itr1, you want to stop iterating the inner loop, and go back for the next item in itr1. public static &lt;T&gt; boolean subSequence(ArrayList&lt;T&gt; s1, ArrayList&lt;T&gt; s2) { Iterator&lt;T&gt; itr1 = s1.iterator(); Iterator&lt;T&gt; itr2 = s2.iterator(); while (itr1.hasNext()) { T itemFrom1 = itr1.next(); T itemFrom2; do { if( ! itr2.hasNext()){ return false; } itemFrom2 = itr2.next(); } while( ! itemFrom1.equals(itemFrom2)); } return true; } Basically what's happening here is that while we're still iterating itr1, if we run out of elements in itr2, then we've still got things in itr1 left to match, so it's not a subsequence. But so long as we keep finding things in itr2, we keep going. Whenever we find something in itr2 that matches what we're looking for in itr1, then it's time to go to the next step in the outer loop.
has comment: http://stackoverflow.com/comment/34925168
downvote count: 0
answers question: http://stackoverflow.com/q/22884335
has comment: http://stackoverflow.com/comment/34920879
has comment: http://stackoverflow.com/comment/34922147
accepted answer of: http://stackoverflow.com/q/22884335
has comment: http://stackoverflow.com/comment/34945655
has comment: http://stackoverflow.com/comment/34923405
type: Answer

http://stackoverflow.com/comment/35011170
type: Comment
has text: This is what was required. :)
type: AnswerComment
comment on: http://stackoverflow.com/a/22842536
score: 0

http://stackoverflow.com/comment/34815049
comment on: http://stackoverflow.com/q/22825933
has text: @Pindo: No, that's the list's `remove`. You need the iterator's `remove`.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/58396056
comment on: http://stackoverflow.com/a/31547426
has text: It does not give privileges on the remote server. You should read the HTTPS authentication process where the certificate comes into the picture. The access to certification storage location may be accessible only using admin rights and thus the remote server could not validate the client. I hope it is clear now.
type: AnswerComment
score: 0
type: Comment

netbeans
tags question: http://stackoverflow.com/q/22905828
tags question: http://stackoverflow.com/q/22849693
tags question: http://stackoverflow.com/q/22903684
tags question: http://stackoverflow.com/q/22853205
tags question: http://stackoverflow.com/q/22880571
tags question: http://stackoverflow.com/q/22919220
tags question: http://stackoverflow.com/q/22825263
tags question: http://stackoverflow.com/q/22867156
tags question: http://stackoverflow.com/q/22815749
tags question: http://stackoverflow.com/q/22928631
tags question: http://stackoverflow.com/q/22927451
tags question: http://stackoverflow.com/q/22848610
tags question: http://stackoverflow.com/q/22944219
tags question: http://stackoverflow.com/q/22944588
tags question: http://stackoverflow.com/q/22871975
tags question: http://stackoverflow.com/q/22909545
tags question: http://stackoverflow.com/q/22822013
tags question: http://stackoverflow.com/q/22819991
type: Tag
tags question: http://stackoverflow.com/q/22910104
tags question: http://stackoverflow.com/q/22900464
tags question: http://stackoverflow.com/q/22877830
tags question: http://stackoverflow.com/q/22949618
tags question: http://stackoverflow.com/q/22954636
tags question: http://stackoverflow.com/q/22897145
tags question: http://stackoverflow.com/q/22936544
tags question: http://stackoverflow.com/q/22856998
tags question: http://stackoverflow.com/q/22837257
tags question: http://stackoverflow.com/q/22893125
tags question: http://stackoverflow.com/q/22900206
tags question: http://stackoverflow.com/q/22899539
tags question: http://stackoverflow.com/q/22864633
tags question: http://stackoverflow.com/q/22812113
tags question: http://stackoverflow.com/q/22868236
tags question: http://stackoverflow.com/q/22865857
tags question: http://stackoverflow.com/q/22887218
tags question: http://stackoverflow.com/q/22831671
tags question: http://stackoverflow.com/q/22957753
tags question: http://stackoverflow.com/q/22866426
tags question: http://stackoverflow.com/q/22943123
tags question: http://stackoverflow.com/q/22894430
tags question: http://stackoverflow.com/q/22941385
tags question: http://stackoverflow.com/q/22828881
tags question: http://stackoverflow.com/q/22895497
tags question: http://stackoverflow.com/q/22948158
tags question: http://stackoverflow.com/q/22891021
tags question: http://stackoverflow.com/q/22880095
tags question: http://stackoverflow.com/q/22894119
tag name: netbeans
tags question: http://stackoverflow.com/q/22941593
tags question: http://stackoverflow.com/q/22839163
tags question: http://stackoverflow.com/q/22897051
tags question: http://stackoverflow.com/q/22920343
tags question: http://stackoverflow.com/q/22866308
tags question: http://stackoverflow.com/q/22861740
tags question: http://stackoverflow.com/q/22929009
tags question: http://stackoverflow.com/q/22934140
tags question: http://stackoverflow.com/q/22905187
tags question: http://stackoverflow.com/q/22826038
tags question: http://stackoverflow.com/q/22897201

http://stackoverflow.com/a/23342288
score: 1
has comment: http://stackoverflow.com/comment/35780531
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22950640
has body: In your case a PreparementStatement is more appropriate: String insertURL = "INSERT INTO urls(urlID, url) VALUES (?, ?)"; PreparedStatement ps = dbConnection.prepareStatement(insertURL); for (Element link : links) { ps.setInt(1, NextURLID); ps.setInt(2, link.attr("abs:href")); ps.executeUpdate(); NextURLID++; } // ...
type: Answer

http://stackoverflow.com/comment/34860059
type: AnswerComment
comment on: http://stackoverflow.com/a/22851101
type: Comment
score: 0
has text: @user1145925 well, do you really need to embed that class to start with?

http://stackoverflow.com/q/22871321
has comment: http://stackoverflow.com/comment/34896078
tagged with: memory
linked to: http://stackoverflow.com/q/18977887
has answer: http://stackoverflow.com/a/22871471
answer count: 2
has answer: http://stackoverflow.com/a/22894113
has body: Is it possible under any circumstances for a leak in a Java application, for instance a Tomcat servlet app, to exceed the allocated memory and use additional system memory, or is the allocated heap for the JVM truly firewalled (so to speak) from the (rest of the) OS/Kernel memory? I am working in 2.6 Kernel Linux with Java 6 and 7, but this is more of a general question.
has comment: http://stackoverflow.com/comment/34896255
downvote count: 0
duplicate of: http://stackoverflow.com/q/18977887
tagged with: jvm
tagged with: memory-leaks
favorite count: 0
has title: Is it possible for a Java memory leak to use more memory than the heap + permgen?
upvote count: 3
type: UnansweredQuestion
type: Question
score: 3
tagged with: java

http://stackoverflow.com/comment/34892496
comment on: http://stackoverflow.com/a/22847505
has text: Yeah, `get` and `contains` behaving poorly was one potential symptom I was thinking of. The old implementation may also increase the size of the set when you add a duplicate because it doesn't know that it's already there...
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34986047
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22920786
has text: @MinecraftShamrock: If you're only interested in reading `packetLength` bytes, that's fine. If you want to read to the end of the stream, you need to keep reading until `read` returns -1.

http://stackoverflow.com/comment/34955986
score: 0
type: Comment
has text: YA sorry @FlorescentTicker it was my bad.. I was confuse asking question and got -ve fr the same also.. Accept applogies...
type: AnswerComment
comment on: http://stackoverflow.com/a/22903904

http://stackoverflow.com/a/22916534
answers question: http://stackoverflow.com/q/22906279
has body: The setters are more general than constructor arguments because they allow you to handle circular dependencies. If you don't have circular dependencies, I'd recommend staying with constructor arguments, exacly for the purpose of enforsing the dependencies. However, if at all possible, do not put any logic into constructor. As Brad said, it makes the application brittle. The entire Spring environment may not be available during constructor. Try to design in a way that allows the constructor to simply remember the references for later use in the real methids. Avoid init() method if you can.
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/q/22952405
has body: So far I have created a frame at adds my ControlPanel class, the class takes an int, and that int is used to fill an array with JButton objects which are the added to a Panel and displayed. However I am getting a Null Pointer error when I try to add JButtons to the array. I'm not sure why (since I thought null pointers were from when you try to reference something that isn't in the spot in the array?) Any help on this would be great appreciated. Error Message: Exception in thread "main" java.lang.NullPointerException at elevator.ControlPanel.&lt;init&gt;(ControlPanel.java:22) at elevator.Elevator_Simulator.main(Elevator_Simulator.java:27) Main Class import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.event.*; public class Elevator_Simulator extends JFrame { public static void main(String[] args) { JFrame frame = new JFrame ("Elevator Simulation"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new ControlPanel(8)); frame.pack(); frame.setVisible(true); } } Control Panel Class: import java.awt.Color; import java.awt.event.*; import javax.swing.*; public class ControlPanel extends JPanel implements ActionListener { public JButton[] floorButton; // an array of floor buttons. public int[] floorIn; // state of button. 0 == not click &gt;= 1 means clicked (how many times). public ControlPanel(int x) { JPanel floors = new JPanel(); for (int i = 0; i &lt; x; i++) { // interates through user input and creates that many JButtons. floorButton[i].add(new JButton("F" + Integer.toString(i))); // adds a button to button array. Sets text to F(floorNo). floors.add(floorButton[i]); // adds buttons to the floor panel. floorButton[i].addActionListener(this); // adds action listener to the buttons. } } public void actionPerformed(ActionEvent e) { for (int i = 0; i &lt; floorButton.length; i++) { if (e.getSource() == floorButton[i]) { // checks which button the event occured on. floorButton[i].setBackground(Color.red); //…
tagged with: jbutton
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22952438
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22952442
upvote count: 1
tagged with: swing
has title: Null Pointer with JButton Array
possible better answer: http://stackoverflow.com/a/22952462
type: Question
has answer: http://stackoverflow.com/a/22952438
tagged with: arrays
tagged with: nullpointerexception
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/22952462
favorite count: 0

http://stackoverflow.com/comment/35006078
type: QuestionComment
comment on: http://stackoverflow.com/q/22932082
has text: strings are objects? objects of type?
score: 0
type: Comment

http://stackoverflow.com/a/22950611
score: 6
has comment: http://stackoverflow.com/comment/35088474
has comment: http://stackoverflow.com/comment/35044463
downvote count: 0
has comment: http://stackoverflow.com/comment/35057225
answers question: http://stackoverflow.com/q/22950577
has body: That is simply illegal syntax. You can initialize your array outside of a method, but you cannot put other statements outside of a method, such as setting a specific value in the array. Consider adding that statement to your constructor instead.
type: Answer
upvote count: 6

http://stackoverflow.com/comment/34849072
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22844510
has text: Create an `ArrayList` object in your class using `ArrayList<JLabel> lbllist = new ArrayList<>();` then add `lbllist.add(label);` after `panel.add(label);` in your code and in the `actionPerformed` method do something like `for (JLabel label: lbllist) { label.setText("hello"); }` If it still doesn't work, please update your code after you've done this.
score: 0

http://stackoverflow.com/q/22910268
type: Question
has comment: http://stackoverflow.com/comment/34966152
tagged with: http://stackoverflow.com/tag/html
tagged with: maven
tagged with: war
tagged with: java
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34967551
has answer: http://stackoverflow.com/a/22994758
has comment: http://stackoverflow.com/comment/34968390
has title: Merge Java module dependencies resources into WAR using Maven
has body: I have a multiplatform project which has several language-specific profiles. The HTML-platform-specific module depends on an "assets-core" module and if "en" profile is enabled, an "assets-en" module resources should also be included into WAR. Assembling WAR works just fine with an exception that if "assets-core" module contains file with the same file name as "assets-en", it is not overwritten by the file from "assets-en" module. I tried to use maven-resource-plugin: ${basedir}/assets-en/src/main/resources **/* with org.apache.maven.plugins maven-resources-plugin 2.3 copy-prod-resources process-resources copy-resources true ${basedir}/target/classes ${basedir}/assets-ar/src/main/resources **/* and <maven.resources.overwrite>true</maven.resources.overwrite> enabled as other threads suggests, but nothing worked. maven-war-plugin overlays could also be the solution but I can't have resource module to be packaged with war because the same module is also included in Java project. Here are the relevant parts of my pom.xmls: asssets-core/pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.example example-parent 1.0 assets-core assets-en/pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.example example-parent 1.0 assets-en example-html/pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.example example-parent 1.0 example-html war com.example example-core ${project.version} com.example example-core ${project.version} sources com.example assets-core ${project.version} org.codehaus.mojo gwt-maven-plugin ${gwt.version} prepare-package compile org.apache.maven.plugins maven-war-plugin false en com.example assets-en ${project.version}
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34966661
accepted answer: http://stackoverflow.com/a/22994758

http://stackoverflow.com/q/22851637
tagged with: java
possible better answer: http://stackoverflow.com/a/24523011
has body: Please, someone help me, I'm desperate. I've been trying all night. The problem I have is this: Weird NoClassDef-s with Eclipse Jetty's Maven plugin Basically: I can't make recent versions of the Jetty plug-in to work properly in an integration test. Indeed, everything works fine until the Jetty's shutdown stage, when I'm told that org.eclipse.jetty.util.FutureCallback is missing. I've included the dependencies told in the link above. Initially they were ignored, then I've added them in project/build/extensions. Now I've several other ClassNotFoundExceptions and I can't fix that. This is what I have in my POM: <plugins> org.eclipse.jetty jetty-maven-plugin uk.ac.ebi.fg.myequivalents.test_flag true 10 true 10973 10974 KILL start-jetty pre-integration-test run 0 true stop-jetty post-integration-test stop And these are the extesions I've set up: org.eclipse.jetty jetty-util ${jetty.version} org.eclipse.jetty jetty-jsp ${jetty.version} org.eclipse.jetty jetty-io ${jetty.version} org.eclipse.jetty jetty-jaspi ${jetty.version} ${jetty.version} is defined in the parent and = 9.1.3.v20140225, but I've tried many, down to 7.x Moreover, Maven is 3.2.1, Java is 1.7.0_51, running on OS X 10.9.2 Thank you in advance for any help for this nasty issue.
has answer: http://stackoverflow.com/a/24523011
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/22856563
favorite count: 0
has title: NoClassDef-s with Eclipse Jetty's Maven plugin, again
has answer: http://stackoverflow.com/a/23102065
has comment: http://stackoverflow.com/comment/37982209
type: AnsweredQuestion
tagged with: jetty
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/22856563
type: Question
linked to: http://stackoverflow.com/q/19042425
score: 1

http://stackoverflow.com/comment/34965451
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22906592
has text: collage is not a method, it is a reference to an instance of the object of class fragment.

http://stackoverflow.com/comment/34987223
type: AnswerComment
type: Comment
has text: @SeaNick +1. I agree with you that for 2^N you get results much more dependant on the seed(because `next` is only called once in that case), and since we have very "close" seeds between instances close in time it makes results look much less random.
score: 1
comment on: http://stackoverflow.com/a/22919819

http://stackoverflow.com/a/22835650
answers question: http://stackoverflow.com/q/22835472
upvote count: 2
has body: You should use regular expression. Below is few lines of code that will be useful. String sPhoneNumber1 = "605-888-9999"; String sPhoneNumber2 = "605-888-9991"; //String sPhoneNumber3 = "605-8838-9993"; Pattern pattern = Pattern.compile("\\d{3}-\\d{3}-\\d{3}"); Matcher matcher = pattern.matcher(sPhoneNumber); if (matcher.matches()) { System.out.println("Phone Number Valid"); } else { System.out.println("Phone Number must be in the form XXX-XXXXXXX"); }
accepted answer of: http://stackoverflow.com/q/22835472
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/22959820
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35059412
has comment: http://stackoverflow.com/comment/35056342
accepted answer of: http://stackoverflow.com/q/22957898
type: Answer
answers question: http://stackoverflow.com/q/22957898
has body: Here is how I would do it... def searchString = "${params.author}%" def searchResults = Book.findAllByAuthorLike(searchString, params) // max, offset automatically handled def total = Book.countByAuthorLike(searchString) render (model:[searchResults: searchResults, total: total]) in your GSP, iterate over your searchResults with: &lt;g:each var="book" in="${searchResults}"&gt;... and after that include: &lt;g:paginate controller="displayBook" action="index" total="${total}"/&gt;
has comment: http://stackoverflow.com/comment/35056536
score: 4
upvote count: 4

http://stackoverflow.com/q/22823254
tagged with: eclipse
tagged with: blur
score: 0
has comment: http://stackoverflow.com/comment/34809875
answer count: 1
linked to: http://stackoverflow.com/q/19101908
has body: I'm wondering if that is possible to blur a bitmap or a drawable. Like the app muzei is doing.is it possible ? ive tried to use some image effects class ive found but they were helpless... thanks to the helpers
has comment: http://stackoverflow.com/comment/39386215
has comment: http://stackoverflow.com/comment/34810021
type: UnansweredQuestion
tagged with: android
has title: How to blur an image
has answer: http://stackoverflow.com/a/22823413
tagged with: java
linked to: http://stackoverflow.com/q/1589760
has comment: http://stackoverflow.com/comment/34810011
type: Question
has comment: http://stackoverflow.com/comment/34809916

http://stackoverflow.com/comment/35011889
comment on: http://stackoverflow.com/q/22935466
type: Comment
type: QuestionComment
has text: no, but how can i check for a real number?
score: 0

http://stackoverflow.com/comment/34836673
type: AnswerComment
score: 0
type: Comment
has text: to render this view I am using another method.
comment on: http://stackoverflow.com/a/22838345

http://stackoverflow.com/comment/34869330
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22855484
type: QuestionComment
has text: Ask only one question at a time.

http://stackoverflow.com/q/22852898
has body: I'm facing an issue with two different versions of Mule. We have an external system which runs on Mule 3.3 and we are on 3.4. When a message from external system is received we see following exception. However if a message is sent from Mule 3.4 and received by same version there is no issue. java.lang.NullPointerException at org.mule.session.DefaultMuleSession.getPropertyNamesAsSet(DefaultMuleSession.java:215) at org.mule.session.DefaultMuleSession.&lt;init&gt;(DefaultMuleSession.java:81) at org.mule.DefaultMuleEvent.copy(DefaultMuleEvent.java:951)
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34863393
downvote count: 0
accepted answer: http://stackoverflow.com/a/22864622
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22864622
has title: Mule message incompatibility issue between 3.3 to 3.4
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34883346
tagged with: mule

http://stackoverflow.com/a/22963050
downvote count: 0
answers question: http://stackoverflow.com/q/22962590
has body: Why is it related to the score: because you only start running the code when asteroids.bodies.size>11 - this presumably only happens after you've shot something up. In general it is not safe to remove items from a collection that are currently iterating over - without the declaration of asteroids.bodies it is difficult to see whether this is causing your problem. But something along the lines of: while (there are more bodies than I want) remove the first body in the list is generally used for this situation.
type: Answer
accepted answer of: http://stackoverflow.com/q/22962590
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/34885600
comment on: http://stackoverflow.com/q/22865670
score: 0
type: Comment
type: QuestionComment
has text: Is that query generated by the hibernate or is your own query ? You need not pass the id as it is auto generated.

http://stackoverflow.com/comment/34891684
type: QuestionComment
comment on: http://stackoverflow.com/q/22868978
score: 0
has text: Please include (a part of) your code and say specifically what goes wrong. Otherwise it's hard for us to help you.
type: Comment

http://stackoverflow.com/comment/34864946
has text: 1) Why code an applet? If it is due to spec. by teacher, please refer them to [Why CS teachers should stop teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). 2) Why AWT rather than Swing? See my answer on [Swing extras over AWT](http://stackoverflow.com/a/6255978/418556) for many good reasons to abandon using AWT components.
comment on: http://stackoverflow.com/q/22827609
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34875835
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22860386
has text: I'm new to Java and have never compiled this before, are there any instructions on how to compile this?

http://stackoverflow.com/a/29246031
score: 0
type: Answer
has body: It's as random as java.util.Random, in default impl. And it counts uppercase as different. Example return: BdODmKWjGtaKeFyYsNCbOPRzquNIIRMiEFPjqTSgbfMvMeZgNKihEdUdUXUniHUh So your math is: 1/2.18340106e14. If you need an unique ID in non-distributed system, you should perhaps opt for AtomicInteger, or some library for that purpose.
answers question: http://stackoverflow.com/q/22891866

bukkit
tags question: http://stackoverflow.com/q/22851321
tag name: bukkit
tags question: http://stackoverflow.com/q/22898826
tags question: http://stackoverflow.com/q/22888716
type: Tag
tags question: http://stackoverflow.com/q/22925743
tags question: http://stackoverflow.com/q/22898260
tags question: http://stackoverflow.com/q/22883739

http://stackoverflow.com/comment/34845556
comment on: http://stackoverflow.com/q/22843397
score: 0
type: Comment
type: QuestionComment
has text: NOTE: CopyOnWriteArrayList doesn't work for me since the insertions are on par with reads and thus copying on every write would be prohibitevly expensive

http://stackoverflow.com/q/22819287
possible better answer: http://stackoverflow.com/a/22819381
has comment: http://stackoverflow.com/comment/34802508
answer count: 2
has comment: http://stackoverflow.com/comment/34802538
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
favorite count: 0
has body: I am working on a project which generates a meaningful url, connects to it, and download its HTML source code. The program will further read the source and extracts useful info from it. Is this illegal?
has comment: http://stackoverflow.com/comment/34802521
has comment: http://stackoverflow.com/comment/34802677
has comment: http://stackoverflow.com/comment/34803056
has answer: http://stackoverflow.com/a/22819490
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22819381
upvote count: 2
accepted answer: http://stackoverflow.com/a/22819490
tagged with: java
has title: Download and read web source code, illegal?
type: Question

http://stackoverflow.com/a/22844124
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22843880
downvote count: 0
answers question: http://stackoverflow.com/q/22843880
has body: Hallway is a local variable inside main function. And main is a static function too. These variables declared inside main cannot be accesses from other functions. There are two alternatives, 1) Declare all the maps as static members of the objects and have static getHallway() static getToilet, etc. 2) I personally would suggest this, import java.util.Map; import java.util.HashMap; public class Items { private HashMap&lt;String, Double&gt; Hallway = new HashMap&lt;String, Double&gt;(); private HashMap&lt;String, Double&gt; Toilet = new HashMap&lt;String, Double&gt;(); ... public HashMap&lt;String, Double&gt; getHallwayItems() { return Hallway; } ... ... public static void main (String args[]) { Items myItem = new Items(); myItem.getHallwayItems(); // and do whatever you want. } } This way, we also exploit OOPS...
score: 1

http://stackoverflow.com/comment/35064185
type: QuestionComment
comment on: http://stackoverflow.com/q/22964732
has text: @MarounMaroun I believe the question is in fact "is it safe to use this code having in mind possible daylight saving switch".
score: 1
type: Comment

http://stackoverflow.com/q/22884342
type: UnansweredQuestion
has title: Server/ Client Socket Programming and mysql database
has comment: http://stackoverflow.com/comment/34921148
has answer: http://stackoverflow.com/a/22885152
tagged with: android
linked to: http://stackoverflow.com/q/541487
has comment: http://stackoverflow.com/comment/34921456
type: Question
tagged with: sockets
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34919902
tagged with: mysql
has body: I am working on client/server socket programming. Android Client and Java Server on my laptop. I want to send several images through socket from Android device to a Java server which saves each image in a MySQL database as blob. I close the client socket for each image transfer and reconnect again for the next image transfer. My first image transfer works fine and is saved in the MySQL database but when I try to reconnect socket to server and transfer a different image I get Connection reset. java.sql.SQLException: Error reading from InputStream java.net.SocketException at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1086) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920) at com.mysql.jdbc.PreparedStatement.readblock(PreparedStatement.java:3099) at com.mysql.jdbc.PreparedStatement.streamToBytes(PreparedStatement.java:5106) at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2575) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2366) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2350) at Uploadpic.run(Uploadpic.java:113) at java.lang.Thread.run(Unknown Source) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at com.mysql.jdbc.PreparedStatement.readblock(PreparedStatement.java:3097) ... 7 more public class Uploadpic extends Thread { private Socket socket1 =null; //public Client user = new Client(); public Uploadpic(Socket socket1) { this.socket1 = socket1; } public void run() { int imagenum = 0; String mes = null; BufferedReader buff; int imagesize = 0; InputStream is = null; try { buff = new BufferedReader(newInputStreamReader(socket1.getInputStream())); whi…

http://stackoverflow.com/comment/34928493
score: 0
type: QuestionComment
type: Comment
has text: i think its caesars cipher but my teacher did not say
comment on: http://stackoverflow.com/q/22889129

http://stackoverflow.com/comment/34907647
has text: Check probably load balancer can send those values in a header, so consider using getHeader method of HttpServletRequest.
type: Comment
comment on: http://stackoverflow.com/a/22877465
score: 1
type: AnswerComment

http://stackoverflow.com/q/22927706
has answer: http://stackoverflow.com/a/22932622
has comment: http://stackoverflow.com/comment/34998798
tagged with: class
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34998791
has title: Java error in my 2nd class
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34998811
has answer: http://stackoverflow.com/a/22927750
has body: I have 2 classes. 1 class sets &amp; gets a students' name, 3 test scores for a student &amp; an average for the 3 scores. The other class has a main method to set and get this information. I'm getting an error from my IDE for the 2nd class only. public class Student5th { /** Instance variables Each student object will have a name and three test scores */ private String name; //Student name private int test1; //Score on test 1 private int test2; //Score on test 2 private int test3; //Score on test 3 /** Set a student's name Preconditions -- nm is not empty Postconditions -- name has been set to name */ public void setName (String nm) { name = nm; } /** Get a student's name Preconditions -- none Postconditions -- returns the name */ public String getName () { return name; } /** Set the score on the indicated test Preconditions -- 1 &lt;= i &lt;= 3 -- 0 &lt;= score &lt;= 100 Postconditions -- test i has been set to score */ public void setScore (int i, int score) { if (i == 1) test1 = score; else if (i == 2) test2 = score; else test3 = score; } /** Get the score on the indicated test * Preconditions -- none * Postconditions -- returns the score on test I * */ public int getScore (int i) { if (i == 1) return test1; else if (i == 2) return test2; else return test3; } /** Compute and return a student's average * Preconditions -- none * Postconditions -- returns the average of the test scores * */ public int getAverage() { int average; average = (int) Math.round((test1 + test2 + test3) / 3.0); return average; } } My 2nd class with the main method... import java.util.*; public class TestStudent { public static void main (String[] args) { Scanner console = new Scanner(System.in); private Student **student1**; private Student **student2**; String s; int t; student1 = new Student(); student2 = new Student(); s = console.next(); student1.setName (s); t = console.nextInt(); student1.setScore (1, t); student1.setScore (2, console.nextInt()); student1.setScore (3, console.nextInt…
has comment: http://stackoverflow.com/comment/34998623
tagged with: java
type: Question

http://stackoverflow.com/q/22921226
type: Question
has answer: http://stackoverflow.com/a/22921556
downvote count: 0
tagged with: jar
favorite count: 0
has title: Trouble integrating ImageJ into Android App
has comment: http://stackoverflow.com/comment/34989826
tagged with: android
answer count: 1
linked to: http://stackoverflow.com/q/6593592
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: imagej
accepted answer: http://stackoverflow.com/a/22921556
tagged with: java
has body: I am creating an Android app that can filter photos. To perform the image processing necessary for these filters, I use ImageJ's API. The user selects the filters to apply to a photo collection in a dialog box. Upon pressing "OK," however, the app crashes, and the following output appears in LogCat (I'm using Eclipse): 04-07 15:09:24.094: E/AndroidRuntime(14901): FATAL EXCEPTION: main 04-07 15:09:24.094: E/AndroidRuntime(14901): Process: edu.wpi.khufnagle.lighthousenavigator, PID: 14901 04-07 15:09:24.094: E/AndroidRuntime(14901): java.lang.NoClassDefFoundError: ij.io.Opener 04-07 15:09:24.094: E/AndroidRuntime(14901): at edu.wpi.khufnagle.lighthousenavigator.filter.ImageManipulator.validateOriginalImage(ImageManipulator.java:38) 04-07 15:09:24.094: E/AndroidRuntime(14901): at edu.wpi.khufnagle.lighthousenavigator.filter.LighthousePresenceFilter.&lt;init&gt;(LighthousePresenceFilter.java:120) 04-07 15:09:24.094: E/AndroidRuntime(14901): at edu.wpi.khufnagle.lighthousenavigator.filter.PhotographFilter.filterPhotos(PhotographFilter.java:137) 04-07 15:09:24.094: E/AndroidRuntime(14901): at edu.wpi.khufnagle.lighthousenavigator.PhotographsActivity$5.onClick(PhotographsActivity.java:623) 04-07 15:09:24.094: E/AndroidRuntime(14901): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166) 04-07 15:09:24.094: E/AndroidRuntime(14901): at android.os.Handler.dispatchMessage(Handler.java:102) As you might guess, the line in question within the validateOriginalImage() method creates a new Opener object from ImageJ (used for opening the image as an ImagePlus object on the following line for later processing). This exception occurs when I add the "ij.jar" to my app's build path as an external JAR file (on the "Libraries" tab of Eclipse's "Configure Build Path" dialog) or when I include the entire ImageJ source code as a separate Java project in my workspace on the app's build path (on the "Projects" tab). I am using version 1.48 of the "ij…
has comment: http://stackoverflow.com/comment/35066229
tagged with: eclipse

http://stackoverflow.com/a/22949999
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22949507
has body: Basically, if(session != null){ means nothing here. You should read an attribute from the session and check it for null: String username = (String)session.getAttribute("username"); if(username!=null) { //user is logged in } else { //user is not logged in }
downvote count: 0
answers question: http://stackoverflow.com/q/22949507
score: 1

http://stackoverflow.com/comment/35008010
comment on: http://stackoverflow.com/a/22860955
type: Comment
score: 0
has text: In that case you will have an abstract class which implements the default method and in your API design, you require subclasses of this abstract class instead of the interface.
type: AnswerComment

http://stackoverflow.com/a/22943165
answers question: http://stackoverflow.com/q/22943122
accepted answer of: http://stackoverflow.com/q/22943122
upvote count: 2
has body: I defined a public volatile LinkedList to be shared with some threads, and I synchronize it within main() which is static... so I get a compile error : " cannot make a reference to a non static field" It's not related to volatile or synchronization, it's because you are accessing instance variable samplings in static main() method. If I modify the definition to be public volatile static LinkedList, then I get an exception : Exception in thread "filteringThread" java.lang.NullPointerException at com.swimtechtest.swimmerbench.FilteringThread.run(FilteringThread.java:39) This is because, your instance variable samplings in FilteringThread is never assigned to an object of type List. It's assigned by default null
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/22818973
answer count: 1
has answer: http://stackoverflow.com/a/22872853
downvote count: 0
has title: What is the difference between Gson.fromJson which takes class as parameter and the one that takes Type as parameter?
has body: I was trying to parse a Json object with a structure as follows: { "something@email.com": { "data1": { "fullName": "Mr X Y", "givenName": "X" }, "data2": { "age": "70", "gender": "Male" }, "data3": [ { "typeId": "xyz", "url": "xyz.com" } ], "status": 200, }, "anotherThing@email.com": { "data1": { "fullName": "Mr A B", "givenName": "A" }, "data2": { "age": "20", "gender": "Male" }, "data3": [ { "typeId": "abc", "url": "abc.com" } ], "status": 200, } } I created a bean TempBean with a field Map&lt;String, Person&gt;, with Person as another bean appropriately defined to accept the Json. I tried: Gson.fromJson(data, TempBean.class) but couldn't parse. Also tried Map.class and accepted a Map&lt;String, Person&gt;, but couldn't parse. However, when I used: Type dataType = new TypeToken&lt;Map&lt;String, Person&gt;&gt;() {}.getType(); and then, Map&lt;String, Person&gt; tempMap = Gson.fromJson(data, dataType); I could parse it..! I wish to know what was the difference it the two approaches and what more should I know to be clear about all of this.
favorite count: 0
has comment: http://stackoverflow.com/comment/34801914
has comment: http://stackoverflow.com/comment/34802320
accepted answer: http://stackoverflow.com/a/22872853
has comment: http://stackoverflow.com/comment/34802024
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question

http://stackoverflow.com/q/22832733
has title: how to return an array and its length in java
has answer: http://stackoverflow.com/a/22833266
tagged with: java
upvote count: 1
tagged with: methods
has body: i want to return a array and its length from a method in java, where the array is of type double and length is type integer,plz help suppose this example-: double ar={2.3,4.5,6.7}; int len=ar.length(); now i am supposed to return both the array "ar" and the variable "len". i tried this code can someone tell me the modification i need to do in the class so as to be able to return the required elements-: import java.util.List; public class Pair { private List&lt;Double&gt; array1; private List&lt;Double&gt; array2; public Pair(List&lt;Double&gt; array1, List&lt;Double&gt; array2) { this.array1 = array1; this.array2 = array2; } public List&lt;Double&gt; getArray1() { return array1; } public List&lt;Double&gt; getArray2() { return array2; } }
has comment: http://stackoverflow.com/comment/34826596
accepted answer: http://stackoverflow.com/a/22833027
tagged with: arrays
has answer: http://stackoverflow.com/a/22833007
answer count: 5
has comment: http://stackoverflow.com/comment/34826828
has comment: http://stackoverflow.com/comment/34826717
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22832928
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34826557
favorite count: 0
possible better answer: http://stackoverflow.com/a/22832939
has comment: http://stackoverflow.com/comment/34826482
type: Question
has answer: http://stackoverflow.com/a/22832939
has answer: http://stackoverflow.com/a/22833027
has comment: http://stackoverflow.com/comment/34826911

http://stackoverflow.com/a/22820480
has body: GUI applications doesn't have a "console". Why don't you try instead adding the jar as a reference to your GUI project and call the right function programatically?
accepted answer of: http://stackoverflow.com/q/22820394
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34805043
type: Answer
answers question: http://stackoverflow.com/q/22820394
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34809438

http://stackoverflow.com/a/24681064
downvote count: 0
score: 30
type: Answer
answers question: http://stackoverflow.com/q/22911030
upvote count: 30
has comment: http://stackoverflow.com/comment/44768812
has body: Don't forget Collection.removeIf. You can compute min and max, and then do: list.removeIf(x -&gt; x == min || x == max); (This also deals well with duplicates.)

http://stackoverflow.com/comment/34984587
comment on: http://stackoverflow.com/q/22920058
has text: You're right to observe that this is a bit "irregular". They do a bit of a tap-dance to explain it, but mainly it relates to the very early days of Java when it was only going to be used on set-top boxes. Some things got started off odd and they never straightened them up.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22896709
has body: I was hoping that someone on here would be able to explain or point me to a webpage where I could learn more about Matlab's memory management. I know that Matlab is a higher level language so it takes care of memory management, which is good and bad. Good cause I don't need to worry about it and bad cause I have no idea what it is doing under the hood. The reason I ask is lately I've been getting this error message a lot. Insufficient Java heap memory to continue operation Granted I'm using a mid 2010 15" Macbook pro, with only 4 GB of RAM, not really the best computer to be perform all the image operations that I do. I know Matlab has a delete function, and I didn't know when/if it would be helpful to use this function to save memory? I have used the delete function before only in hardware related tasks when I am sending data through serial I delete my serial object. But beyond that should I be using delete for my own memory management?
downvote count: 0
has title: Matlab memory management; insufficient java heap
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5790318
tagged with: matlab
tagged with: memory-management
has answer: http://stackoverflow.com/a/22897537
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/15066495
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/42219222
answer count: 2

http://stackoverflow.com/q/22923586
tagged with: cryptography
has comment: http://stackoverflow.com/comment/34991266
has comment: http://stackoverflow.com/comment/34991390
has comment: http://stackoverflow.com/comment/34991247
type: Question
tagged with: encryption
answer count: 1
has comment: http://stackoverflow.com/comment/34991356
tagged with: des
accepted answer: http://stackoverflow.com/a/22923654
score: 0
tagged with: java
has title: error on Decryption: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
has body: Here it is program for encryption and Decryption using DES. program is working when passing the output of encryption directly for decryption. but when taking input from user in string to decrypt, it showing this exception. how to pass cipher string in bytes so it becomes compatible for decryption? import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.SecretKeyFactory; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.crypto.spec.DESKeySpec; import javax.xml.bind.DatatypeConverter; public class DESEncryptionDecryption { private static Cipher encryptCipher; private static Cipher decryptCipher; public static void main(String[] args) throws InvalidKeySpecException { try { String desKey = "0123456789abcdef"; // value from user byte[] keyBytes = DatatypeConverter.parseHexBinary(desKey); System.out.println(keyBytes); SecretKeyFactory factory = SecretKeyFactory.getInstance("DES"); SecretKey key = factory.generateSecret(new DESKeySpec(keyBytes)); encryptCipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); encryptCipher.init(Cipher.ENCRYPT_MODE, key); byte[] encryptedData = encryptData("Confidential data"); //String from user String s=encryptedData.toString();//String input to decrypt From user byte[] bb=s.getBytes(); decryptCipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); decryptCipher.init(Cipher.DECRYPT_MODE, key); decryptData(bb); //Exception }catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchPaddingException e) { e.printStackTrace(); } catch (InvalidKeyException e) { e.printStackTrace(); } catch (IllegalBlockSizeException e) { e.printStackTrace(); } catch (BadPaddingException e) { e.printStackTrace(); }} //method for encryption private static byte[] encryptData(String data) throws IllegalB…
tagged with: byte
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22923654

http://stackoverflow.com/q/22832849
tagged with: grammar
downvote count: 0
favorite count: 0
tagged with: parsing
has answer: http://stackoverflow.com/a/22833774
has body: I need to parse Clojure code (not really long) inside Java and build a tree with tokens. is there a possibility to use standard Clojure lib for that? What is the easiest way to display these data visually?
type: UnansweredQuestion
tagged with: clojure
score: 2
upvote count: 2
tagged with: java
has title: How to use Java to parse Clojure grammar and visualize it
type: Question
has answer: http://stackoverflow.com/a/22842586
answer count: 2
tagged with: visualization

http://stackoverflow.com/comment/34792923
has text: I believe your problem has something to do with the use of `next()` method.
comment on: http://stackoverflow.com/q/22814055
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34939371
has text: So this problem is at hardware level ?
score: 0
comment on: http://stackoverflow.com/q/22894748
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35048224
type: Comment
comment on: http://stackoverflow.com/a/22903403
has text: I have the problem that I can not answer otherwise because I do not know what 'start on solid basis', 'solid basis', what to 'rewrite', 'interpret bytes fine' means. That "The way I see it, having a bunch of 'waste' would do no good." Is twice opinionbased and not measurable. If you could go into detail with this and rework your question, you will have a chance of a new answer. Examples would be good, too. Which bytes are sent between the two processes in which usecase? This makes it easier to understand your goal.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22930621
type: Question
type: AnsweredQuestion
tagged with: list
tagged with: java
accepted answer: http://stackoverflow.com/a/22930835
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/22930835
favorite count: 0
has body: I have to display two lists, where li lists the old values and newli lists the new values. Based on this requirement, How do I insert unique values in mysql using java? List&lt;String&gt; li =new ArrayList&lt;String&gt;(); li.add("abcd"); li.add("efgh"); li.add("ijkl"); List&lt;String&gt; newli=new ArrayList&lt;String&gt;(); newli.add("mnop"); newli.add("qrst"); newli.add("uvwx"); newli.add("yz"); newli.add("abcd"); Iterator it = newli.iterator(); while(it.hasNext()){ String str=(String) it.next(); if(str.equals(li)) { System.out.println("This element Already present"); break; } else System.out.println(str); } System.out.println("Already present"); }
score: 2
downvote count: 0
has title: How do I insert Unique values in MySQL using using Java

http://stackoverflow.com/comment/35069281
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22967497
has text: couldn't get your question? like `next view` ?? `from child1 it is file of source code`?? `from parent it is just file where I cannot navigate over classes.`??

http://stackoverflow.com/q/22814573
tagged with: java
has title: How to add custom repository to maven-jaxb2-plugin
type: Question
possible better answer: http://stackoverflow.com/a/22874175
has answer: http://stackoverflow.com/a/22874175
has comment: http://stackoverflow.com/comment/34794920
accepted answer: http://stackoverflow.com/a/22815485
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/22815485
favorite count: 0
tagged with: xjc
tagged with: maven-jaxb2-plugin
tagged with: elasticsearch
tagged with: maven
has body: I'm using a maven-jaxb2-plugin (org.jvnet.jaxb2.maven2) to generate resources and xjb bindings to add annotations to generated beans. Those annotations have to be included into plugin's classpath so I'm using dependencies section. If some of those dependencies missing in maven central build fails. How can I add repositories to look for into the plugin? E.g. this artifact can't be found in maven central org.springframework.data spring-data-elasticsearch 1.0.0.M2 But can be found in another repository: spring-libs-milestone Spring Milestone Repository http://repo.spring.io/libs-milestone Plugin config: org.jvnet.jaxb2.maven2 maven-jaxb2-plugin 0.8.3 org.springframework.data spring-data-mongodb ${spring.data.mongodb.version} org.springframework.data spring-data-elasticsearch 1.0.0.M2 generate true true true true src/main/resources src/main/resources true -Xannotate org.jvnet.jaxb2_commons jaxb2-basics-annotate 0.6.3 org.jvnet.jaxb2_commons jaxb2-basics 0.6.3 Build example: http://azee.people.yandex.net/job/elastic-template/6/console Source code: https://github.com/azee/elastic-template/tree/nodeps
type: AnsweredQuestion
score: 2
downvote count: 0

http://stackoverflow.com/comment/34841205
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22840122
type: QuestionComment
has text: That's a pretty common scenario, your create a REST api and your apps invoke the methods of your API. If you don't need a very interactive APP you could use a different development environment that allows you to only develop one app and export to all platforms.

http://stackoverflow.com/comment/34868406
comment on: http://stackoverflow.com/a/22855762
score: 0
type: AnswerComment
type: Comment
has text: Thanks! The first reason gives me a very clear difference between the two.

http://stackoverflow.com/comment/34835522
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22829640
has text: Videojet is a regular nt:folder. Can I create nt:unstructured under this??

http://stackoverflow.com/comment/35025945
score: 0
has text: `samplings` must be null in your thread. Where do you set it?
type: QuestionComment
comment on: http://stackoverflow.com/q/22943122
type: Comment

http://stackoverflow.com/comment/35008429
type: Comment
comment on: http://stackoverflow.com/a/22932852
score: 0
has text: @StephenC *12 bytes of object header overhead*, 16 bytes due to memory alignment.
type: AnswerComment

http://stackoverflow.com/q/22959427
answer count: 1
has comment: http://stackoverflow.com/comment/35054438
favorite count: 0
tagged with: method-reference
type: UnansweredQuestion
score: 6
tagged with: java-8
upvote count: 6
has comment: http://stackoverflow.com/comment/35054648
tagged with: java
has answer: http://stackoverflow.com/a/22959629
type: Question
has title: Is there a method reference available for throwing an exception?
downvote count: 0
has body: Suppose I have the following code: Runnable exceptionHandler = () -&gt; throw new RuntimeException(); Is there a way to write it more concise, available now, or maybe available in future Java releases? I'd expect something along the lines of: Runnable exceptionHandler = RuntimeException::throw; For extra information, I intend to use this code for a method in which exceptional situations can occur, but not always need there be a RuntimeException thrown. I want to give callers the freedom to do whatever they want at the point the exceptional situation occurs. As it seems to me, this is not possible with Java 8, has this been discussed and is there any reason this is not possible?
tagged with: exception
has comment: http://stackoverflow.com/comment/35054741

http://stackoverflow.com/comment/34825080
has text: i need to access child table values from parent table like `a.leaverecords.leaveFrom` not `b.leaveFrom`
comment on: http://stackoverflow.com/a/22831742
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34820875
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22829493
score: 1
has text: @helb it's oneline-quiz

http://stackoverflow.com/comment/35061342
type: AnswerComment
type: Comment
has text: ok. i fix my "not constructor" to "real consctructor"! but But I got stuck when I wanted to add thecreate a Runnable to call my LockOrUnlockButtons method. I want to call her for an event of closing AddCstmrForm, Could you please guide me more what should I write?
comment on: http://stackoverflow.com/a/22962916
score: 0

http://stackoverflow.com/q/22836861
has comment: http://stackoverflow.com/comment/34833503
type: Question
has title: How to break string using regex pattern in java?
linked to: http://stackoverflow.com/q/3481828
has body: Hi i am having astring which i want to break as my desired string my orignal string is s=1 Agra Achhnera NIL 2 Agra Agra NIL 3 Agra Fatehabad NIL 4 Agra Fatehpur Sikri NIL 5 Agra Jagner NIL 6 Agra Jarar NIL 7 Agra Khairagarh NIL 8 Agra Shamshabad NIL 9 Aligarh Atrauli NIL 10 Aligarh Chharra NIL 11 Aligarh Aligarh 1300.00 12 Aligarh Khair 1300.00 13 Allahabad Allahabad NIL 14 Allahabad Jasra NIL 15 Allahabad Leriyari NIL 16 Allahabad Sirsa NIL 17 Ambedkar Nagar Akbarpur NIL 18 Ambedkar Nagar Tanda Akbarpur NIL my desired string is 1 Agra Achhnera NIL 2 Agra Agra NIL 3 Agra Fatehabad NIL 4 Agra Fatehpur Sikri NIL 5 Agra Jagner NIL 6 Agra Jarar NIL 7 Agra Khairagarh NIL 8 Agra Shamshabad NIL 9 Aligarh Aligarh NIL 10 Aligarh Atrauli NIL 11 Aligarh Chharra 1300.00 12 Aligarh Khair 1300.00 13 Allahabad Allahabad NIL 14 Allahabad Jasra NIL 15 Allahabad Leriyari NIL 16 Allahabad Sirsa NIL 17 Ambedkar Nagar Akbarpur NIL 18 Ambedkar Nagar Tanda Akbarpur NIL How can i achieve my desired string from my orignal string
has comment: http://stackoverflow.com/comment/34833483
answer count: 3
has comment: http://stackoverflow.com/comment/34833592
upvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/22835509
type: UnansweredQuestion
downvote count: 8
score: -8
has answer: http://stackoverflow.com/a/22837004
tagged with: regex
has comment: http://stackoverflow.com/comment/34833470
duplicate of: http://stackoverflow.com/q/22835509
has answer: http://stackoverflow.com/a/22836992
has answer: http://stackoverflow.com/a/22837072
has comment: http://stackoverflow.com/comment/34833528
tagged with: java
duplicate of: http://stackoverflow.com/q/22831176
has comment: http://stackoverflow.com/comment/34833491

http://stackoverflow.com/a/22827841
has comment: http://stackoverflow.com/comment/34817672
has comment: http://stackoverflow.com/comment/34817727
has comment: http://stackoverflow.com/comment/34817631
type: Answer
has body: You should add mensa = new String[jsonarray.length()] before the for loop.
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/34817717
answers question: http://stackoverflow.com/q/22827819
has comment: http://stackoverflow.com/comment/34817605
score: 4

http://stackoverflow.com/a/22951972
score: 0
answers question: http://stackoverflow.com/q/22951702
type: Answer
has body: You cannot use a switch statement to compare class type of an object. You would have to live with if-else statements.

http://stackoverflow.com/comment/34796665
type: Comment
has text: i have try to inset mRotateView.addView(mapView); setContentView(mRotateView); in my button, but it crash
comment on: http://stackoverflow.com/q/22815971
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34941714
type: Comment
comment on: http://stackoverflow.com/a/22840391
has text: okay now i now what i do wrong. The `CLASSPATH` variable had the value `"."` not `.` problem fixed.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34882961
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22855195
has text: @tom I tried this piece of code to run the VPN connectivity command. But I am facing issues here. I get an IO exception at the line where I am trying to expect a "Password" prompt and send() the "pwd" value. Also, APIs of both Forticlient and Cisco seem to be available in their dll(vpnapi.dll for Cisco and fccomintdll.dll for Forticlient). So I am left with two ways as of now. One, is to get the reference of these dll files and access the available methods. Second, to execute commands as I had done in my above code. If there are other options too, then please suggest.
score: 0

http://stackoverflow.com/q/22811908
accepted answer: http://stackoverflow.com/a/22825754
tagged with: java
has title: ReloadableResourceBundleMessageSource.fallbackToSystemLocale doesn't working
type: Question
has body: I'm working in an application with i18n and this application works nice in my development environment(Windows) but, when I try deploy in Linux everything seems ok, until I do a request and receive the message No message found under code 'message.header.inicio' for locale 'pt_BR'. I had two files messages_pt_BR.properties messages_en.properties After much research I changed messages_pt_BR.properties to messages.properties and set fallbackToSystemLocale to false but I continue receiving the same error. Someone can help me ? Follow my dispatcher-servlet.xml &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:webflow="http://www.springframework.org/schema/webflow-config" xsi:schemaLocation=" http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd"&gt; &lt;context:property-placeholder system-properties-mode="OVERRIDE" /&gt; &lt;context:component-scan base-package="br.com.company" /&gt; &lt;!-- i18n retirado de http://www.mkyong.com/spring-mvc/spring-mvc-internationalization-example/ --&gt; &lt;bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"/&gt; &lt;mvc:interceptors&gt; &lt;bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt; &lt;property name="paramName" value="language"…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22825754
score: 0
answer count: 1
tagged with: linux
tagged with: spring
tagged with: internationalization
tagged with: spring-mvc

http://stackoverflow.com/a/22867023
type: Answer
has body: I think what you want is something like this. Note I'm using stringbuilder which is better than many string con-cats. I'm making a lot of assumption from your code... but you are probally trying to do something like this. public String print(){ StringBuilder result = new StringBuilder(); result.append("--------------------\n"); result.append("List elements: "); IntNode temp = front; while (temp != null) { result.append(temp.val); result.append(" "); temp = temp.next; } result.append("\n-----------------------\n"); return result.toString() } public String toString() { return print(); }
answers question: http://stackoverflow.com/q/22866839
score: 0

http://stackoverflow.com/comment/34978194
type: QuestionComment
comment on: http://stackoverflow.com/q/22908582
has text: The Visualization API does not expose any means of specifying the grouping symbol in the axis formatting; it is determined by the browser's locale. You can around the limitations in the format by specifying the `hAxis.ticks` option, which creates custom labels: `hAxis: {ticks: [{v: 1000, f: '1 000'}, {v: 2000, f: '2 000'}, {v: 3000, f: '3 000'} ...]}`.
score: 0
type: Comment

http://stackoverflow.com/comment/34972046
type: Comment
type: QuestionComment
score: 0
has text: @duffymo the output of find shows that there is a `com/blah/portserver/PortServer.class` in `~/portserver/`. So there is a `com` directory in `~/portserver/`.
comment on: http://stackoverflow.com/q/22911929

http://stackoverflow.com/a/62507470
upvote count: 0
answers question: http://stackoverflow.com/q/22832324
score: -3
type: Answer
has body: This could help Get Java Runtime Process running in background run a thread when reading the output of an external application
downvote count: 3
has comment: http://stackoverflow.com/comment/110543343

http://stackoverflow.com/comment/34945674
comment on: http://stackoverflow.com/a/22897465
has text: The problem here is that I am not a developer of that application so I cannot influence the way it is implemented. I only get the jar file and test its behaviour. I use my own security manager to prevent the application from terminating my test suite so when the quit button is clicked nothing really happens.
type: AnswerComment
score: 0
type: Comment

equals
tags question: http://stackoverflow.com/q/22935935
type: Tag
tags question: http://stackoverflow.com/q/22912150
tags question: http://stackoverflow.com/q/22867477
tags question: http://stackoverflow.com/q/22827652
tags question: http://stackoverflow.com/q/22931305
tags question: http://stackoverflow.com/q/22904511
tag name: equals

http://stackoverflow.com/comment/70379593
type: AnswerComment
score: 0
type: Comment
has text: Thank you for pointing out my oversight regarging the singleton. Fixed. However, I think you did not read my comment thoroughly. I had to use the same API for both the client and the server. That is, the interface must remain the same, the signature cannot change. (This is due to some architectural decisions we made.) The question's title explicitly targeted Resteasy. Otherwise, if you have an answer, you can post it.
comment on: http://stackoverflow.com/a/22907611

http://stackoverflow.com/q/22810829
has comment: http://stackoverflow.com/comment/34787128
answer count: 1
tagged with: string
tagged with: randomaccessfile
has body: my file content contains four columns 001 mike 1122 98 002 stephen 1232 97 Using RandomAccessFile i need to store the each column in its respective array types. readInt() is used to read Integer of column 1 how can i read the strings(column 2) to store in string array?
type: UnansweredQuestion
tagged with: java
has title: how to read the string from file using RandomAccessFile?
has answer: http://stackoverflow.com/a/22811060
type: Question
score: 0

http://stackoverflow.com/a/22923609
answers question: http://stackoverflow.com/q/22923514
has comment: http://stackoverflow.com/comment/34991495
type: Answer
has comment: http://stackoverflow.com/comment/34991943
has body: Try this: String tempString = returnString.substring(indexOf("defaultIcon")+12); String defaultIcon = tempString.substring(0,indexOf(",")); Here returnString is the output of getComponentAt() metho.
has comment: http://stackoverflow.com/comment/34993500
has comment: http://stackoverflow.com/comment/34991591
score: 0

http://stackoverflow.com/q/22925460
has answer: http://stackoverflow.com/a/22925533
type: UnansweredQuestion
tagged with: jlist
has answer: http://stackoverflow.com/a/22925527
has body: Recently, I have been working on a Java Jukebox program. So far in this program, the user selects a song from a JList, and hits a "Play" JButton. What I need to do is have the program find out what choice was chosen from the list and then launch the corresponding constructor. Any suggestions on how to do that? -John
has comment: http://stackoverflow.com/comment/34995009
tagged with: swing
tagged with: jbutton
type: Question
has answer: http://stackoverflow.com/a/22974623
tagged with: java
has comment: http://stackoverflow.com/comment/35084109
score: 0
answer count: 3
has title: How to see what a use has chosen from a JList?

http://stackoverflow.com/a/22919715
answers question: http://stackoverflow.com/q/22919629
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34983603
has comment: http://stackoverflow.com/comment/34983626
has body: You can use indexOf plus length and lastIndexOf to help you out and replaceAll to get rid of tags in the middle. String s = "@tag some text goes here and @tag nobody @tag should care about it @tag"; String searchString = "@tag"; int begin = s.indexOf(searchString) + searchString.length(); int end = s.lastIndexOf(searchString); String between = s.substring(begin, end); String withoutSearchString = between.replaceAll(searchString, ""); System.out.println(withoutSearchString);
score: 1
upvote count: 1

http://stackoverflow.com/q/22894155
duplicate of: http://stackoverflow.com/q/7953725
has comment: http://stackoverflow.com/comment/34937473
downvote count: 0
score: 1
tagged with: java
has body: Datetime value in long variable need to convert to this format 2014-04-06T12:04:23.000Z what is the simplest approach.
has comment: http://stackoverflow.com/comment/34937348
type: Question
has answer: http://stackoverflow.com/a/22894255
linked to: http://stackoverflow.com/q/7953725
has comment: http://stackoverflow.com/comment/34937426
tagged with: long-integer
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/34937373
has title: How to convert long to datetime in android
has answer: http://stackoverflow.com/a/22894185
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22894197
tagged with: android
tagged with: datetime

http://stackoverflow.com/q/22942227
type: Question
has comment: http://stackoverflow.com/comment/35047477
has comment: http://stackoverflow.com/comment/35025197
has answer: http://stackoverflow.com/a/22970074
has body: I have in my rest-application method: @GET @Path("/myList") public MyList getMyList(...) { ... object_of_MyClass.myMethod();//go to method "myMethod()" } And java-class with method "myMethod()": public class MyClass { @NotEmpty //Why it is not checked??? @HeaderParam("myHeader") //this work (@HeaderParam inject "myHeader" always correctly) String valueHeader; public void myMethod() { //I want use here field valueHeader, // but if valueHeader=null or empty I want throw Exception via @NotEmpty. } } Why it is not checked via org.hibernate.validator.constraints.NotEmpty?, Help me, please! If I do check @NotEmpty in rest-class - all good, But I need do check in MyClass.java
has comment: http://stackoverflow.com/comment/35074120
tagged with: java
tagged with: hibernate
score: 0
tagged with: annotations
has title: Why can not I check my field via org.hibernate.validator.constraints.NotEmpty? in simple java-class
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/22837325
has comment: http://stackoverflow.com/comment/34848867
tagged with: sql
tagged with: java-ee-6
has answer: http://stackoverflow.com/a/22862817
has comment: http://stackoverflow.com/comment/34877424
has comment: http://stackoverflow.com/comment/34853841
has comment: http://stackoverflow.com/comment/34879597
type: UnansweredQuestion
has body: Edited to reflect earlier omission: I want to define a relationship of 0 to 1 rows where there will never be more than 1 child row: ... @JoinColumn(name="INVENTORY_ID", referencedColumnName="INVENTORY_ID") @OneToOne private QOH qoh; ... So my problem is I have tried every way to use @OneToOne without @JoinColumn and with it and no matter what I do the SQL generated by Hibernate when selecting a subset of fields causes an inner join meaning that the Item records that have no QOH record are not returned: ... SELECT i.inventoryId,i.name,i.qoh.quantity FROM Item i; ... If I had full control over the database I'd enforce the creation of a QOH record anytime an Item is created but I don't control the database nor the access to it. Can Hibernate do this for a child entity?: ... SELECT ... FROM Item i LEFT OUTER JOIN QOH q ON q.INVENTORY_ID = i.INVENTORY_ID ... instead of: ... SELECT ... FROM Item i, QOH q WHERE q.INVENTORY_ID = i.INVENTORY_ID ...
has answer: http://stackoverflow.com/a/22862426
score: 0
tagged with: java
tagged with: hibernate
tagged with: hql
type: Question
has title: Is it possible to make Hibernate 3.1 generate a left outer join for a child entity?
has comment: http://stackoverflow.com/comment/34857633
answer count: 2
has comment: http://stackoverflow.com/comment/34839415

http://stackoverflow.com/a/22960513
type: Answer
has body: Create a custom FilterQueryProvider as described here. The constraint parameter should represent your search query (i.e. pack "a" and "b" into a single CharSequence. It may be a json, comma-separated String or part of an SQL query). Then filter your values inside runQuery(CharSequence constraint), for example, like this: // Constraint is "a,b" private FilterQueryProvider filterQueryProvider = new FilterQueryProvider() { public Cursor runQuery(CharSequence constraint) { String[] queryParameters = constraint.split(","); for (int i = 0; i &lt; queryParameters.length(); i++) { queryParameters[i] += "%"; } return db.query(TABLE_NAME, new String[] {"column_name"}, "column_name LIKE '?' OR column_name LIKE '?'", queryParameters , null, null, null); } }; Then the filtering is done by a single call words.getFilter().filter("a,b");
answers question: http://stackoverflow.com/q/22957050
score: 0

http://stackoverflow.com/q/22855303
has answer: http://stackoverflow.com/a/22855871
has body: I am receiving null statements when parsing an Xml from a URL that is from Google maps api. I have no idea where I am doing something wrong. I think it has to do with my elements and attributes but am not sure. Can someone please point me in the right direction or point out my error? Here are my three classes being used: import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class HandlingXML extends DefaultHandler { XMLDataCollected info = new XMLDataCollected(); public String getInformation(){ return info.dataToString(); } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // TODO Auto-generated method stub if (localName.equals("text")){ String time = attributes.getValue("duration"); info.setTime(time); }else if (localName.equals("text")){ String distance = attributes.getValue("distance"); info.setDistance(distance); } } } public class XMLDataCollected { String distance = null; String time = null; public void setTime(String t){ time = t; } public void setDistance(String d){ distance = d; } public String dataToString(){ return "Total Distance: " + distance + ", Total Duration: " + time; } } import java.net.URL; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MapParsing extends Activity implements OnClickListener { static final String baseURL = "http://maps.googleapis.com/maps/api/distancematrix/xml?origins="; TextView tv; EditText origin, destination; @Override public void onCreate(Bundle icicle){ super.onCreate(icicle); setContentView(R.layout.activity_main); Button b = (Button)findViewById(R.id.destination_next_butto…
type: Question
tagged with: google-maps
has comment: http://stackoverflow.com/comment/34867205
has answer: http://stackoverflow.com/a/22855528
has comment: http://stackoverflow.com/comment/34867217
score: 0
has title: Receiving null statements when parsing data from google maps api for Android Application
answer count: 3
tagged with: parsing
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22858139
tagged with: http://stackoverflow.com/tag/xml
tagged with: java

http://stackoverflow.com/comment/34972659
type: Comment
has text: Well, IMHO static methods are closer to functions in this respect. But I mostly agree with you.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22913546

http://stackoverflow.com/a/57037170
answers question: http://stackoverflow.com/q/22958391
score: 0
type: Answer
has body: Try this code: import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeoutException; import java.util.logging.Logger; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.poi.ss.usermodel.*; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbookFactory; public class App { public void convertExcelToCSV(Sheet sheet, String sheetName) { StringBuffer data = new StringBuffer(); try { FileOutputStream fos = new FileOutputStream("C:\\Users\\" + sheetName + ".csv"); Cell cell; Row row; Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { row = rowIterator.next(); Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { cell = cellIterator.next(); CellType type = cell.getCellTypeEnum(); if (type == CellType.BOOLEAN) { data.append(cell.getBooleanCellValue() + ","); } else if (type == CellType.NUMERIC) { data.append(cell.getNumericCellValue() + ","); } else if (type == CellType.STRING) { data.append(cell.getStringCellValue() + ","); } else if (type == CellType.BLANK) { data.append("" + ","); } else { data.append(cell + ","); } } data.append('\n'); } fos.write(data.toString().getBytes()); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static void main(String [] args) { App app = new App(); String path = "C:\\Users\\myFile.xlsx"; InputStream inp = null; try { inp = new FileInputStream(path); Workbook wb = WorkbookFactory.create(inp); for(int i=0;i&lt;wb.getNumberOfSheets();i++) { System.out.println(wb.getSheetAt(i).getSheetName()); app.convertExcelToCSV(wb.getSheetAt(i),wb.getSheetAt(i).getSheetName()); } } catch (Exception ex) { System.out.println(ex.getMessage()); } finally { try { inp.close(); } catch (Exception ex) { System.out.println(ex.getMessage()); } } } }

http://stackoverflow.com/q/22870917
tagged with: c++
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22925418
accepted answer: http://stackoverflow.com/a/22925418
tagged with: tidekit
type: Question
tagged with: c#
tagged with: native
has body: I am interested in this new platform - Tidekit. But I couldn't find any answer to my questions: Is it possible to add C# (or at least C++/JAVA) code or Dll libraries to the solution? Is it possible to make a package with html+js+css and native code (C#/C++/Java) working in one executable file or executable + dlls? There are already working solutions like CefSharp, Awesomium, but there is a problem to make external resources (html, css, js) embedded inside the project. I would like to hide my implementation from end users somehow. I'll appreciate any answer related to my questions.
answer count: 2
upvote count: 1
has title: Tidekit and C#/Java/C++ native code compatibility
favorite count: 0
possible better answer: http://stackoverflow.com/a/23611020
has answer: http://stackoverflow.com/a/23611020

http://stackoverflow.com/comment/38842468
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22920780
type: AnswerComment
has text: Didn't fix my issues, but is the best answer here (and I waited a long time to allow possible solutions come in), so I am marking this as correct

http://stackoverflow.com/q/22924073
has title: read all file names in a directory
score: 0
tagged with: nullpointerexception
tagged with: io
accepted answer: http://stackoverflow.com/a/22924119
tagged with: path
has answer: http://stackoverflow.com/a/22924094
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34992243
has comment: http://stackoverflow.com/comment/34992118
tagged with: java
tagged with: file
possible better answer: http://stackoverflow.com/a/22924094
type: Question
has answer: http://stackoverflow.com/a/22924119
answer count: 2
has body: I am trying to read all file names in a directory using java, i wrote the code and understand the process of writing it. However when I call String[] listOfFiles = folder.list(); it returns null (i get null pointer) I also tried listFiles() and have the same result. please tell me what am i doing wrong here is my directory private void getAllFileNames(){ /* File file =new File(filePathAndName); String path = file.getAbsolutePath(); System.out.println( "File: " + filePathAndName + "\n" + "AbsPath: " + path );*/ String filePathAndName = "resourses/amex"; File folder = new File(filePathAndName); System.out.println (folder == null); String[] listOfFiles = folder.list(); System.out.println (listOfFiles == null); //RETURNS TRUE System.out.println (listOfFiles.length); /*for (int i = 0; i &lt; listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { System.out.println("File " + listOfFiles[i].getName()); } else if (listOfFiles[i].isDirectory()) { System.out.println("Directory " + listOfFiles[i].getName()); } }*/ }

http://stackoverflow.com/q/22891568
has answer: http://stackoverflow.com/a/22891654
has body: I have a couple of methods in my android application that I would like to reuse across multiple Activities, as it's a Java helper class I'm not extending from anything. I have two problems, the first is how to pass the context into the java class and the second is how to use methods that extend from activity in the helper class, below is my helper class: Java Class public class ScreenHelper { Context context; public ScreenHelper(Context ctx) { this.context = ctx; } public int getStatusBarHeight(layout layout) { Rect r = new Rect(); Window w = (Window) getWindow(); w.getDecorView().getWindowVisibleDisplayFrame(r); return r.top; } public int getScreenHeight() { DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int ScreenHeight = metrics.heightPixels; return ScreenHeight; } public int getTitleBarHeight() { RelativeLayout relaLayout = (RelativeLayout) findViewById(R.id.title_bar); int titleHeight = relaLayout.getHeight(); Log.d("Title Height","Title Height:" + titleHeight); return titleHeight; } } Any help would be much appreciated.
downvote count: 0
score: 6
favorite count: 0
tagged with: android-context
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/22891637
has title: Android Helper classes
upvote count: 6
accepted answer: http://stackoverflow.com/a/22891637
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22891598
has answer: http://stackoverflow.com/a/22891598
type: Question

http://stackoverflow.com/a/22859701
type: Answer
answers question: http://stackoverflow.com/q/22856730
has body: You can clean your project and then you have to build it manually. Then the all classes will be build again and then this error should be fix
score: 0

http://stackoverflow.com/comment/34909308
type: Comment
has text: If you found a bug I suggest you submit a bug report.
type: QuestionComment
comment on: http://stackoverflow.com/q/22874374
score: 0

http://stackoverflow.com/q/22820601
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22820904
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34805090
has comment: http://stackoverflow.com/comment/34805191
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34805487
has body: hello guys I've created a simple chat room app but I can't connect to server to send and receive data, here is part of my code: server side: import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.util.regex.Pattern; public class Listener { public static void start() { try { final ServerSocketChannel serverSocketChannel = ServerSocketChannel.open(); serverSocketChannel.configureBlocking(true); serverSocketChannel.socket().bind(new InetSocketAddress(GetConfigs.getServerListenerPort())); final List&lt;Operator&gt; operators = new ArrayList&lt;&gt;(); final int nOperators = 64; for (int i = 0; i &lt; nOperators; i++) { operators.add(i, new Operator()); } final int parallelism = Runtime.getRuntime().availableProcessors(); ForkJoinPool pool = new ForkJoinPool(parallelism); pool.submit(() -&gt; new Thread(() -&gt; { int i = 0; while (true) { try { operators.get(i).newOperation(serverSocketChannel.accept()); i++; if (i == nOperators) { i = 0; } } catch (IOException ignored) { } } })).fork().invoke().start(); } catch (IOException e) { Logging.log.error(e); } } client side : import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; import java.util.Arrays; import java.util.LinkedList; import java.util.regex.Pattern; public class ConnectServer { private static final String SERVER_ADDRESS = GetConfigs.getServerIPAddress(); private static final int SERVER_LISTENER_PORT = GetConfigs.getServerListenerPort(); private StringBuilder result = new StringBuilder(); private void connect() { result.delete(0, result.length()); try { SocketChannel socketChannel = SocketChannel.open(); socketChannel.configureBlocking(true); if (socketChannel.connect(new InetSocketAddress(InetAddress.getByName(SERVER_ADDRESS), SERVER_LISTENER_PORT))) { DataOutputStream dos = new DataOutputStream(socketChannel.socket().ge…
favorite count: 0
has title: trouble connecting to ServerSocket over the internet
tagged with: sockets
has answer: http://stackoverflow.com/a/22820904
has comment: http://stackoverflow.com/comment/34804994
tagged with: serversocket
upvote count: 1

http://stackoverflow.com/q/22968044
type: Question
tagged with: datanucleus
score: 0
accepted answer: http://stackoverflow.com/a/23010578
has comment: http://stackoverflow.com/comment/35095614
has title: How do I set a variable in MySQL 5.5 using JDO and DataNucleus?
tagged with: sql
answer count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23010578
tagged with: java
tagged with: mysql
tagged with: jdo
has comment: http://stackoverflow.com/comment/35093067
has body: As part of my audit logging process, I need to set a variable @user_id in my code before running the INSERT INTO... statement. INSERT will initiate a TRIGGER which uses the @user_id. I have tried the following queries: SET @user_id = 5 This does not work because ResultSet cannot be NULL (and this query returns nothing) SELECT 51 INTO @user_id This does not work because again, ResultSet cannot be NULL in Java SELECT @user_id := 51 This does not work because the : character is translated into a parameter token when running queries using a PersistenceManager and a Query object. So, using DataNucleus, how can I set a variable so my TRIGGER statement succeeds with the necessary information for my auditing purposes? My Java code to run the queries is as follows: PersistenceManager pm = getPersistenceManager(); // My own function to get the PersistenceManager Query q = pm.newQuery("javax.jdo.query.SQL", "QUERY HERE"); q.execute(); If this cannot be done, what other options can I try to achieve the same result? Edit: I am using Google App Engine, and therefore stored procedures are not available to me.

http://stackoverflow.com/comment/34927085
comment on: http://stackoverflow.com/a/22887996
has text: yes added it to cacerts. Build path is having reference to JRE. Still same issue
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/32067267
type: Answer
score: 0
has body: You are mixing Loggers and appenders. Additivity can be configured on a logger, and the Logger takes the &lt;severity level&gt; and an &lt;appender name&gt; as argument. Look closely at how I renamed your WorkOrder* names (* = {Appender, Logger}). Thus, the combination of log4j.logger.WorkOrderLogger=INFO, WorkOrderAppender log4j.additivity.WorkOrderLogger=false and Logger logger = Logger.getLogger("WorkOrderLogger"); should work.
answers question: http://stackoverflow.com/q/22837444

http://stackoverflow.com/a/22908910
type: Answer
accepted answer of: http://stackoverflow.com/q/22815824
answers question: http://stackoverflow.com/q/22815824
has body: Error was apparently with the mysql configuration (tried with tomcat server which gave me more log information)
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/22813279
has body: I am trying to set all shells to B/W on a RHL systems. I am also trying to use Java code to do the same thing for output to a terminal. How would I accomplice this? thanks, Chris
accepted answer: http://stackoverflow.com/a/22813587
type: AnsweredQuestion
tagged with: java
tagged with: xterm
type: Question
has answer: http://stackoverflow.com/a/22813587
score: 0
answer count: 1
tagged with: redhat
has title: How do I change the colors for xterms to no color (B/W) for all Terminals on RHL in Shell and Java

http://stackoverflow.com/comment/35002457
type: Comment
score: 0
type: AnswerComment
has text: Does that apply to all methods of writing? Or would it be solved by using something other than DataOutputStream?
comment on: http://stackoverflow.com/a/22925394

http://stackoverflow.com/comment/34993631
has text: What do you mean, "if I run the jar again"? Is it in a sort of container?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22924925
score: 1

http://stackoverflow.com/comment/34929004
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22889335
has text: its from Google Glass library\
type: Comment

http://stackoverflow.com/comment/34992344
comment on: http://stackoverflow.com/q/22923994
type: Comment
type: QuestionComment
has text: @LaughDonor I didn't know about that, thanks for the little tip.
score: 0

http://stackoverflow.com/comment/35012422
comment on: http://stackoverflow.com/a/22930120
type: AnswerComment
score: 0
type: Comment
has text: you already remove your `setVisible(true)` in the constructor..?

http://stackoverflow.com/q/22949031
type: Question
tagged with: casting
has title: Avoid cast in a generics hierarchy
score: 0
answer count: 1
tagged with: generics
has answer: http://stackoverflow.com/a/22949337
type: UnansweredQuestion
tagged with: architecture
tagged with: java
has body: I have some difficulty to simplify more the problem. Sorry if they are too many code here. I try to improve the architecture of the code above because I hate warning and cast and I feel something wrong. Now, the code. I have a util class with these two parametrized methods (same signature as OpenJPA's CriteriaBuilder...) public class MyUtil { public void equal(List&lt;?&gt; l, Object value) { // do something (see CriteriaBuilder.equal method) } public &lt;Y extends Comparable&lt;? super Y&gt;&gt; void greaterThan(List&lt;? extends Y&gt; l, Y value) { // do something (see CriteriaBuilder.greaterThan method) } } Then, I want to be able to abstract them to call it via an interface. public interface IOperation&lt;T&gt; { // maybe make this method generic ? but how ? public abstract void doOp(List&lt;T&gt; l, T value); } public abstract class AbstractOperation&lt;T&gt; implements IOperation&lt;T&gt; { protected MyUtil myUtil; } public class EqualOp extends AbstractOperation&lt;Object&gt; { @Override public void doOp(List&lt;Object&gt; path, Object value) { myUtil.equal(path, value); } } public class GreaterThanOp&lt;T extends Comparable&lt;? super T&gt;&gt; extends AbstractOperation&lt;T&gt; { @Override public void doOp(List&lt;T&gt; path, T value) { myUtil.greaterThan(path, value); } } I create a factory public class OperationFactory { private static OperationFactory instance; public static OperationFactory getInstance() {...} public IOperation&lt;?&gt; get(String op) { if ("=".equals(op)) { return new EqualOp(); } else if ("&gt;".equals(op)) { return new GreaterThanOp&lt;Comparable&lt;? super Object&gt;&gt;(); } throw new InvalidParameterException(); } } Then I use it : public class Client { public void needOp(String op) { IOperation&lt;String&gt; operation = (IOperation&lt;String&gt;) OperationFactory.getInstance().get(op); // How to avoid this cast ? List&lt;String&gt; l = null; operation.doOp(l, "a string"); } } My question is : is it possible to avoid this cast in …

arrays
tags question: http://stackoverflow.com/q/22966195
tags question: http://stackoverflow.com/q/22838413
tags question: http://stackoverflow.com/q/22888720
tags question: http://stackoverflow.com/q/22927392
tags question: http://stackoverflow.com/q/22898437
tags question: http://stackoverflow.com/q/22901412
tags question: http://stackoverflow.com/q/22945344
tags question: http://stackoverflow.com/q/22888883
tags question: http://stackoverflow.com/q/22922850
tags question: http://stackoverflow.com/q/22846538
tags question: http://stackoverflow.com/q/22919207
type: Tag
tags question: http://stackoverflow.com/q/22810107
tags question: http://stackoverflow.com/q/22957011
tags question: http://stackoverflow.com/q/22825364
tags question: http://stackoverflow.com/q/22926858
tags question: http://stackoverflow.com/q/22827819
tags question: http://stackoverflow.com/q/22880419
tags question: http://stackoverflow.com/q/22899648
tags question: http://stackoverflow.com/q/22905617
tags question: http://stackoverflow.com/q/22819593
tags question: http://stackoverflow.com/q/22927388
tags question: http://stackoverflow.com/q/22927911
tags question: http://stackoverflow.com/q/22880458
tags question: http://stackoverflow.com/q/22872176
tags question: http://stackoverflow.com/q/22954862
tags question: http://stackoverflow.com/q/22901151
tags question: http://stackoverflow.com/q/22918109
tags question: http://stackoverflow.com/q/22810323
tags question: http://stackoverflow.com/q/22913851
tags question: http://stackoverflow.com/q/22876030
tags question: http://stackoverflow.com/q/22879490
tags question: http://stackoverflow.com/q/22885156
tags question: http://stackoverflow.com/q/22872980
tags question: http://stackoverflow.com/q/22872946
tags question: http://stackoverflow.com/q/22899191
tags question: http://stackoverflow.com/q/22859324
tags question: http://stackoverflow.com/q/22947766
tags question: http://stackoverflow.com/q/22855191
tags question: http://stackoverflow.com/q/22964717
tags question: http://stackoverflow.com/q/22926450
tags question: http://stackoverflow.com/q/22844108
tags question: http://stackoverflow.com/q/22819665
tags question: http://stackoverflow.com/q/22838950
tags question: http://stackoverflow.com/q/22949576
tags question: http://stackoverflow.com/q/22829623
tags question: http://stackoverflow.com/q/22874424
tags question: http://stackoverflow.com/q/22885231
tags question: http://stackoverflow.com/q/22895177
tags question: http://stackoverflow.com/q/22952159
tags question: http://stackoverflow.com/q/22810806
tags question: http://stackoverflow.com/q/22836765
tags question: http://stackoverflow.com/q/22948023
tags question: http://stackoverflow.com/q/22864813
tags question: http://stackoverflow.com/q/22860833
tags question: http://stackoverflow.com/q/22901937
tags question: http://stackoverflow.com/q/22831777
tags question: http://stackoverflow.com/q/22837086
tags question: http://stackoverflow.com/q/22885387
tags question: http://stackoverflow.com/q/22827066
tags question: http://stackoverflow.com/q/22851792
tags question: http://stackoverflow.com/q/22854054
tags question: http://stackoverflow.com/q/22924252
tags question: http://stackoverflow.com/q/22948929
tags question: http://stackoverflow.com/q/22884138
tags question: http://stackoverflow.com/q/22925894
tags question: http://stackoverflow.com/q/22910465
tags question: http://stackoverflow.com/q/22872807
tags question: http://stackoverflow.com/q/22948762
tags question: http://stackoverflow.com/q/22881874
tags question: http://stackoverflow.com/q/22866136
tags question: http://stackoverflow.com/q/22816016
tags question: http://stackoverflow.com/q/22851123
tags question: http://stackoverflow.com/q/22917999
tags question: http://stackoverflow.com/q/22842299
tags question: http://stackoverflow.com/q/22876315
tags question: http://stackoverflow.com/q/22895606
tags question: http://stackoverflow.com/q/22886287
tags question: http://stackoverflow.com/q/22826953
tags question: http://stackoverflow.com/q/22867632

http://stackoverflow.com/q/22914536
has comment: http://stackoverflow.com/comment/34976377
has comment: http://stackoverflow.com/comment/34974193
answer count: 3
upvote count: 7
has comment: http://stackoverflow.com/comment/34974562
has comment: http://stackoverflow.com/comment/34975686
has title: Android onResume() not being called
tagged with: java
has comment: http://stackoverflow.com/comment/34974842
has answer: http://stackoverflow.com/a/54603695
has answer: http://stackoverflow.com/a/22918643
has comment: http://stackoverflow.com/comment/34976079
has comment: http://stackoverflow.com/comment/34974239
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/54603695
downvote count: 0
score: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/34976707
type: Question
has comment: http://stackoverflow.com/comment/34974194
has comment: http://stackoverflow.com/comment/34974097
linked to: http://stackoverflow.com/q/5689316
tagged with: android
accepted answer: http://stackoverflow.com/a/22918643
has body: for a while I have been creating a game engine that works on Android using Java. Unfortunately I have this problem where the onResume() method does't appear to be called. I am using a Thread to run everything, and when I minimise the app and then go back on the app, it just gives me a blank, black screen. But it DOES work when I turn the screen off and on again. The code that I am using for the activity: package org.simplecorporation.myengine.core.android; import org.simplecorporation.myengine.core.Settings; import org.simplecorporation.myengine.core.android.input.AndroidInput; import org.simplecorporation.myengine.core.game.BaseGame; import android.app.Activity; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.view.MotionEvent; import android.view.Window; import android.view.WindowManager; public abstract class AndroidActivity extends Activity { /* The abstract methods*/ public abstract void activityCreated(); public abstract void activityPaused(); public abstract void activityResumed(); public abstract void activityStopped(); public abstract void activityRestarted(); public abstract void activityDestroy(); /* The android display */ public AndroidDisplay androidDisplay; /* The onCreate method */ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Set the title this.setTitle(Settings.Window.Title); //Check the orientation and set it if (AndroidSettings.ScreenOrientation == AndroidSettings.SCREEN_ORIENTATION_PORTRAIT) this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); else if (AndroidSettings.ScreenOrientation == AndroidSettings.SCREEN_ORIENTATION_LANDSCAPE) this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); //Check if the activity should be fullscreen if (Settings.Window.Fullscreen) { //Get rid of the title bar this.getWindow().requestFeature(Window.FEATURE_NO_TITLE); //Make the activity fullscreen this.getWindow().setFlags(WindowManager.LayoutParams.FLA…
has answer: http://stackoverflow.com/a/22915014

http://stackoverflow.com/comment/34799750
type: AnswerComment
score: 0
has text: Even if I iterated using an iterator (instead of enhanced for-each loop), the clients would have no way to call i.remove() or whatever you had in mind. It's an entirely different object with no access to the loop.
type: Comment
comment on: http://stackoverflow.com/a/22817567

http://stackoverflow.com/comment/34955338
type: AnswerComment
score: 0
has text: @Jannis Are you just looking to get the last value `18446744073709551614`?
type: Comment
comment on: http://stackoverflow.com/a/22903726

http://stackoverflow.com/q/22922184
has comment: http://stackoverflow.com/comment/35067281
tagged with: sql
has comment: http://stackoverflow.com/comment/35046303
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35021353
favorite count: 0
has comment: http://stackoverflow.com/comment/35092347
upvote count: 2
has comment: http://stackoverflow.com/comment/35040378
has answer: http://stackoverflow.com/a/22922510
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/35116159
tagged with: java
type: Question
has body: I'm writing a webpage that takes input from a form, sends it through cgi to a java file, inserts the input into a database through sql and then prints out the database. I'm having trouble inserting into the database using variables though, and I was wondering if anyone would be able to help me out. String a1Insert = (String)form.get("a1"); String a2Insert = (String)form.get("a2"); This is where I get my variables form the form (just believe that it works, there's a bunch more back end but I've used this before and I know it's getting the variables correctly). String dbURL = "jdbc:derby://blah.blahblah.ca:CSE2014;user=blah;password=blarg"; Connection conn = DriverManager.getConnection(dbURL); Statement stmt = conn.createStatement(); stmt.executeUpdate("set schema course"); stmt.executeUpdate("INSERT INTO MEMBER VALUES (a1Insert, a2Insert)"); stmt.close(); This is where I try to insert into the databse. It give me the error: Column 'A1INSERT' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'A1INSERT' is not a column in the target table. If anyone has any ideas that would be lovely ^.^ Thanks
has comment: http://stackoverflow.com/comment/34989208
accepted answer: http://stackoverflow.com/a/22922510
tagged with: derby
has comment: http://stackoverflow.com/comment/35019273
has title: Inserting variables with SQL in Java

http://stackoverflow.com/q/22863808
answer count: 2
possible better answer: http://stackoverflow.com/a/22864996
upvote count: 1
has answer: http://stackoverflow.com/a/22864996
has body: I was wondering if any of you knows a good method to get the actual JComponent instance rendering a column header in an existing JTable. Could not find anything helpful on google, so I came here. :) I already know that there is a TableCellRenderer interface which delivers the component I want to get, but there is no guarantee that it'll return the same instance every time, so it is more or less useless to me. Edit: The goal is to have a possibility to get the Location and size of the component representing a column header dynamically. And by column header component I mean the instance of the following object: I really can't post any useful code example, sorry. Actually any JTable example will do, as the problem refers to the standard Java JTable functionality.
favorite count: 0
has answer: http://stackoverflow.com/a/22868017
accepted answer: http://stackoverflow.com/a/22868017
type: AnsweredQuestion
downvote count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/34891829
type: Question
tagged with: components
has comment: http://stackoverflow.com/comment/34883998
linked to: http://stackoverflow.com/q/7137786
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34883785
has comment: http://stackoverflow.com/comment/34882585
tagged with: jtable
has title: Jtable get column header component

http://stackoverflow.com/comment/34823989
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22831004
has text: @MadProgrammer Can we Make it same thing for JcheckBox too??

http://stackoverflow.com/q/22858776
tagged with: rabbitmq
type: Question
tagged with: java
tagged with: apache-camel
score: 0
answer count: 1
has title: Camel - camelContext - RabbitMQ component - what should be the value for exchangeName?
has body: I am using RabbitMQ component of Camel, for Camel routing. While creating a queue from RabbitMQ console I have not explicitly mentioned any exchange name. But the url expects the exchangeName rabbitmq://hostname[:port]/exchangeName?[options] What should be the value of exchangeName for a default queue? I tried to get the message from RabbitMQ console to see whether it has any exchangeName, and here is the snapshot From this I could not derive the exchangeName. Please help me.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22865322

http://stackoverflow.com/comment/35041867
score: 0
type: Comment
has text: I'm going to need a lot more information if I'm going to be able to help you. I think you're talking about this line: `View`. Is *this* line always surrounded by ` [space]` and `[space] `?
comment on: http://stackoverflow.com/a/22926103
type: AnswerComment

http://stackoverflow.com/a/22809942
downvote count: 0
score: 1
has body: Do at least some sort of research before asking here. Anyway, because this is too easy, here is the solution: function a($s) { return ltrim(md5($s), "0"); } a("test") returns 98f6bcd4621d373cade4e832627b4f6, as expected.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22809781
answers question: http://stackoverflow.com/q/22809781
type: Answer

http://stackoverflow.com/comment/35036209
type: AnswerComment
comment on: http://stackoverflow.com/a/22899297
type: Comment
has text: OnClickListener is a interface, `button1.setOnClickListener(this);` means that `button1` is implementing OnCLickListener.(Meaning: setting OnClickListener on button1.) `this` refers to "this" object which in this case is button1. In the same way you could write `button2.setOnClickListener(this);` in this case `this` refers to `button2`, and so on. I'm not really good at explaining things, but I hope it helped you to understand.
score: 0

http://stackoverflow.com/q/22860882
accepted answer: http://stackoverflow.com/a/22860990
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Choose between 2 defined numbers randomly
has body: So I have this piece of code if (x &gt;= gameView.getWidth()) { //if gone of the right side of screen x = x - gameView.getWidth(); //Reset x y = random.nextInt(gameView.getHeight()); xSpeed = ySpeed = } but I need to get both xSpeed and ySpeed to choose between two values, either '10' or '-10' and only those two numbers, nothing in between. Everywhere I've looked says use the random.nextInt but that also chooses from the numbers in between -10 and 10...
has answer: http://stackoverflow.com/a/22860998
tagged with: random
has answer: http://stackoverflow.com/a/22860990
has answer: http://stackoverflow.com/a/22860974
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/22861101
answer count: 4
has answer: http://stackoverflow.com/a/22861101
type: AnsweredQuestion

http://stackoverflow.com/comment/34881480
type: QuestionComment
has text: Will it be able to 'listen' changes in tag values?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22863341

http://stackoverflow.com/a/22897936
type: Answer
has comment: http://stackoverflow.com/comment/34947404
has body: Actually both codes are equal as first code if in the right-hand side of the for(:) array rather than an Iterable object (as in this case), the internal code uses an int index counter and checks against array.length. which is equivalent to: for (int i=0;i&lt; a.length; i++) { System.out.println(a[i]); } Advantage of first code is its internally handle the end condition and short in writing then the second one. but if object is iterable then it converts to: for(Iterator&lt;String&gt; i = iteratableObject.iterator(); i.hasNext(); ) { String item = i.next(); System.out.println(item); }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34945526
upvote count: 1
answers question: http://stackoverflow.com/q/22897674

http://stackoverflow.com/a/22850507
type: Answer
accepted answer of: http://stackoverflow.com/q/22850411
answers question: http://stackoverflow.com/q/22850411
score: 0
type: AcceptedAnswer
has body: Are you looking for something like this? String sequence = "0001112122"; for(int i=0; i+3&lt;sequence.length(); i+=2){ int currx = Character.getNumericValue(sequence.charAt(i)); int curry = Character.getNumericValue(sequence.charAt(i+1)); int finalX = Character.getNumericValue(sequence.charAt(i+2)); int finalY = Character.getNumericValue(sequence.charAt(i+3)); goTo(finalX, finalY, currx, curry); } It parses the 1st, 2nd, 3rd, and 4th digit into your goTo() method then jumps forward two characters and repeats.

http://stackoverflow.com/a/22959052
type: Answer
answers question: http://stackoverflow.com/q/22958966
has body: You can write the response to a File. Look at this answer for details. After this you can just open the File as you are used to.
score: 0

http://stackoverflow.com/comment/34827822
has text: I used this command so host couldn't be resolved error is gone, but main error is still coming. Please help. Thanks in advance.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22830797
type: Comment

http://stackoverflow.com/a/22871335
has body: Figured it out! // Because we're about to spin this triangle, be sure to draw // backfaces. If we don't, the back side of the triangle is invisible. Appearance ap = new Appearance(); PolygonAttributes pa = new PolygonAttributes(); pa.setCullFace(PolygonAttributes.CULL_NONE); ap.setPolygonAttributes(pa); shape.setAppearance(ap); Resource: http://www.duling.us/kevin/Java3D/simple/TriSpin.html
answers question: http://stackoverflow.com/q/22871164
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/22871164

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

http://stackoverflow.com/a/22879021
downvote count: 0
score: 1
upvote count: 1
has body: Virtual machines are an important abstraction used to make language development and implementation easier. A large number of languages use virtual machines of some kind to allow them to be executed. Dynamic scripting languages such as Ruby and Python are interpreted at runtime on simple virtual machine. The advantage of this is that if the interpreter can be re-compiled to run on an given environment then then language itself can be used on that environment too. Other languages such as Java can be compiled ahead of time to bytecode which is then either interpreted or just-in-time (JIT) compiled for execution. In this model only the virtual machine itself, and not the compiler, needs to be ported to any given environment to run code there. Java used this to advantage by allowing applications to be embedded in web pages. Even outside these more dynamic languages virtual machines are used to abstract away from the details of the underlaying hardware. For example the Low-Level Virtual Machine (llvm) compiler is engineered in such a way that it first compiles C, C++, Objective-C or whatever into instructions to run on virtual machine architecture and then translates this to real machine code. This translation can be done straight away, just as a traditional C or C++ compiler would, or at runtime using JIT compilation. These different types of virtual machines are working at different levels of abstraction. The llvm virtual machine is, as it's name suggests, at a very low level. It abstracts the different peculiarities of CPU architectures such as how to load and store floating point numbers, if things should be passed around on the stack or in registers, and so on. Virtual machines for languages such as Python however are abstracting over operating system APIs and similar things.
type: Answer
answers question: http://stackoverflow.com/q/22878183

http://stackoverflow.com/comment/34811060
comment on: http://stackoverflow.com/q/22823958
has text: What's wrong? You're trying to create a full-blown mock test when running in a Spring context. I would strongly consider, instead, that you inspect what you're injecting into your test, and be sure that it's precisely what you need to run your test as opposed to mocking the objects. Only in *certain* cases would you want to use a mock object in a Spring test.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22810333
tagged with: java
tagged with: jtds
has title: JasperReports JDBC TDS: internal error 2
type: Question
tagged with: jasper-reports
upvote count: 1
tagged with: jdbc
has body: I am trying to fill a jrxml file using JasperCompileManager and I am receiving the following error: net.sf.jasperreports.engine.JRException: Error executing SQL statement for : MSWST at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:240) at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1114) at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:691) at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1288) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:907) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:852) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:87) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446) at net.sf.jasperreports.engine.JasperFillManager.fillToFile(JasperFillManager.java:228) at net.sf.jasperreports.engine.JasperFillManager.fillToFile(JasperFillManager.java:124) at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:666) at DbReportFill.generateReport(DbReportFill.java:57) at DbReportFill.main(DbReportFill.java:160) Caused by: java.sql.SQLException: TDS: internal error 2 at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:505) at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:1029) at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:233) ... 12 more The connection looks like this: connection = DriverManager.getConnection( "jdbc:jtds:sybase://127.0.0.1:2631/serverName", "DBA", "…
favorite count: 0
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1

http://stackoverflow.com/comment/34926569
has text: Well, as I understand, he/she doesn't have `media* getMedia()` right now. But yes, if it exists in C-level, it can be deleted in Java level
type: Comment
comment on: http://stackoverflow.com/a/22813932
score: 0
type: AnswerComment

http://stackoverflow.com/q/22811087
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34787349
downvote count: 1
type: Question
tagged with: swingworker
has body: Coming from a WPF world, I am having a hard time implementing some basic stuff in Java. I need to execute a *.JAR file from another java GUI application. This JAR file takes minutes to finish, and I want the GUI not to freeze. So, my initial solution would be: create a SwingWorker class to call a command line in background. My main concerns are: I need to get the console output from the *.JAR file and show it in the GUI. Is it possible to update the GUI from a background thread? Is it possible to cancel the thread from a user input? How do I get notified that the thread is finished? Is my solution a good one?
has title: Implement a Execution Log in Java
tagged with: executable-jar
favorite count: 0
has comment: http://stackoverflow.com/comment/34787487
answer count: 0
upvote count: 2

http://stackoverflow.com/comment/34930139
score: 1
type: AnswerComment
has text: I agree that this is probably the reasoning behind the argument. In Java, though, classes are objects, so in my opinion the argument is bogus.
type: Comment
comment on: http://stackoverflow.com/a/22890042

http://stackoverflow.com/q/22882892
tagged with: structure
type: Question
tagged with: java
tagged with: eclipse
has title: Website directory structure different from eclipse
score: 0
answer count: 1
tagged with: directory
tagged with: tomcat
has body: I am coding a website using java servlets and am using eclipse and tomcat. When I test it using localhost, it works fine. But when I am deploying it on my actual website, the directory structure is messed up and the files are not called properly. My eclipse directory structure on localhost is Project Name .src/packageName/java files .WebContent/HTML files. When I make a call from the html files, I use the relative location and tomcat automatically knows to look in the src/packageName folder. For example, from the /WebContent/login.html page makes a onClick call as follows, . This will automatically trigger the java file in /src/packageName/welcome When I am deploying it in my actual website, the WebContent/login.html is throwing an error WebContent/welcome file is not found. How do I tell my website to search in /src/packageName folder?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22882950

http://stackoverflow.com/comment/34916669
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22882503
has text: Its mentioned in OP comments `MyImportable extends Importable<String>`
score: 0

http://stackoverflow.com/q/22906298
upvote count: 1
tagged with: inputstreamreader
favorite count: 0
tagged with: buffer
has body: I have tried two snippets of Java 1.7 code: Snippet 1: try { BufferedReader in = new BufferedReader( new InputStreamReader(myInputStream)); //from the Internet String s; out = new PrintWriter(new BufferedWriter(new FileWriter("file"))); while ((s = in.readLine()) != null){ out.write (s); } in.close(); out.close(); } catch (Exception e) { e.printStackTrace(); } Snippet 2: try { BufferedInputStream in = new BufferedInputStream( myInputStream); //from the Internet out = new BufferedOutputStream(new FileOutputStream("file")); byte[] data = new byte[1024]; // 1 Kb randomly chosen as my buffer int len=0; while ((len=in.read(data)) != -1) { out.write(data,0,len); } in.close(); out.close(); } catch (Exception e) { e.printStackTrace(); } Snippet 1 seems to perform approximately 2 to 6 times faster than snippet 2. However, I need to use Snippet 2 because I am reading a byte stream. Is there any way to improve the performance of snippet 2 so that it more closely matches snippet 1? Am I doing something wrong?
has comment: http://stackoverflow.com/comment/34959472
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34960299
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: streamwriter
has title: Java I/O performance Streams vs Reader/Writer
type: Question
has comment: http://stackoverflow.com/comment/34999420

constraints
type: Tag
tags question: http://stackoverflow.com/q/22835715
tag name: constraints

http://stackoverflow.com/q/22932060
linked to: http://stackoverflow.com/q/1432233
has comment: http://stackoverflow.com/comment/35008261
has answer: http://stackoverflow.com/a/38225366
tagged with: java
has answer: http://stackoverflow.com/a/22934408
type: Question
linked to: http://stackoverflow.com/q/11213160
has comment: http://stackoverflow.com/comment/35010813
accepted answer: http://stackoverflow.com/a/22935864
has comment: http://stackoverflow.com/comment/35008412
possible better answer: http://stackoverflow.com/a/22933285
has comment: http://stackoverflow.com/comment/35011194
has comment: http://stackoverflow.com/comment/35008236
has comment: http://stackoverflow.com/comment/35007768
has answer: http://stackoverflow.com/a/22933526
upvote count: 2
has comment: http://stackoverflow.com/comment/35008084
linked to: http://stackoverflow.com/q/324470
has comment: http://stackoverflow.com/comment/35008890
linked to: http://stackoverflow.com/q/749709
has comment: http://stackoverflow.com/comment/35010874
has answer: http://stackoverflow.com/a/22935864
has comment: http://stackoverflow.com/comment/35007815
has title: URL encode/decode on file name replace spaces with +, need alternative.
has body: My product is a web application. I have files that I upload and download later on, to/from my server. I am using java.net.URLDecoder.decode() when uploading files with unicode characters and java.net.URLDecoder.encode() when downloading files in order to save the file name and finally return it to the client as expected with no question marks and stuff (?????) . The problem is that if the file name consists spaces then the encode/decode replace them with + character which is perfectly normal because that's their business implementation, but clearly as you can understand it does not fit to my purpose. The question is what alternative do I have to overcome this situation? Is there build-in method for that or 3rd party package?
linked to: http://stackoverflow.com/q/1634271
tagged with: http://stackoverflow.com/tag/html
tagged with: utf-8
favorite count: 0
has comment: http://stackoverflow.com/comment/35008108
has comment: http://stackoverflow.com/comment/35007793
answer count: 5
has answer: http://stackoverflow.com/a/22933285
type: AnsweredQuestion
score: 2
downvote count: 0

http://stackoverflow.com/comment/35044622
comment on: http://stackoverflow.com/q/22953224
type: Comment
type: QuestionComment
has text: please have a look for jar file included
score: 0

http://stackoverflow.com/q/22811608
upvote count: 3
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/14577663
has comment: http://stackoverflow.com/comment/34788212
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27025175
has comment: http://stackoverflow.com/comment/34788239
type: UnansweredQuestion
tagged with: android
has body: I have the Installed Android ADT Bundle Installed. Ran Perfectly early today and now I have clicked on the desktop Icon and receive this: "Failed to Create the Java Virtual Machine" does anyone know how to get around this or had this problem before ?
has answer: http://stackoverflow.com/a/40013198
has title: ADT Eclipse: Failed to Create The Java Virtual Machine
linked to: http://stackoverflow.com/q/7302604
score: 3

http://stackoverflow.com/q/22840829
answer count: 1
has body: Currently, I have a UserDao class which creates a query using CriteriaQuery, for example to retrieve an instance of User from the database using its ID (let's call that method findById). So far, it's pretty straightforward and that works fine. However, I also have a GenericDao, which is extended by UserDao. Before userDao.findById returns its results, it passes the criteriaQuery to the GenericDao so I can add some restrictions to the criteriaQuery. Example: public class GenericDao { private EntityManager entityManager; protected Object executeCriteriaQuery(CriteriaQuery criteriaQuery) { return entityManager.createQuery(prepareQuery(criteriaQuery)).getSingleResult(); } private CriteriaQuery prepareQuery(CriteriaQuery criteriaQuery) { // add restrictions to criteriaQuery Predicate predicate = ... // some predicate which will be appended to the already formed criteriaQuery criteriaQuery.where(criteriaBuilder.and(criteriaQuery.getRestriction(), predicate)); return criteriaQuery; } } public class UserDao extends GenericDao { public User findById(String id) { CriteriaQuery query = criteriaBuilder.createQuery(entityClass); Root&lt;P&gt; entity = query.from(entityClass); query.select(entity); query.where(criteriaBuilder.equal(entity.get("id"), id.toUpperCase())); return executeCriteriaQuery(query); } } The thing is: the query that is built in the DAOs that extend my GenericDao may contain a JOIN. I want to add a predicate to a JOIN that is added to the criteriaQuery. From what I can see, I can retrieve the JOINs in the query by using From.getJoins(). However, according to the Javadoc for that method: Return the joins that have been made from this bound type. Returns empty set if no joins have been made from this bound type. Modifications to the set do not affect the query. Returns: joins made from this type How can I add a predicate to JOIN clauses in my criteriaQuery?
tagged with: jpa-2.0
favorite count: 0
has answer: http://stackoverflow.com/a/23084314
accepted answer: http://stackoverflow.com/a/23084314
downvote count: 0
has comment: http://stackoverflow.com/comment/35137341
tagged with: criteria-api
type: Question
type: AnsweredQuestion
tagged with: criteria
score: 1
has title: Modify CriteriaQuery JOINs after they have been added to the CriteriaQuery
tagged with: java
has comment: http://stackoverflow.com/comment/35127571
upvote count: 1

http://stackoverflow.com/comment/34962713
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22879625
has text: Something useful in the answer?

bytearrayoutputstream
tags question: http://stackoverflow.com/q/22840289
type: Tag
tag name: bytearrayoutputstream

http://stackoverflow.com/comment/34977406
comment on: http://stackoverflow.com/q/22914929
score: 0
type: Comment
type: QuestionComment
has text: 1. Ask user amount of rows and columns 2. Generate numbers between 0 and 31 and add them twice to the list until the list contains rows*columns amount of numbers (every number is there twice) 3. take this list and turn it into a 2d array so it looks like this imgur.com/BgirYhU so I can associate images to then in a gridLayout panel for a memory game. note**: the numbers are sorted with Collection.shuffle(myList);

http://stackoverflow.com/comment/34899544
has text: the exception should tell you exactly where. Using a debugger would let you see exactly what is going on.
comment on: http://stackoverflow.com/q/22872980
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34914645
type: AnswerComment
comment on: http://stackoverflow.com/a/22881299
score: 0
has text: I have edited my program. I have used some of the techniques that you asked me to. But still there is no output of the data sent by the client on the server console. :( help me please.
type: Comment

http://stackoverflow.com/comment/34944296
comment on: http://stackoverflow.com/q/22897901
type: QuestionComment
type: Comment
has text: You have more closing parenthesis, so `;` issue will be fixed if you will delete one. `end.next = new TwoWayNode<T>((T)(position.data).clone(), head, null);`
score: 0

http://stackoverflow.com/q/22950577
has answer: http://stackoverflow.com/a/22950721
favorite count: 0
has comment: http://stackoverflow.com/comment/35039481
has body: I'm trying to create a two dimensional array in a class where there is no main method. I could successfully initialize the array with the code: double[][] nameArray = new double[m][n]; //m、n is the size but when I try to assign a value to the array nameArray[0][0] = 0; a error comes up and shows the ";" is wrong in the syntax double[][] nameArray = new double[m][n]; however, this code works in my main method. I got confused and want to know what went wrong? can anyone answer my question? really appreciate it.
has title: Syntax error on token ";"
type: Question
has answer: http://stackoverflow.com/a/22950611
upvote count: 1
score: 0
tagged with: java
answer count: 3
downvote count: 1
tagged with: syntax-error
tagged with: arrays
has answer: http://stackoverflow.com/a/22950659
type: UnansweredQuestion

http://stackoverflow.com/q/22908398
score: 1
tagged with: java
tagged with: hibernate-tools
favorite count: 0
has body: I am using Hibernate3 Maven Plugin to reverse engineering, this is a part of my pom.xml <plugin> org.codehaus.mojo hibernate3-maven-plugin 2.2 <executions> hbm2java generate-sources hbm2java hbm2java jdbcconfiguration target/generatedClasses true false /src/main/resources/reverse/engineering/hibernate.reveng.xml /src/main/resources/reverse/engineering/MyReverseEngineeringStrategy.java src/main/resources/hibernate.properties target/generatedClasses/hibernate.cfg.xml It looks that the connection to the database is ok, but it create classes following the default reverseStrategy and not the one I declared "MyReverseEngineeringStrategy.java". And I get this error in the stacktrace. [ERROR] Could not create or find /src/main/resources/reverse/engineering/MyReverseEngineeringStrategy.java with one argu ment delegate constructor java.lang.ClassNotFoundException: /src/main/resources/reverse/engineering/MyReverseEngineeringStrategy.java at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:171) at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:123) at org.codehaus.mojo.hibernate3.configuration.JDBCComponentConfiguration.loadReverseStrategy(JDBCComponentConfig uration.java:100) at org.codehaus.mojo.hibernate3.configuration.JDBCComponentConfiguration.doConfiguration(JDBCComponentConfigurat ion.java:42) at org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguration(AbstractComponentC onfiguration.java:56) at org.codehaus.mojo.hibernate3.HibernateExporterMojo.configureExporter(HibernateExporterMojo.java:200) at org.codehaus.mojo.hibernate3.HibernateExporterMojo.doExecute(HibernateExporterMojo.java:273) at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:152) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) at org.apache.maven.lifecycle.…
type: Question
has comment: http://stackoverflow.com/comment/49833876
answer count: 1
tagged with: hibernate3-maven-plugin
upvote count: 1
has title: Hibernate3 Maven Plugin ERROR: Could not create or find "MyReverseStrategy.java" with one argument delegate constructor?
tagged with: reverse-engineering
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23656654
accepted answer: http://stackoverflow.com/a/23656654
downvote count: 0

http://stackoverflow.com/comment/35044511
type: AnswerComment
comment on: http://stackoverflow.com/a/22953406
has text: Yes I do, my question has been updated to include it.\
type: Comment
score: 0

http://stackoverflow.com/a/22871740
type: Answer
downvote count: 0
score: 1
has body: The answer was actually a little complicated, but not too bad, once I had some better feedback from other developers. See the explanation here, but for those that don't want to leave the page, basically do this: import java.lang.Process; import java.lang.Runtime; // your code here String keyPower = "input keyevent " + KeyEvent.KEYCODE_POWER; Runtime runtime = Runtime.getRuntime(); Process proc = runtime.exec(keyPower); Simplistic, but it gets it done, no matter what activity is being focused.
answers question: http://stackoverflow.com/q/22817235
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22817235

http://stackoverflow.com/a/22907939
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22907704
answers question: http://stackoverflow.com/q/22907704
type: Answer
has body: I think sth like that is easier: try { File file = new File("numbers.txt"); FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String line; while ((line = br.readLine())!= null) { String[] tokens = line.split("\\s"); System.out.println(Arrays.toString(tokens)); } } catch (Exception e) { e.printStackTrace(); }
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/59248528
has text: Correct and correct, just ran into it; setting the Desktop working directory to the assets folder in core worked for me.
score: 5
type: AnswerComment
comment on: http://stackoverflow.com/a/28155859
type: Comment

http://stackoverflow.com/comment/34880308
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22862873
has text: Where is your button click code?

http://stackoverflow.com/a/22846348
score: 2
has comment: http://stackoverflow.com/comment/34853757
upvote count: 2
has body: It seems not by your description of the procedure. When considering parallel computing you need to consider what parts of your code can be executed at the same time and if these operations have long computational times. Your procedure seems mostly sequential, i.e., you respond to user inputs and cannot make much use of his thinking time. Consider 2 cases: Suppose the computational time it takes prepare a questions is long. You need to prepare many questions after a user input. Sequential: you would make the user wait until all the questions are ready, and then sit idle while he answers. Parallel: you prepare the questions during the time the user answers. The "user thread" will ask the "questions preparation" thread for the next question while questions are being added in the background. The "questions preparation" thread is like a buffer for questions. Suppose the computational time it takes to prepare a questions is always shorter than the time it takes the user to answer. In this case there is no difference because there is no waiting time for the user - you prepare the next (one) question while he thinks, and do this repeatedly without needing a questions buffer. For more information on Java and parallel execution, see the tutorial on concurrency. For information about speedup relative to "how much parallel or squential the code is", see Amdahl's law.
answers question: http://stackoverflow.com/q/22844843
has comment: http://stackoverflow.com/comment/34852488
downvote count: 0
has comment: http://stackoverflow.com/comment/34852967
has comment: http://stackoverflow.com/comment/34853686
has comment: http://stackoverflow.com/comment/34853161
type: Answer
has comment: http://stackoverflow.com/comment/34854406

http://stackoverflow.com/q/22894809
upvote count: 0
has comment: http://stackoverflow.com/comment/34938589
has comment: http://stackoverflow.com/comment/34938769
tagged with: java
linked to: http://stackoverflow.com/q/25706216
has answer: http://stackoverflow.com/a/22894857
tagged with: error-handling
type: Question
has comment: http://stackoverflow.com/comment/34938570
has title: cannot find symbol when defining my own exception
score: -2
has body: can someone tell me why am i getting "cannot find symbol" while compiling. This is how i define my own exception: public void setIdNumber(int i)throws InvalidEmployeeId { idNumber = i; if ((idNumber &lt;= 0)) { throw new InvalidEmployeeId("invalid ID. Please input numeric ID"); } } cannot find symbol: public void setIdNumber(int i)throws InvalidEmployeeId symbol: class InvalidEmployeeId Here is the try and catch statement in the demo program: try { id = Integer.parseInt(input); worker.setIdNumber(id); } catch (invalidEmployeeId e) { System.out.println(e.getMessage()); } thanks in advance;
downvote count: 2
answer count: 1
duplicate of: http://stackoverflow.com/q/25706216
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34938951
has comment: http://stackoverflow.com/comment/34939042

http://stackoverflow.com/comment/34985199
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22920364
type: AnswerComment
has text: I use elements:Element table = doc.select("table[width=90%]").first(); And also need use:Iterator<Element> ite = table.select("FONT[style=FONT-SIZE: 10pt]").iterator();

http://stackoverflow.com/comment/34960603
type: QuestionComment
has text: I have tried this **VideoCapture cap = new VideoCapture("h ttp://username:password@ip:port/video/livesp.asp");** also but unable to connect with IP camera. Please reply if any one can sort this problem
type: Comment
comment on: http://stackoverflow.com/q/22879481
score: 0

http://stackoverflow.com/comment/76241082
comment on: http://stackoverflow.com/a/22878558
has text: where to call this, after onloadPageFinish ?
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/35178733
has text: @GroovyDotCom how did it go?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22856506

http://stackoverflow.com/q/22843356
type: UnansweredQuestion
type: Question
tagged with: gwt
tagged with: svn
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22843712
has body: I'm currently working with a java project(with GWT). The versioning program is svn and I use it through the eclipse plugin. Now, I have two machines. Today I tried to download the svn repository to the other machine (the one with no project, yet, in it). After the download, the project expected all the jar/configuration files to be found at the exact same path of the first machine. Example: Machine1's jar path: /home/user/application/eclipse/plugins/com.google.appengine/other_stuff Machine2's jar path: /hd/another_user/eclipse/plugins/com.google.appengine/other_stuff When I download the repository, the path of Machine1 is somehow "hard-coded" into the project, and, obviously, all the jar files aren't found. There's a way I can tell the svn repository not to download those path file?
has title: java project imported with svn override path files
answer count: 1
score: 0

http://stackoverflow.com/q/22883256
has comment: http://stackoverflow.com/comment/34918200
answer count: 2
has comment: http://stackoverflow.com/comment/34918048
has body: I'm having trouble with a homework, the thing is I have around 40.000 HashMap&lt;Character,Character&gt; objects stored in a ArrayList&lt;HashMap&lt;Character,Character&gt;&gt;object. Each object HashMap&lt;Character,Character&gt; object represent a key for a substitution cipher. So one HashMap object might be: a-&gt;a; b-&gt;b; c-&gt;c; d-&gt;d; e-&gt;e; f-&gt;f; g-&gt;h; h-&gt;g which means that the g and h are swapped during encription/decryption. The problem is that I'm coding a brute force attack on this cipher, so I'm looping over those 40.000 keys. When the program detects that say g->h It's a wrong substitution, I want to delete all the HashMap objects that contain this entry, not only the current element that I'm working with inside the loop and thus be able to avoid checking the keys one by one. So far I've tried the following, but its getting stuck no exception or anything just doesnt finish, not even while debugging: ArrayList&lt;HashMap&lt;Character,Character&gt;&gt; all_keys = new ...` all_keys = generateAllCombinations();` ArrayList&lt;HashMap&lt;Character,Character&gt;&gt; keys_to_delete = new ...` for(HashMap&lt;Character,Character&gt; key:all_keys){` all_keys.removeAll(keys_to_delete); \\other stuff going on...` if (!letters[0].getChar().equals(Constants.CHAR_E)){ Character invChar = key.get(Constants.CHAR_E); for(HashMap&lt;Character,Character&gt; key2 : all_keys){ if(key2.get(Constants.CHAR_E).equals(invChar)){ keys_to_delete.add(key2); } } } }
downvote count: 0
has answer: http://stackoverflow.com/a/22883535
has title: how to delete several items simultaneously from a ArrayList
favorite count: 0
tagged with: arraylist
upvote count: 3
type: UnansweredQuestion
type: Question
score: 3
tagged with: hashmap
has answer: http://stackoverflow.com/a/22885072
tagged with: java

http://stackoverflow.com/comment/35060045
comment on: http://stackoverflow.com/q/22960974
type: Comment
type: QuestionComment
score: 0
has text: @christopher: I'm not sure I understand the difference correctly, I'm going to look that up right away.

http://stackoverflow.com/comment/35018098
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22938622
has text: No, you *cannot* use eclipse to see this unless you are running on an emulator or an engineering device where adbd runs as root, or your program modifies the permissions of its file.

http://stackoverflow.com/q/22855997
favorite count: 0
has answer: http://stackoverflow.com/a/22856120
has comment: http://stackoverflow.com/comment/34868430
tagged with: android
has body: In my android application, I am using text watcher for adding values of edit text where values of each edit text value is added together and displayed in a text view.. for example if first edit text value is 23 and second edit text value is 25 they both are added together and displayed in a text view .. This application is about numerology .. in first edit text users first name is entered and in second users middle name is entered and in third edit-text users last name is taken and each letter has its own value from 1-9 so that corresponding values are added together and make it to a value between 1-9..this process repeat for all three edit-text values then the value for all three edit-text are added together and make it to 1-9 and displayed in a text-view. I did code for this but it is working fine for one edit-text.. but when calculating together two edit-text somewhere error is happening any one please help if understood the error.. MainActiviy public class MainActivity extends Activity { EditText et1,et2,et3 ; TextView tv1,tv2,tv3,tv4; String name = ""; String name1 = ""; String name2 = ""; String hname = ""; int nameValue = 0; int hnameValue = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_main); //TextView for displaying results tv2 = (TextView) findViewById (R.id.tv7); tv3 = (TextView) findViewById (R.id.tv9); //tv2 = (TextView) findViewById (R.id.tv7); //EditText for entering names et1= (EditText) findViewById(R.id.editText1); et2 = (EditText) findViewById(R.id.editText2); et3 = (EditText) findViewById(R.id.editText3); //Text change listner for first Name et1.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { //s= (et1.getText().toString() + et2.getText().toString() + et3.getText().toString()); //showNameValue(s); // showHeartNumber(s…
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: textwatcher
has comment: http://stackoverflow.com/comment/34868608
has title: Android textwatcher for more than one edittext
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22856390

http://stackoverflow.com/comment/34960750
score: 1
type: AnswerComment
has text: got it, execution of 4th task will start after 2500ms and at the time of 4th future turn it would complete 3440-2500=940ms sleep time still it requires 2060ms time to complete resulting in timeout :)
comment on: http://stackoverflow.com/a/22864097
type: Comment

http://stackoverflow.com/comment/34964318
type: Comment
type: QuestionComment
has text: What is it that you are trying to do? I mean, at the moment there will be no fields in the arrays you have initialised? Right?
score: 0
comment on: http://stackoverflow.com/q/22909049

http://stackoverflow.com/comment/34843527
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22842349
has text: None of them is an option. Other suggestions except .substring() or .split()?
type: AnswerComment

http://stackoverflow.com/a/22927819
has comment: http://stackoverflow.com/comment/35013325
has comment: http://stackoverflow.com/comment/35013319
score: 0
upvote count: 1
type: AcceptedAnswer
downvote count: 1
has body: Your ActionListener does not work becase JMenu ignores ActionEvent. If you want your program to exit on click at Close button, then use MouseListener: close.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { System.exit(1); } });
has comment: http://stackoverflow.com/comment/35011169
type: Answer
accepted answer of: http://stackoverflow.com/q/22926852
answers question: http://stackoverflow.com/q/22926852

http://stackoverflow.com/comment/34998788
has text: you want to compile it in 64bit? if not you can use a 32bit jvm in ur java IDE
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22927541
type: QuestionComment

http://stackoverflow.com/q/22848699
has comment: http://stackoverflow.com/comment/34856658
has title: The method totalTax(PropertyTax) in the type PropertyTax is not applicable for the arguments ()
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
score: 0
has body: I wrote this code, but I can't understand where the problem is. 1. package kiran; import java.text.NumberFormat; public class TestPropertytax { public static void main(String[] args) { NumberFormat nf = NumberFormat.getCurrencyInstance(); PropertyTax p1 = new PropertyTax(100000, 1.05); p1.calculate(); print(p1, nf); System.out.println("----------------------------------"); PropertyTax p2 = new PropertyTax(150000, 1.05); p2.calculate(); print(p2, nf); System.out.println("----------------------------------"); System.out.println("Total tax revenue " + nf.format(PropertyTax.totalTax())); System.out.println("--------- End of report ----------"); } static void print(PropertyTax p, NumberFormat nf) { System.out.println("Assessed value " + nf.format(p.getAssessedValue())); System.out.println("Taxable amount " + nf.format(p.getTaxableAmount())); System.out.println("Tax rate for each $100.00 is " + nf.format(p.getTaxRate())); System.out.println("Property tax is " + nf.format(p.getTax())); } } 2. package kiran; public class PropertyTax { private double assessedvalue; private double taxrate; private static double taxableamount; private static double propertytax; //private static double totaltaxrevenue; public PropertyTax(double AssessedValue, double TaxRate) { assessedvalue = AssessedValue; taxrate = TaxRate; taxableamount = assessedvalue*.92; propertytax = taxableamount*(taxrate/100); } public double totalTax(PropertyTax pT) { return this.calculate() + pT.calculate(); } public double calculate() { return propertytax = taxableamount*(taxrate/100); } public double getTax() { return propertytax; } public double getTaxableAmount() { return taxableamount; } public double getAssessedValue() { return assessedvalue; } public double getTaxRate() { return taxrate; } }
has answer: http://stackoverflow.com/a/22848781
has answer: http://stackoverflow.com/a/22848767
type: UnansweredQuestion

http://stackoverflow.com/a/22875886
upvote count: 2
answers question: http://stackoverflow.com/q/22875756
has body: Basically, there are two ways you could approach this: Ask the people who maintain the site how to implement login programmaticaly. (And while you are at it, check with them that what you are planning to do is permitted. It is better to ask first, and avoid the risk of getting into trouble with your university administration.) Reverse engineer what the page is doing when you log in using a web browser. One way to reverse engineering the page is to look at the page source, read the HTML and (try to) figure out what would happen when the user clicks the login button. (That part of the page looks like a straight-forward HTML form ...) If that approach doesn't give you the answer, then install and/or enable the web development tools in your browser, and use them to look at the actual HTTP requests that are sent when you login.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/34881849
score: 0
has text: When will the program stop then? Will it stop automatically when all files are copied or will it just keep on running monitoring the folder?
comment on: http://stackoverflow.com/a/22863724
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34885653
comment on: http://stackoverflow.com/a/22838345
score: 0
type: Comment
has text: The page with the form on it is ridiculously simple for the sake of trying to get this to work. I'm just trying to pass data to the "results" view
type: AnswerComment

http://stackoverflow.com/comment/34891771
type: Comment
comment on: http://stackoverflow.com/a/22868793
type: AnswerComment
has text: Great, yes that worked. But can you tell me, if the date is stored in the database as '01/05/2014' how does it know what timezone it was inputed in?
score: 0

http://stackoverflow.com/comment/35056131
score: 0
comment on: http://stackoverflow.com/a/22960209
type: Comment
has text: @SubhrajyotiMajumder, Yes. It will never throw `ConcurrentModificationException`.
type: AnswerComment

http://stackoverflow.com/a/23108928
has body: @Holger pointed me to the right direction in some sense: my problem is the implementation of Future, AsyncResult in this case. It turned out to be rather interesting. I looked into the AsyncResult class code and that is what i saw: public boolean cancel(boolean mayInterruptIfRunning) { throw new IllegalStateException("Object does not represent an acutal Future"); } public boolean isCancelled() { throw new IllegalStateException("Object does not represent an acutal Future"); } public boolean isDone() { throw new IllegalStateException("Object does not represent an acutal Future"); } So it explains why I got that exception all the time. The workaround for me was to return java.util.concurrent.ExecutorService.submit(new MyCallable&lt;MyClass&gt;(myClassInstance)) as java.util.concurrent.Future&lt;MyClass&gt; implementation. After it worked as expected.
type: Answer
answers question: http://stackoverflow.com/q/22810484
has comment: http://stackoverflow.com/comment/41427461
upvote count: 0
score: -2
downvote count: 2

http://stackoverflow.com/comment/35060405
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22959226
has text: thank you Mr. Angelo Neuschitzer for good response.. one thing more can you tell me please that how to get a broader category against a token like game/finance from wikipedia??

http://stackoverflow.com/a/22848098
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: You find ${site_logo} in a file "init.ftl". This file is in: liferay-portal-src-6.2.0-ce-ga1\portal-web\docroot\html\themes_unstyled\templates\init.ftl To change the src, include in init_custom.ftl #set ($company_logo_src = "$images_folder/yourlogo.png"). Then in your portal_normal the tag img put src="$company_logo_src" $images_folder is going to take the logo from folder images (of your theme). This var exist in init.ftl and have this value $theme_display.getPathThemeImages()
score: 1
has comment: http://stackoverflow.com/comment/34878482
accepted answer of: http://stackoverflow.com/q/22844119
has comment: http://stackoverflow.com/comment/34876844
answers question: http://stackoverflow.com/q/22844119

http://stackoverflow.com/comment/34980452
type: AnswerComment
has text: We are in Java 8, needs more lambda :)
comment on: http://stackoverflow.com/a/22918122
type: Comment
score: 2

http://stackoverflow.com/comment/34995802
comment on: http://stackoverflow.com/a/22908703
score: 0
type: AnswerComment
has text: I tried it on Samsung Galaxy S2 with version 4.0.4. However, that runs out of Memory like you suggested
type: Comment

http://stackoverflow.com/comment/35040538
has text: i edited the question trying to explain myself better
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22951070
score: 0

http://stackoverflow.com/comment/34979576
type: Comment
has text: I hate to say that it sounds like a bug, but it does. Just adding a lambda expression shouldn't break JAX-RS implementations.
type: QuestionComment
comment on: http://stackoverflow.com/q/22917462
score: 0

http://stackoverflow.com/comment/35063732
type: AnswerComment
score: 0
type: Comment
has text: I think he has made a simple copy/paste error. The second `spriteRedWins` seems to be the initialization for the blue one...
comment on: http://stackoverflow.com/a/22964416

http://stackoverflow.com/comment/34986414
type: Comment
type: QuestionComment
has text: Looks like the class cannot be found. Are you sure this configuration file is used to execute your unit tests?
comment on: http://stackoverflow.com/q/22921071
score: 0

http://stackoverflow.com/q/22826326
possible better answer: http://stackoverflow.com/a/22826582
has answer: http://stackoverflow.com/a/58985990
favorite count: 0
has answer: http://stackoverflow.com/a/22826582
tagged with: hash
type: Question
has body: I would like to use a HashMap to map (x, y) coordinates to values. What is a good hashCode() function definition? In this case, I am only storing integer coordinates of the form (x, y) where y - x = 0, 1, ..., M - 1 for some parameter M.
score: 5
tagged with: hashcode
has comment: http://stackoverflow.com/comment/34824162
accepted answer: http://stackoverflow.com/a/22864232
has answer: http://stackoverflow.com/a/66842590
tagged with: java
has answer: http://stackoverflow.com/a/36691121
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34815360
has comment: http://stackoverflow.com/comment/34840212
upvote count: 5
answer count: 5
linked to: http://stackoverflow.com/q/7013298
type: AnsweredQuestion
downvote count: 0
has title: Good hashcode function for 2D coordinates
has answer: http://stackoverflow.com/a/22864232

http://stackoverflow.com/q/22851945
upvote count: 2
linked to: http://stackoverflow.com/q/12768658
tagged with: urlconnection
has comment: http://stackoverflow.com/comment/34861655
favorite count: 0
has comment: http://stackoverflow.com/comment/34861563
tagged with: ajax
has title: Scroll down a Webpage from a Java Desktop Application
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
score: 2
downvote count: 0
answer count: 0
type: Question
has body: I'm trying to read in the HTML from a webpage and parse information from it using a URLConnection in Java. It works, but the page only loads part of the content, the rest is loaded as the user scrolls down the page. Is there any way for a Java program to trigger this? My program doesn't actually open the webpage in a browser, just a connection to the page. If it's relevant, I can add the URL I'm accessing. I've been trying to find the answer, and found a few similar topics on here, most of them without answers. However, I eventually made my way to this topic, which sounds like what I need, but I looked at the URLs of the calls being made and they're not always the same, so I can't just type them into the program. I looked at the topic it was supposedly a duplicate of, but that didn't seem to apply to my problem either, unless I misunderstood something. Is there any way to find these URLs each time the program runs, or any way to trick the connection into thinking I'm scrolling down the page? Or can I make a general "request" or "POST" as I've seen in some related topics, that will automatically call the appropriate URL (An explanation of a "POST" would be appreciated as well)?
tagged with: java

http://stackoverflow.com/comment/34863414
type: QuestionComment
comment on: http://stackoverflow.com/q/22851809
has text: Escritorio its my desktop folder of my mac any ideas?
score: 0
type: Comment

http://stackoverflow.com/q/22930305
type: Question
tagged with: graph
has comment: http://stackoverflow.com/comment/35003135
score: 0
has title: Get Subgraph for Neo4j embedded graph database using Java
tagged with: subgraph
answer count: 1
tagged with: neo4j
has answer: http://stackoverflow.com/a/22932124
accepted answer: http://stackoverflow.com/a/22932124
has body: I want to get the first hop neighbour nodes of some given set of nodes. After getting all the neighbour nodes, i want to get all the relationships existing between these neighbour nodes. I am not able to write cypher query for this.
type: AnsweredQuestion
tagged with: java
tagged with: database

http://stackoverflow.com/comment/35032638
has text: Your question is very vague. Is this what you want? http://stackoverflow.com/questions/3913592/start-an-activity-with-a-parameter
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22946689
type: Comment

http://stackoverflow.com/comment/35039109
has text: `EventQueue.invokeLater()` - That's one solution. The OP hasn't given enough context over what they really want, personally, if I'm auto closing a Window, I want to make sure I'm only monitoring events from that window ...
score: 0
comment on: http://stackoverflow.com/a/22950080
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34809715
score: 0
comment on: http://stackoverflow.com/a/22821399
has text: I have tried jmap to analyze the running heap. But noting jumps out of ordinary. And also, 99% is the PERM GEN memory used which is allocated. But the allocated memory (399MB) has not reached the full capacity(500MB)
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22929168
score: 0
has comment: http://stackoverflow.com/comment/35001097
answers question: http://stackoverflow.com/q/22928983
type: Answer
has comment: http://stackoverflow.com/comment/35001358
has comment: http://stackoverflow.com/comment/35001854
has comment: http://stackoverflow.com/comment/35001969
has body: Change following: List&lt;WebElement&gt; list1 = element.findElements(By.id("defaultaccess")); to List&lt;WebElement&gt; list1 = element.findElements(By.xpath("//table[@id='defaultaccess']/tbody/tr/td")); Since a tag is under table -&gt; tbody -&gt; tr -&gt; td tag

http://stackoverflow.com/comment/135843866
type: AnswerComment
score: 0
type: Comment
has text: Jeff, this is a fantastic answer, and for me, it's worth returning back to over and over, even though I have a pretty good handle on the topic. I upvoted this answer years ago. But re-reading it, I think there might be a very small error in it. In the second bullet point near the top, you mention that Mockito 2.0+ drops the dependency on Hamcrest. I'm reasonably sure that this change actually happened with Mockito 2.1.0, not 2.0.0. Maybe you'd consider checking this and editing it.
comment on: http://stackoverflow.com/a/22822514

http://stackoverflow.com/q/22876390
tagged with: jvm
favorite count: 0
tagged with: return
has comment: http://stackoverflow.com/comment/34905990
has body: I saw one Java puzzle problem about finally, and return int i = 0; try { return i; } finally { i++; } what's return value of this function, I know this will return 0, and I test another code StringBuffer sb = new StringBuffer("11"); try { return sb; } finally { sb.append("22"); } it's strange things happend, it return "1122" this's my first question: why it return "1122"? and I decompile the these two java code, 0: iconst_0 put 0 to the stack 1: istore_0 store the stack top into index 0 2: iload_0 put index 0 to the stack 3: istore_1 store the stack top into index 1 4: iinc 0, 1 inc the index 0 with 1 7: iload_1 put index 1 to the stack 8: ireturn return the top of stack // what's the below bytecode mean? because the index 0 has incremented, why increment again? 9: astore_2 10: iinc 0, 1 13: aload_2 this is my second question why 9 - 13 lines byte code means? and the index 0 has incremented, wy increment again? 0: new #2; //class java/lang/StringBuffer 3: dup 4: ldc #3; //String 11 6: invokespecial #4; //Method java/lang/StringBuffer."&lt;init&gt;":(Ljava/lang/String;)V 9: astore_0 10: aload_0 11: astore_1 12: aload_0 13: ldc #5; //String 22 15: invokevirtual #6; //Method java/lang/StringBuffer.append:(Ljava/lang/String;)Ljava/lang/StringBuffer; 18: pop 19: aload_1 // like the above, this seems should return the value in the index 1, it should be "11"?? 20: areturn 21: astore_2 22: aload_0 23: ldc #5; //String 22 25: invokevirtual #6; //Method java/lang/StringBuffer.append:(Ljava/lang/String;)Ljava/lang/StringBuffer; 28: pop 29: aload_2 30: athrow this my third question, it seem the should be the value in the index, it should be "11"??
possible better answer: http://stackoverflow.com/a/22876413
has answer: http://stackoverflow.com/a/22876413
has comment: http://stackoverflow.com/comment/77496544
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22876417
has comment: http://stackoverflow.com/comment/34905850
has title: Java finally return, and strange bytecode
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34905880
type: Question
has comment: http://stackoverflow.com/comment/34906276
answer count: 2
downvote count: 0
tagged with: try-catch-finally
score: 3
has answer: http://stackoverflow.com/a/22876417
tagged with: java-bytecode-asm

http://stackoverflow.com/q/22815824
tagged with: jboss
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/46485484
has answer: http://stackoverflow.com/a/22908910
score: 4
tagged with: grails
downvote count: 0
answer count: 4
has answer: http://stackoverflow.com/a/22893810
favorite count: 0
tagged with: wildfly
accepted answer: http://stackoverflow.com/a/22908910
has answer: http://stackoverflow.com/a/43117977
has title: Unable to deploy WAR file in Wildfly Server - Scan found incompletely copied file content for deployment
tagged with: war
has body: I'm trying to deploy a WAR file, which I made in grails with the grails warcommand (55 MB), to a Wildfly 8 server. I use the scp command scp schedulingAPI-0.1.war user@xx.xx.xx.xx:/home/user/wildfly-8.0.0.CR1/standalone/deployments/ whereafter the fileschedulingAPI-0.1.war.isdeployingis present on the server. After a few minutes, the fileschedulingAPI-0.1.war.failed` appears on the server. This is an output of my log file: 2014-04-02 15:15:04,581 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015009: Scan found incompletely copied file content for deployment /home/user/wildfly-8.0.0.CR1/standalone/deployments/schedulingAPI-0.1.war. Deployment changes will not be processed until all content is complete. 2014-04-02 15:37:04,566 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015009: Scan found incompletely copied file content for deployment /home/user/wildfly-8.0.0.CR1/standalone/deployments/schedulingAPI-0.1.war. Deployment changes will not be processed until all content is complete. 2014-04-02 15:53:15,600 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015009: Scan found incompletely copied file content for deployment /home/user/wildfly-8.0.0.CR1/standalone/deployments/schedulingAPI-0.1.war. Deployment changes will not be processed until all content is complete. I already tried the suggestion in this thread to add the attribute deployment-timeout="2400" to &lt;deployment-scanner&gt; in the /standalone/configuration/standalone.xml file but without success.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/46485484
tagged with: java

http://stackoverflow.com/q/22924593
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34994642
type: Question
has comment: http://stackoverflow.com/comment/34992973
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35114310
has comment: http://stackoverflow.com/comment/35089341
upvote count: 1
has comment: http://stackoverflow.com/comment/34993526
has title: Java: How do I specify a class of a class method argument?
answer count: 1
has comment: http://stackoverflow.com/comment/34993129
has comment: http://stackoverflow.com/comment/34993468
favorite count: 0
has answer: http://stackoverflow.com/a/22925876
tagged with: generics
has body: I have a method whose signature is: public static &lt;T&gt; T isA(Class&lt;T&gt; clazz); So I can do this: String str = isA(String.class); Where I'm having trouble is if I want T to be Class&lt;String&gt;: Class&lt;String&gt; cls = isA(???); I'm not sure how to formulate the argument to isA(). Can anyone offer guidence? In case you're wondering why I want to do this, I'm using EasyMock to mock a class that takes a Class&lt;T&gt; argument. EDIT: I was asked to add an example of what I'm trying to do. I'm trying to use EasyMock to mock Solr's SolrCore class as part of a test case. The signature of one of SolrCore's methods is: public &lt;T extends Object&gt; T createInitInstance(PluginInfo info, Class&lt;T&gt; cast, String msg, String defClassName); With EasyMock I can set up an expectation for that method. The construct isA(PluginInfo.class), for example, tells EasyMock to match any object of class PluginInfo: QueryParserPlugin queryPlugin = createNiceMock(QueryParserPlugin.class); SolrCore core = createNiceMock(SolrCore.class); expect(core.createInitInstance( isA(PluginInfo.class), isA(xxx), anyString(), anyString())).andReturn(queryPlugin); My problem is telling isA() to match any object of class Class&lt;T&gt;, where T in this case is QueryParserPlugin.
downvote count: 0

http://stackoverflow.com/q/22914882
type: AnsweredQuestion
has body: I'm trying to write a program to solve 2 puzzles who can't be solved independently from eachother, but have the same solution. My idea is that they both run in a seperate thread until they stop finding new pieces of information. Then they communicate what they have found by updating some shared state variables and continue if something was written by either one of them to the shared state. I think a CyclicBarrier is the appropriate mechanism to use here. This is my code (which is running concurrently in 2 threads: while (true) { doSolvingLogicHere(); shareUpdates(); // this method updates the shared state variable and is synhronized int count; int updates = 0; try { count = writeBarrier.await(); updates = threadsUpdatedSomething; if (count == 0) { writeBarrier.reset(); threadsUpdatedSomething = 0; //'reset' the shared value } } catch (InterruptedException ex) { Logger.getLogger(TwinSolver.class.getName()).log(Level.SEVERE, null, ex); } catch (BrokenBarrierException ex) { Logger.getLogger(TwinSolver.class.getName()).log(Level.SEVERE, null, ex); } if (updates == 0) { //no thread updated something break; } else { // at least one of the threads updated something, solving should continue in both threads readUpdates(); } } ThreadsUpdatedSomething is a shared integer which is incremented in the 'ShareUpdates()' if anything at all was updated by the threads. When both threads didn't find anything new in the iteration, this means that they never will find anything new and the whole loop should be stopped for both threads. That's why I'm checking for it to be zero. I would expect them to both stop when both threads did not write any new information in the shared state variables. But when running the program, one of the threads stop, while the other one keeps going. When debugging the program and setting breakpoints at 'readUpdates()' line, the program works as expected. Is this the correct way for handling such a concurrent 'solving' loop? And in case it is correct, where is …
has answer: http://stackoverflow.com/a/22915774
score: 1
tagged with: java
upvote count: 1
tagged with: concurrency
type: Question
accepted answer: http://stackoverflow.com/a/22915774
answer count: 1
downvote count: 0
has title: Concurrent puzzle solving: Java Concurrency - Cyclicbarrier. Correct usage?
favorite count: 0
tagged with: multithreading
tagged with: barrier

http://stackoverflow.com/q/22853382
has answer: http://stackoverflow.com/a/22853678
tagged with: eclipse
has answer: http://stackoverflow.com/a/22853562
type: Question
has answer: http://stackoverflow.com/a/22853468
upvote count: 1
has answer: http://stackoverflow.com/a/22853720
has comment: http://stackoverflow.com/comment/34863949
has answer: http://stackoverflow.com/a/22853495
favorite count: 0
has comment: http://stackoverflow.com/comment/34863959
score: 0
has comment: http://stackoverflow.com/comment/34863944
tagged with: android
answer count: 10
has answer: http://stackoverflow.com/a/22934256
has comment: http://stackoverflow.com/comment/34864269
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34863955
has answer: http://stackoverflow.com/a/22853560
downvote count: 1
has title: Android Toast doesn't pop up
has answer: http://stackoverflow.com/a/22853534
has answer: http://stackoverflow.com/a/22853724
has body: My problem statement::> I have a button, a text field and I want a toast to pop out after I give input in the text field and click the button. However, after giving the input and click the button, the toast does not pop up. Instead, the application close down. If I remove the text field, the toast will come out just fine. So I think, the one giving me error is the text field. Here is my code for the text field in the java::: public String getMyString(){ EditText edit1=(EditText) findByViewId(R.id.editText1); String string1 = edit1.getText().toString(); return string1; } I will return this to the onClick method as::: public void onClick(View view){ String string = getMyString(); Toast.makeText(this, string,Toast.LENGTH_SHORT).show(); } In my XML file for editText &lt;EditText android:id="@+id/editText1" android:labelFor="@id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="38dp" android:ems="10" android:inputType="text" /&gt; This is my second day learning eclipse so I will appreciate less technical jargon. I hope you guys can help me because I try to google but I really don't understand anything... XD Thanks.
has comment: http://stackoverflow.com/comment/34864010
has answer: http://stackoverflow.com/a/22853506
tagged with: java

http://stackoverflow.com/a/22837226
accepted answer of: http://stackoverflow.com/q/22836971
has body: This is one of the ways I have used to notify the user on a daily basis: Calendar firingCal = Calendar.getInstance(); Calendar currentCal = Calendar.getInstance(); firingCal.set(Calendar.HOUR_OF_DAY, 11); //24-hour format firingCal.set(Calendar.MINUTE, 00); firingCal.set(Calendar.SECOND, 00); long intendedTime = firingCal.getTimeInMillis(); long currentTime = currentCal.getTimeInMillis(); if(intendedTime &gt;= currentTime) { //this will set the alarm for current day if time is below 11 am alarmManager.setRepeating(AlarmManager.RTC, intendedTime , AlarmManager.INTERVAL_DAY, pendingIntent); } else { //this will set the alarm for the next day firingCal.add(Calendar.DAY_OF_MONTH, 1); intendedTime = firingCal.getTimeInMillis(); alarmManager.setRepeating(AlarmManager.RTC, intendedTime , AlarmManager.INTERVAL_DAY, pendingIntent); }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22836971
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/34814530
type: AnswerComment
comment on: http://stackoverflow.com/a/22825852
type: Comment
score: 0
has text: Well, that seems to be good subject for separate question. This way you would be able to describe it in more detail and lot of experts could guide you (I am just a fan).

http://stackoverflow.com/comment/35076966
has text: I wanted to test some game that weights significantly more than mine. I played Thor The Dark World. It loads only twice in the game. For the global map and for the level. This is how I'm doing it and it resumes immediately for this game. It weights nearly 1 GB and it's much more complex than my game. It has got much more things happening on the screen. That stopped me from realizing mentioned idea above and it makes me think again what is wrong in my code.
score: 0
comment on: http://stackoverflow.com/q/22958755
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34899097
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22872743
has text: Is your question about the `FileNotFound` exception itself, or about how to modify your code to handle such exceptions in general?
score: 0

teradata
type: Tag
tag name: teradata
tags question: http://stackoverflow.com/q/22966029
tags question: http://stackoverflow.com/q/22822878
tags question: http://stackoverflow.com/q/22966886

http://stackoverflow.com/a/52663422
type: Answer
has body: You can wrap System.out in the following way to prevent it being closed by the mapper, if you wouldn't like to set JsonGenerator.Feature.AUTO_CLOSE_TARGET flag to false for the mapper. public &lt;T&gt; void println(T t) throws IOException { objectMapper.writeValue(new OutputStream() { @Override public void write(int i) throws IOException { System.out.write(i); } }, t); System.out.println(); }
score: 0
answers question: http://stackoverflow.com/q/22904111

http://stackoverflow.com/q/22821258
has body: I have a Base interface that defines some common functionality. Now this base interface can be implemented by more than 50 classes each having some different additional methods. I want to have a static factory that will return an instance of any one of 50 classes depending on a parameter pass to that static factory method. public interface Base { public void a(); public void b(); } public class myclass implements Base { // a and b implementation public String c() { } public String d() { } } public class secondclass implements Base { // a and b implementation public String e() { } public String f() { } } How can I implement a static factory method. I am unsure of return type public synchronized static {return type} getInstance(String arg0) { // do something and return any one class based on arg0 } EDITS: A scenario If the passed parameter is 300 I want to return object of class myclass If parameter is 900 I want to return object of class secondclass And so on. having so many conditions is not feasible. NOT TO DO public synchronized static {return type} getInstance(String arg0) { // do something and return any one class based on arg0 if(arg0.equals("300")) { return new myclass(); } } REASON: This will not be salable. I am developing a public API and class list may increase to 100 or may be 500. I hope my question is more clear now. UPDATE: Very useful points highlighted here and this is what I thought of public abstract class Base { public abstract void a(); public abstract void b(); public synchronized staticabstract Base getInstance(String arg0); } public class myclass extends Base { private myclass() {} // private constructor not publicly instantiate // a and b implementation public void c(); public void d(); @Override public synchronized static abstract Base getInstance(String arg0) { if(arg0.equalsIgnoreCase("300")) { // only 1 if condition return new myclass(); } } } public class secondclass extends Base { private secondclass() {} // private constructor not publ…
has comment: http://stackoverflow.com/comment/34806449
has comment: http://stackoverflow.com/comment/34806817
has comment: http://stackoverflow.com/comment/34806272
tagged with: java
tagged with: factory-pattern
upvote count: 4
has comment: http://stackoverflow.com/comment/34806782
answer count: 3
has title: Static Factory: Java Design Issue
downvote count: 0
accepted answer: http://stackoverflow.com/a/22821374
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/34807944
type: AnsweredQuestion
score: 4
has answer: http://stackoverflow.com/a/22821755
has answer: http://stackoverflow.com/a/22821292
tagged with: design-patterns
possible better answer: http://stackoverflow.com/a/22821755
type: Question
has answer: http://stackoverflow.com/a/22821374

http://stackoverflow.com/comment/103827385
comment on: http://stackoverflow.com/a/32319955
has text: @MichaelCOLL the question is about how to programatically shutdown a spring boot app regardless of type. It also works for Spring MVC
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35133061
type: Comment
type: AnswerComment
has text: hi, thanks for the reply. i have used file.setLastModified() in my latest code (have not updated it here). but, let me try out the copyoptions that you have mentioned.
comment on: http://stackoverflow.com/a/22952778
score: 0

http://stackoverflow.com/a/67026560
answers question: http://stackoverflow.com/q/22869350
has body: You can implement a circular access list based on a single TreeMap. TreeMap Key Integer number of access requests Value List<T> list of objects to which access was requested Class CircularList<T> Methods This code works in Java 7 without additional libraries getOne() return T the first element with the least number of access requests getOne(List<T> filter) return T the first element with the least number of access requests that is not contained in the filter getOne(T filterIn) return T the filtered element getCount(T element) return int the number of access requests of the search element, or -1 if there is no such element status() return String the current status of the map <a href="https://tio.run/##7VhNc9s2EL3rVyC6lLJl2pr2VNuapG46k2kzOViTS6cHiIQs2BTAAqASt9FvdxdfFEmQlGSrXzPhQdbAi923i933KNzjNT7jOWH36cPTE13lXCh0D4txoWgWn1wOBnkxz2iCkgxLid5jytCfAwSPW5cKq/LfN1QkRYbFL1Sqq9nUWRprQddYEbSgDGdoJgh5j/Ord0yROyLGyG2YIpKRFWFKomvEyKfScBqNAIp3dn5yUn5HJ@h1jgVeoQx8IEF@L6ggaVwxON@isJirMCOPVW8fVRDrhy5QZNxeA5wiy9CXL8YulvQPEo308sUIYqpCsMvaTrWkMvbJxHmhoouxyeiNEPjRxJwa16PRduOmO0UbA9zqEgpA5HyjT1QtzXJGMCyzYjUnAvEFwklC4Eh0QYgEDH0FkY8sWQrOIKsUzdAdUR@Yzq9ejfNzsIci8EKZiBBePO4NoOYKzjR@q7e3tYBxe90sIc@yn3TmZls0qpfbeUEPRO80HmLI4mcSWPrjXuOsIFXbj3qhad1MuV77heArmzo4re2blTbXNlIsyIqvSXQRBoAmAx@CICqR5CsCebM7qOZCIcpK92P9jQEaWFVojpOHoFNtINeaU92ZYRdCgcYWUQhE4Qdi4jHyWdlxMod7JwiMrtjzaH2Bodk/uhrXYUCtNQx0iiYhhsTE0ilCRvCZciLZN1Dyz80S64y3Mex8jqpRm9MWBsNpavJNCiH0WfkzU9xADo/Ve49hZ@SsQ7dFnuoctOcVznfQgqvEuPQd@nvx7NccOm/Ox17kY/l1QTPdBSVDmwZRS6yQXPIiS9GcOJs6/T6DvKq7G7nYiHA4jCuUcKZAkYC0qHev4z@D63zXWgctzEdZwqFLEuXr4CDgPM8oSYPWdFYV4XDYWqSjJNw@Ujub9BDZZSf76Ogh5QAQ3aLASKKkckqk7p22tl1wgaLdnP19o7/N6i2M@6hZUP3s5mr97MfT@unLuTNv38wu8WDiy@x1TSFBS50t2XgODXq8p09bnejmeeV6xe2TwDWjrqD11ElL4jUq0Spk2W23igXn4FUM4PSGqUoa5N8haCUY9yrR6TEQNzs89WZz0KCrerDNQV4e2v@9GexeKVMriwcJLnjB0kEbZm/0yqtTS/hNy@sA44H/sV7cMk8X65SN4CP2EsxXzf@q@fto/ju2LdPBem8NvINnSPOsRHE0WYaE9p6Q/4RW7v/75vDfOMfRRtseuwUSDmEndzYPK4aexpksp69PCo8pcm2z/n9RuqNx@5F4/tmcf0z@f6kWHKgL@2…
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/34913772
comment on: http://stackoverflow.com/a/22881005
has text: Or just `new BigInteger("13")`. One can be too clever about these things.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22830601
downvote count: 0
accepted answer: http://stackoverflow.com/a/22844169
has body: I am trying to read a WSDL, extract the schemas imported/inline and put all these things into a single schema file.(extracting the string between the tags) While doing so, I am getting the following error: [Fatal Error] :1:416: The markup in the document following the root element must be well-formed.
has title: The markup in the document following the root element must be well-formed.While extracting XSD from WSDL
tagged with: xml-parsing
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 1
tagged with: web-services
tagged with: xsd
has answer: http://stackoverflow.com/a/22844169
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/34999544
has text: try { while(rs.next()){ System.out.println(date+branch+semester+subject); String s_uid=request.getParameter("uid"); String s_status=request.getParameter("s_status"+i); System.out.println(date+branch+semester+subject+s_uid+s_status); AttendanceGetSet ats=new AttendanceGetSet(date, branch, semester, subject, s_uid, s_status); AttendanceDAO ad=new AttendanceDAO(); ad.storeData(ats); }
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22928214
type: Comment

http://stackoverflow.com/a/22889720
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22889696
accepted answer of: http://stackoverflow.com/q/22889696
has comment: http://stackoverflow.com/comment/34954638
has body: You need to check the return value of ResultSet.next(). It returns false if there are no more rows. If a SQL query does not include any matches, you cannot call getString() or similar methods on the ResultSet. It is not that you have a result with all null fields -- you have no result at all.

http://stackoverflow.com/comment/34819418
type: Comment
has text: We are using Async tasks and all network calls are on a different threads. The stacktrace above does'nt reflect any network calls but view.getContext().
type: AnswerComment
comment on: http://stackoverflow.com/a/22828688
score: 0

http://stackoverflow.com/q/22868676
tagged with: android-intent
tagged with: java
tagged with: listview
has answer: http://stackoverflow.com/a/22868700
type: Question
has answer: http://stackoverflow.com/a/22868788
answer count: 2
score: 0
has body: Hello I am new to Android app development and recently I am developing an app. My app contains a listview in which I have added a String array.My objective is that When I click on a particular item in that list I want to share that item. For example if my listview contains these particular set of strings like "Apple", "Banana" ,"Orange" and if I click Banana I want the text "banana" to be shared among other apps like gmail, email, facebook, etc. The problem is that I get my lisview properly. All the items are being displayed but when i click on a particular item the sharing intent is not called. Pls help. I will add my code also. Thanks in advance public class Main extends ListActivity { String[] fruits = {"Apple", "Banana", "Orange"}; @Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.mainactivity); setListAdapter(new ArrayAdapter &lt; String &gt; (this, android.R.layout.simple_list_item_1, fruits)); } public void onListItemClick(ListView parent, View v, int position, long id) { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, fruits[position]); } }
tagged with: android
type: UnansweredQuestion
has title: starting an activity in a onListItemClick()

http://stackoverflow.com/a/22904184
score: 1
type: Answer
has body: try this: in ur constructor update this lines: JButton findnext = new JButton("FindNext"); // JButton replace = new JButton("Replace"); // JButton delete = new JButton("Delete"); // JButton upper = new JButton("Upper"); use this one: findnext = new JButton("FindNext"); // replace = new JButton("Replace"); // delete = new JButton("Delete"); // upper = new JButton("Upper");
answers question: http://stackoverflow.com/q/22904006
upvote count: 1
downvote count: 0

playframework-2.0
tags question: http://stackoverflow.com/q/22962013
tags question: http://stackoverflow.com/q/22877256
tags question: http://stackoverflow.com/q/22898720
tags question: http://stackoverflow.com/q/22836029
tags question: http://stackoverflow.com/q/22861440
tags question: http://stackoverflow.com/q/22955079
tags question: http://stackoverflow.com/q/22958559
tags question: http://stackoverflow.com/q/22857411
tags question: http://stackoverflow.com/q/22959354
tags question: http://stackoverflow.com/q/22851838
tags question: http://stackoverflow.com/q/22897111
tags question: http://stackoverflow.com/q/22854989
type: Tag
tags question: http://stackoverflow.com/q/22811420
tags question: http://stackoverflow.com/q/22893520
tag name: playframework-2.0

http://stackoverflow.com/q/22862341
has title: Is it possible Oracle IAS with Java JDK 1.4.2 and client using WS-Security?
answer count: 0
score: 0
tagged with: web-services
has body: I need to develop a WS client and a webservice that will be deployed under an Oracle IAS 10.1.2 (Java JDK 1.4.2). Moreover, I need to access the WS using WS-Security 1.0 (request signed with certificate); I have checked doing it with Axis2 and Rampart, but it seems there is no Java 1.4 compatibility, or at least I didn't get it work. No possibilities with Apache CXF (minimum Java 1.5). Do you know if there is some library that is appropriate for this case and Java 1.4 compatible?
type: Question
has comment: http://stackoverflow.com/comment/34879488
tagged with: java
tagged with: jdk1.4
has comment: http://stackoverflow.com/comment/34960903
type: UnansweredQuestion
tagged with: oracle-database
tagged with: ws-security

http://stackoverflow.com/a/22966946
answers question: http://stackoverflow.com/q/22966360
has body: You can define any number of constructors with each having different signature. Constructor can call only one constructor(should not call itself as that will create infinite loop). public class Person { private String name; private MyDate birthday; // This is a date based on a Person's birthday private MyDate today; // A date based on today's date public Person(String name, int pp, int kk, int vv) { this(name, new MyDate(pp, kk, vv)); } public Person(String name, MyDate birthday) { this(name); //Third constructor this.birthday = birthday; } public Person(String name) { this.name = name; } } class MyDate{ private int day; private int month; private int year; public MyDate(int pv, int kk, int vv) { this.day = pv; this.month = kk; this.year = vv; } }
type: Answer
score: 0

http://stackoverflow.com/comment/34935821
has text: I haven't put the object under any scope (eg: session or application) as it is created at client side. According to my understanding, as I have assigned the object to a static variable, hence it is accessible across the client side by the reference of the classname.staticvariable.
score: 0
comment on: http://stackoverflow.com/q/22893015
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22880567
downvote count: 0
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22880434
answers question: http://stackoverflow.com/q/22880434
upvote count: 1
type: Answer
has body: ok I found the answer. one possible solution is to use a Delegator like this: result = new Delegate&lt;PersonArt&gt;() { PersonArt delegator(String pShortName, Integer pOld, Integer pSize) { return doEvaluatePersonArt(pShortName, pOld, pSize); } }; works pretty fine.

http://stackoverflow.com/a/22889858
has comment: http://stackoverflow.com/comment/34929845
score: 1
accepted answer of: http://stackoverflow.com/q/22889468
has body: Apparently jconsole cannot authenticate the certificate it received on making a direct SSL connection to the JVM. Since it's on the local machine, it should be safe to select "insecure" and connect without certificate authentication.
upvote count: 1
answers question: http://stackoverflow.com/q/22889468
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34811833
type: Comment
has text: Stack Overflow is not a debugger. Figure out why the variable you're referencing is null. HINT: You probably haven't assigned an object to it.
type: AnswerComment
comment on: http://stackoverflow.com/a/22823950
score: 0

http://stackoverflow.com/comment/34896702
score: 1
comment on: http://stackoverflow.com/q/22871583
type: Comment
type: QuestionComment
has text: I removed the language from title, for your next question: Use tags to specify used language not the title.

http://stackoverflow.com/q/22883296
has comment: http://stackoverflow.com/comment/34926470
has comment: http://stackoverflow.com/comment/34923133
tagged with: java
has comment: http://stackoverflow.com/comment/34930832
has comment: http://stackoverflow.com/comment/34918386
has answer: http://stackoverflow.com/a/22890411
type: Question
has comment: http://stackoverflow.com/comment/34918083
has comment: http://stackoverflow.com/comment/34919388
has comment: http://stackoverflow.com/comment/34918491
linked to: http://stackoverflow.com/q/13723855
has body: have a slight problem here and I don't know how to fix it. I have an XML file that looks like this: &lt;?xml version="1.0"?&gt; &lt;item&gt; &lt;title&gt;Item 1&lt;/name&gt; &lt;description&gt;Description Text 1&amp;lt;br /&amp;gt;Description Text 2&lt;/description&gt; &lt;/item&gt; And I have a SAX parser that looks like this: public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if ("item".equals(qName)) { currentItem = new Item(); } else if ("title".equals(qName)) { parsingTitle = true; } else if ("description".equals(qName)) { parsingDescription = true; } } @Override public void endElement(String uri, String localName, String qName) throws SAXException { System.out.println("Testing endelement"); if ("item".equals(qName)) { Items.add(currentItem); currentItem = null; } else if ("title".equals(qName)) { parsingTitle = false; } else if ("description".equals(qName)) { parsingDescription = false; } } @Override public void characters(char[] ch, int start, int length) throws SAXException { System.out.println("writing"); if (parsingTitle) { if (currentItem != null) currentItem.setTitle(new String(ch, start, length)); } else if (parsingDescription) { if (currentItem != null) { currentItem.setDescription(new String(ch, start, length)); parsingDescription = false; } } The problem is that SAX is parsing only the first part of the text in the tag, up until the "&lt;br /&gt;" text (which is the tag) and ignores the rest. How do I make the SAX parser ignore "&lt;br /&gt;" and parse the rest of the description? Thanks.
score: 0
accepted answer: http://stackoverflow.com/a/22890411
answer count: 1
has comment: http://stackoverflow.com/comment/34918225
tagged with: parsing
has comment: http://stackoverflow.com/comment/34925580
tagged with: android
has title: SAX parser ignores text because of a tag
tagged with: sax
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/q/22844937
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22845851
has body: When clicking a row a window pops up. When clicking the cell in the first column nothing happens because a checkbox is located in the first column and a mouselistener detects the cell in the first column. But selecting the checkbox the window pops up again. How can i prevent the window popping up when selecting the checkbox? public class Testtable { static Display display; static Shell shell; static Font small_font; public Testtable(){} public static void main(String args[]){ display = new Display(); small_font = new Font(Display.getDefault(), Display.getDefault().getSystemFont().getFontData() ); shell = new Shell(display, SWT.BORDER|SWT.PRIMARY_MODAL|SWT.RESIZE); shell.setText(" Test table "); shell.setLayout(new GridLayout(1, true)); final Table table = new Table(shell, SWT.BORDER | SWT.CHECK | SWT.V_SCROLL | SWT.FULL_SELECTION); table.setHeaderVisible(true); table.setFont(small_font); GridData griddata = new GridData(SWT.FILL, SWT.FILL,false,false); griddata.horizontalSpan=5; griddata.heightHint = table.getItemHeight()*15; table.setLayoutData(griddata); TableColumn checkbox = new TableColumn(table,SWT.NONE,0); TableColumn column_one = new TableColumn(table,SWT.NONE,1); column_one.setText("column one"); TableColumn column_two = new TableColumn(table,SWT.NONE,2); column_two.setText("column_two"); TableColumn column_three = new TableColumn(table,SWT.NONE,3); column_three.setText("column_three"); TableColumn column_four = new TableColumn(table,SWT.NONE,4); column_four.setText("column_four"); for(int i=0;i&lt;10;i++){ TableItem item=new TableItem(table,SWT.NONE); item.setText(new String [] {"column 2 item-"+i,"column 3 item-"+i,"column 4 item-"+i}); } Label labelfiller=new Label(shell, SWT.SHADOW_OUT); /* Filler */ labelfiller.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING,0, true,true,4,2)); Button close = new Button(shell, SWT.PUSH); close.setText("Done"); shell.setDefaultButton(close); close.setLayoutData(new GridData(…
upvote count: 2
has title: SWT table row mousehandler and checkbox detection
tagged with: swt
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22845851
type: Question
answer count: 1

http://stackoverflow.com/comment/34988541
has text: You mean that the problem is that you want a jar file, not provided by OpenJPA, and which contains the JPA API classes? If so, here it is: http://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final
comment on: http://stackoverflow.com/q/22921687
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/35032588
type: QuestionComment
has text: can you show your complete ChildWindowAdd ?
comment on: http://stackoverflow.com/q/22946634
score: 0
type: Comment

http://stackoverflow.com/comment/35066071
type: Comment
has text: it's show me this exemption on any costume view or dialog that i have (not on the emulator's log cat on the design section of the android studio)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22964955

http://stackoverflow.com/q/22901196
score: 0
has title: Having issue extracting java data from NASA website
has comment: http://stackoverflow.com/comment/34951383
answer count: 0
type: UnansweredQuestion
has body: http://disc2.nascom.nasa.gov/Giovanni/tovas/realtime.3B42RT.2.shtml I am working on a project and trying to extract this data for a project on rainfall throughout the world. Experimental Real-Time TRMM Multi-Satellite Precipitation Analysis (TMPA-RT): 3B42RT I cannot figure out how to view and manipulate this data, java or non-java version. I also do not have experience w/ Java. Any tips or ideas will be appreciated.
tagged with: java
tagged with: web-scraping
type: Question
has comment: http://stackoverflow.com/comment/34950486
has comment: http://stackoverflow.com/comment/34953253

http://stackoverflow.com/comment/35067065
type: Comment
has text: The Java code in the JSP is to perform iterative production of HTML table TR, TD records. That is why exactly what you say, any other Java code needed by the loop should be found in the controller code. I need the Java code in my JSP/view to access the methods and properties in the controller.
type: AnswerComment
comment on: http://stackoverflow.com/a/22966063
score: 0

http://stackoverflow.com/q/22894285
linked to: http://stackoverflow.com/q/17138846
favorite count: 0
has body: I try to unit test an activity that extends a SherlockFragmentActivity without success in my application. To isolate the problem I reproduced it in a very simple Sandbox project but I can't figure out how to fix it. My configuration I use latest version of Eclipse with SDK & ADT 22.6.2 on Linux Debian. The project is tested through Emulator, in an Android 2.2 emulated device (API 8). The target API is Android 4.4.2 (API 19). JDK 1.6 (I also tried with JDK 1.7, see Could not find class X referenced from method Y). Problem I cannot run the unit test on the class that extends SherlockFragmentActivity. This is the output of the Console tab in Eclipse: [2014-04-06 13:01:02 - SandboxTest] Dx trouble writing output: already prepared [2014-04-06 13:01:03 - SandboxTest] ------------------------------ [2014-04-06 13:01:03 - SandboxTest] Android Launch! [2014-04-06 13:01:03 - SandboxTest] adb is running normally. [2014-04-06 13:01:03 - SandboxTest] Performing android.test.InstrumentationTestRunner JUnit launch [2014-04-06 13:01:03 - SandboxTest] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Android_2.2' [2014-04-06 13:01:03 - SandboxTest] Uploading SandboxTest.apk onto device 'emulator-5554' [2014-04-06 13:01:03 - SandboxTest] Installing SandboxTest.apk... [2014-04-06 13:01:10 - SandboxTest] Success! [2014-04-06 13:01:10 - SandboxTest] Project dependency found, installing: Sandbox [2014-04-06 13:01:11 - Sandbox] Application already deployed. No need to reinstall. [2014-04-06 13:01:11 - SandboxTest] Launching instrumentation android.test.InstrumentationTestRunner on emulator-5554 [2014-04-06 13:01:15 - SandboxTest] Test run failed: Test run failed to complete. Expected 2 tests, received 0 The Test run failed: Test run failed to complete. Expected 2 tests, received 0 is due to another issue, catched from the LogCat output, which is: Could not find class 'com.example.sandbox.MainActivity', referenced from method com.example.sandbox.test.Ma…
linked to: http://stackoverflow.com/q/18437105
type: Question
has title: Unit test SherlockFragmentActivity class leads to Could not find class X referenced from method Y
upvote count: 1
tagged with: unit-testing
tagged with: actionbarsherlock
tagged with: java
linked to: http://stackoverflow.com/q/14765910
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36284588
tagged with: android
linked to: http://stackoverflow.com/q/3545185
score: 1

http://stackoverflow.com/q/22845489
tagged with: java
has body: Hi I can't figure out how to verify if a user belong to one o more group under Linux os using java 7 nio library. Can anyone help me about this issue?
linked to: http://stackoverflow.com/q/18431285
tagged with: usergroups
type: Question
has title: Check group membership for a Linux user using Java
upvote count: 2
has answer: http://stackoverflow.com/a/59500187
has comment: http://stackoverflow.com/comment/34849545
answer count: 2
has comment: http://stackoverflow.com/comment/34853552
downvote count: 0
has comment: http://stackoverflow.com/comment/34960850
has comment: http://stackoverflow.com/comment/34849949
has answer: http://stackoverflow.com/a/22846060
favorite count: 0
accepted answer: http://stackoverflow.com/a/22846060
tagged with: linux
has comment: http://stackoverflow.com/comment/34849921
has comment: http://stackoverflow.com/comment/34849374
score: 2
possible better answer: http://stackoverflow.com/a/59500187
type: AnsweredQuestion

http://stackoverflow.com/comment/35010545
comment on: http://stackoverflow.com/a/22932150
has text: @gstackoverflow: After what? Even if `size` overflows all the way back up to positives, the iterator relies on a `nextIndex` variable to determine whether it's reached the end of the list, so it won't iterate over the whole thing. The code is just so heavily reliant on the `size >= 0` invariant, everything comes crashing down if that invariant breaks.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22962188
has comment: http://stackoverflow.com/comment/35237426
has comment: http://stackoverflow.com/comment/35073661
score: 0
has title: StormSubmitter() executing Topology that is reading data from a rabbitmq spout at runtime
favorite count: 0
type: UnansweredQuestion
has body: I am using a storm spout which is reading from a RabbitMQ queue. I am submitting the Storm topology (using StormSubmitter) to the cluster from the command prompt. So while running the topology, it should wait for the spout to read data off the queue, but its not doing. Is it because the topology cannot read data at runtime? I am running the topology as: TopologyBuilder builder = new TopologyBuilder(); builder.setSpout( "rabbitmqspout", new RabbitmqSpout() ); builder.setBolt( "rabbitmqbolt", new RabbitmqBolt() ) .shuffleGrouping("rabbitmqspout"); Config conf = new Config(); conf.put(Config.TOPOLOGY_WORKERS, 4); conf.put(Config.TOPOLOGY_DEBUG, true); try { System.out.println("TOPOLOGY submitted"); StormSubmitter.submitTopology("rabbittest3", conf, builder.createTopology()); } The spout is reading from the rabbitmq queue as: public void nextTuple() { try { consumer = new QueueingConsumer(channel); channel.basicConsume(QUEUE_NAME, true, consumer); while(true){ QueueingConsumer.Delivery delivery = consumer.nextDelivery(); String message = new String(delivery.getBody()); collector.emit(new Values(new String(message))); } }
answer count: 0
tagged with: java
upvote count: 1
downvote count: 1
tagged with: apache-storm
type: Question

http://stackoverflow.com/comment/34935708
has text: So I was thinking if you would do that. :) Still, +1.
comment on: http://stackoverflow.com/a/22893041
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34953325
score: 0
comment on: http://stackoverflow.com/q/22902586
type: Comment
type: QuestionComment
has text: Try `switch (mathOperation.trim().toLowerCase())` and make sure you're using JDK 7 or above.

http://stackoverflow.com/comment/34914728
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22872484
has text: @OJKrylow Emoji are included in Unicode release 6
score: 0

http://stackoverflow.com/q/22858932
type: Question
type: AnsweredQuestion
tagged with: native
accepted answer: http://stackoverflow.com/a/23140004
linked to: http://stackoverflow.com/q/2292629
answer count: 3
has comment: http://stackoverflow.com/comment/34873841
upvote count: 0
has comment: http://stackoverflow.com/comment/34874046
favorite count: 0
linked to: http://stackoverflow.com/q/825221
possible better answer: http://stackoverflow.com/a/22860493
score: -3
has answer: http://stackoverflow.com/a/22860493
has answer: http://stackoverflow.com/a/33051101
has comment: http://stackoverflow.com/comment/34873793
has answer: http://stackoverflow.com/a/23140004
has title: Where is the source code for native java.lang.math methods in JDK 7?
tagged with: java
has body: Per the title, where is the source code for the native java.lang.math methods JDK 7? Please don't point me to Where to find source code for java.lang native methods? this only answers for JDK 6. Oracle no longer appears to provide source for native methods at all. I looked in http://hg.openjdk.java.net/jdk7/hotspot/hotspot but there are thousands and thousands of files with no obvious relationship to the package structure of the Java core so I cannot see any way to find the java.lang.Math methods.
downvote count: 3
has comment: http://stackoverflow.com/comment/34874002

http://stackoverflow.com/q/22938031
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35017000
tagged with: java
possible better answer: http://stackoverflow.com/a/22938281
has title: How to make the scanner read multiply numbers and print them without going down a row
has answer: http://stackoverflow.com/a/22940629
linked to: http://stackoverflow.com/q/21069857
type: Question
accepted answer: http://stackoverflow.com/a/22938084
downvote count: 0
answer count: 3
has body: I am new to java and I am trying to write the code as followed: user inputs numbers one by one and the code needs to print right away each number and continue to receive the next number on the same row this is my code so far: Scanner user = new Scanner(System.in); String value = user.nextLine(); String matrix = ""; int point = 0; int pos = 0; while(pos &lt;= 5) { if(isInteger(value)) { System.out.print(matrix.substring(point) + "\t"); matrix = matrix + value+","; point+=2; pos++; } else { System.out.print("Not a number"); } value = user.next(); } but every time I input another number to the scanner when the program is running, it goes down to the next row. so after I type 1 , 2 , 3 , 4 , 5 the output is: 1 2 3 4 5 I want to make it like this: 1 2 3 4 5 is there a way to make the scanner read another number and still remain on the same line?
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22938084
upvote count: 1
has answer: http://stackoverflow.com/a/22938281

http://stackoverflow.com/q/22898530
has answer: http://stackoverflow.com/a/22898691
has title: Selection Sort in Java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34945451
has body: import java.awt.event.*; import javax.swing.*; import java.util.ArrayList; import java.util.Arrays; public class SortPractice { private int[] railgun = {2,7,4,2,4,7,1}; public SortPractice() { System.out.println(Arrays.toString(railgun)); SelectionSort(railgun); System.out.println(Arrays.toString(railgun)); } public static void SelectionSort(int[] ray){ for(int j = 0; j &lt; ray.length; j++){ int low = 0; for(int i = j; i &lt; ray.length;i++){ if(ray[i] &lt; ray[low]) low = i; } System.out.println(ray[low]); int temp = ray[low]; ray[low] = ray[j]; ray[j] = temp; } } public static void main(String[] args) { SortPractice steve = new SortPractice(); } } I have wrote this code out on paper and ran it through multiple times but for some reason its not working. i'm not sure if i'm missing a -1 or something and just didnt notice. Someone please take a look. Im not looking for working code. just and explanation/fix to mine so i can better understand what i did wrong and how to fix it on my own. Thanks :)
downvote count: 1
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/22898601
has answer: http://stackoverflow.com/a/22898606
tagged with: selection
answer count: 3
upvote count: 0
possible better answer: http://stackoverflow.com/a/22898606
tagged with: sorting
favorite count: 0
accepted answer: http://stackoverflow.com/a/22898601

javacard
tag name: javacard
tags question: http://stackoverflow.com/q/22909143
tags question: http://stackoverflow.com/q/22934621
type: Tag
tags question: http://stackoverflow.com/q/22820351

http://stackoverflow.com/a/22814162
upvote count: 1
has comment: http://stackoverflow.com/comment/34793268
has comment: http://stackoverflow.com/comment/34796401
has comment: http://stackoverflow.com/comment/34796484
has comment: http://stackoverflow.com/comment/34797211
has comment: http://stackoverflow.com/comment/34796531
type: Answer
answers question: http://stackoverflow.com/q/22813486
has comment: http://stackoverflow.com/comment/34796333
has comment: http://stackoverflow.com/comment/34794484
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34805659
has body: Looks reasonable to me. When you say that A record "should" also match the address, it is not clear what you mean though. If you mean that all results Must match the address, then you should change the Occur argument when adding that subquery to BooleanClause.Occur.MUST. If you mean that it is preferred to have a match on that field, and you want to see those documents at the top, but anything matching the numeric range queries is an acceptable result, then your current query is correct.
has comment: http://stackoverflow.com/comment/34851057

http://stackoverflow.com/comment/34906256
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22868197
has text: I have the feeling that this question belongs to [Code Review](http://codereview.stackexchange.com/).
score: 0

http://stackoverflow.com/q/22816251
type: UnansweredQuestion
has title: Mockito and method access level
type: Question
score: 3
has comment: http://stackoverflow.com/comment/34797074
tagged with: java
has comment: http://stackoverflow.com/comment/34797267
tagged with: mockito
downvote count: 0
answer count: 1
has body: My question is connected with framework Mockito and methods, which can be tested. Public methods can be well tested. Private methods cannot be tested in Mockito, but they can be tested in other mocking frameworks. What with protected methods and methods without access level (package-private)? As I checked, protected methods can be tested by creating inherited subclass with public method. What is the best way of testing these methods?
favorite count: 0
has comment: http://stackoverflow.com/comment/34797110
has answer: http://stackoverflow.com/a/22816373
has comment: http://stackoverflow.com/comment/34797015
has comment: http://stackoverflow.com/comment/34797352
upvote count: 3

http://stackoverflow.com/comment/35028645
score: 0
type: AnswerComment
has text: Using this, I get a `NullPointerException` on the line: tiles[i] = new GrassTile(manager.get("grass.png", Texture.class), new Vector2(i * 10, i * 10), new Vector2(10, 10));
type: Comment
comment on: http://stackoverflow.com/a/22943844

http://stackoverflow.com/q/22832935
has comment: http://stackoverflow.com/comment/34826961
tagged with: regex
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/34826996
upvote count: 3
has title: How can I skip/cancel the matching regex if something is found before the end of the pattern?
tagged with: java
has comment: http://stackoverflow.com/comment/34827080
accepted answer: http://stackoverflow.com/a/22833283
type: Question
has body: I'm trying to make two regex patterns that are exclusive to each other, used in Java. regex one: match anything between and except a | (pipe) character or \r\n line break characters, catching the full match and only the text between and into groups 1 and 2 respectively: regex: (\[\[([^|\r\n]*?)]]) should return 2 full matches with the following input: wikipage&amp;sfd/weird- The whitespace.con_vention/+-test regex two: match everything between and except a | (pipe) character or \r\n line break characters, catching the full match and only the text before the | into groups 1 and 2 respectively: regex: (\[\[([^|\r\n]*?)\|.*?]]) should return 2 full matches with the following input: the sandbox the.sandbox_/=test but with the following input: Test wiki:1, [[wiki:page]test|test ]one]], page one the First Full Match of regex two is: wiki:1, [[wiki:page]test|test ]one]] and the Second Full Match of regex two is: page one While I expect only two full matches like this: [[wiki:page]test|test ]one]] page one I've tried with negative lookahead like so: (\[\[([^|\r\n]*?)(?!]])\|.*?]]) but if it finds ]] it'll just backtrack and reuse the first part of the regex. So my question is: How do I skip/cancel the whole regex if ]] is found before | ?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34827593
favorite count: 0
has answer: http://stackoverflow.com/a/22833283
has comment: http://stackoverflow.com/comment/34827344

http://stackoverflow.com/a/22825435
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You have 1 project with 2 classes which each contain a main? A project should only have 1 main class. Try something like this: public class A { public static void main(String[] args) { B b = new B(); int[] array = b.getArray(); // Do something with array b.setArray(array); } } public class B { private int[] array; public B(){ array = {0,1,2,3,4}; // Dummy data } public int[] getArray(){ return array; } public void setArray(int[] array){ this.array = array; } }
score: 1
accepted answer of: http://stackoverflow.com/q/22825364
answers question: http://stackoverflow.com/q/22825364

http://stackoverflow.com/q/22945712
answer count: 6
tagged with: dispose
has body: I'm trying to dispose of the difficulty window after any one of the difficulty button's are clicked but it won't happen. I've tried .dispose and frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); but i can't get it. Is it just placement or more? import java.awt.FlowLayout; import java.awt.event.*; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.GridLayout; public class Game extends JFrame{ public static JFrame frame = new JFrame(); private JLabel lab; public static void main(String[] args) { Game difficulty = new Game(); difficulty.setSize(350,105); difficulty.setTitle("Difficulty."); difficulty.setVisible(true); difficulty.setLocationRelativeTo(null); /**Game sudoku = new Game(); sudoku.setSize(900, 900); sudoku.setVisible(false);*/ } public Game(){ setLayout(new FlowLayout()); lab = new JLabel("Please select your difficulty."); add(lab); JButton easy; easy = new JButton("Easy"); add(easy); easy.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //Execute when button is pressed System.out.println("You clicked the button"); JFrame.dispose(); } }); JButton medium; medium = new JButton("Medium"); add(medium); JButton hard; hard = new JButton("Hard"); add(hard); JButton evil; evil = new JButton("Evil!"); add(evil); } }
upvote count: 2
has answer: http://stackoverflow.com/a/22945781
has answer: http://stackoverflow.com/a/52575964
favorite count: 0
possible better answer: http://stackoverflow.com/a/22945898
score: 2
has answer: http://stackoverflow.com/a/22945831
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22945898
downvote count: 0
tagged with: jframe
has answer: http://stackoverflow.com/a/22945767
tagged with: swing
accepted answer: http://stackoverflow.com/a/22945767
has title: Can't dispose of jframe window?
tagged with: jbutton
type: Question
has answer: http://stackoverflow.com/a/22945860
tagged with: java

http://stackoverflow.com/comment/35028717
type: QuestionComment
has text: When you say excel sheet do you mean xls or xlsx or csv or ... ?
comment on: http://stackoverflow.com/q/22944524
score: 0
type: Comment

http://stackoverflow.com/comment/35047837
type: AnswerComment
comment on: http://stackoverflow.com/a/22952035
score: 0
type: Comment
has text: @user2161813 What did you use in Eclipse to create the build.xml?

http://stackoverflow.com/comment/35007107
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22921865
type: Comment
has text: with known court pattern it should be easy to calibrate. using parallel lines afaik you need at least 2 or 3 vanishing points (different line directions) but in that image you 'll only get one vanishing point since the horizontal lines are quite parallel to the image plane.

http://stackoverflow.com/comment/34983370
score: 0
type: Comment
has text: I've posted the entire code with my test cases. Can you please take a look? Thank you!!!
type: QuestionComment
comment on: http://stackoverflow.com/q/22915267

http://stackoverflow.com/comment/34796401
type: Comment
has text: They're indexed with `IntField`. I realized this might be a problem so I'm converting my doubles to ints.
type: AnswerComment
comment on: http://stackoverflow.com/a/22814162
score: 0

http://stackoverflow.com/q/22820330
has comment: http://stackoverflow.com/comment/34804522
has comment: http://stackoverflow.com/comment/34806230
has comment: http://stackoverflow.com/comment/34805958
score: 1
tagged with: java
tagged with: webserver
has title: Multithread java webserver
has answer: http://stackoverflow.com/a/22822021
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22822021
favorite count: 0
has body: I'm coding a server and this is how it looks now: import java.net.ServerSocket; import java.net.Socket; import java.io.InputStream; import java.io.OutputStream; import java.io.InputStreamReader; import java.io.BufferedReader; public class HttpServer { public static void main(String[] args) throws Throwable { //http://localhost:3000 ServerSocket ss = new ServerSocket(3000); while (true) { //Waiting for socket Socket s = ss.accept(); System.out.println("Client accepted"); //The main process new SocketProcessor(s,ss).start(); } } private static class SocketProcessor implements Runnable { private Thread t; private Socket s; private ServerSocket ss; private InputStream is; private OutputStream os; private SocketProcessor(Socket s,ServerSocket ss) throws Throwable { t = new Thread(this, "Server Thread"); this.ss=ss; this.s = s; this.is = s.getInputStream(); this.os = s.getOutputStream(); } public void run() { try { readInputHeaders(); Thread.sleep(10000); writeResponse(" Hello "); } catch (Throwable t) { /*do nothing*/ } finally { try { s.close(); } catch (Throwable t) { } } System.out.println("Client processing finished"); } public void start() { t.start(); } private void writeResponse(String s) throws Throwable { String response = "HTTP/1.1 200 OK\r\n" + "Server: Server\r\n" + "Content-Type: text/html\r\n" + "Content-Length: " + s.length() + "\r\n" + "Connection: close\r\n\r\n"; String result = response + s; os.write(result.getBytes()); os.flush(); } private void readInputHeaders() throws Throwable { BufferedReader br = new BufferedReader(new InputStreamReader(is)); while(true) { String s = br.readLine(); System.out.println(s); if(s == null || s.trim().length() == 0) { break; } } } } } Doesn't this while (true) { //Waiting for socket Socket s = ss.accept(); System.out.println("Client accepted"); //The main process new SocketProcessor(s,ss).start(); } make webserver multithreaded? I was trying to run http://localhost:3000 from 2 different tabs in my browser. As you can s…
tagged with: sockets
has comment: http://stackoverflow.com/comment/34805281
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22821347
has answer: http://stackoverflow.com/a/22821347
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34805632
upvote count: 1
has comment: http://stackoverflow.com/comment/34805073
type: Question

http://stackoverflow.com/comment/34996216
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22924469
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). 2) Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556), along with layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556).

http://stackoverflow.com/comment/34924450
has text: great! tnx! when i try to creat a new object i need to add value to the constructor Time 1, how do i add the information?
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22886754
type: Comment

http://stackoverflow.com/comment/34947303
type: Comment
comment on: http://stackoverflow.com/q/22898845
score: 0
has text: I think you need to get all the input and store it, before you start adding things up. Otherwise your output will be all muddled in with your input. So you'll have to traverse the arrays twice - once to collect the input and once to calculate and print the output.
type: QuestionComment

http://stackoverflow.com/comment/34837750
type: QuestionComment
type: Comment
has text: Show the `Letter` class definition.
score: 4
comment on: http://stackoverflow.com/q/22839342

http://stackoverflow.com/q/22908097
has body: Is it always a must for extending the View? public class MyNewView extends View{ public MyNewView(Context context) { super(context); } }
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22908174
score: 0
has title: Is calling super always necessary when extending a View?
has comment: http://stackoverflow.com/comment/34962417
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/22908174

http://stackoverflow.com/q/22824209
possible better answer: http://stackoverflow.com/a/22824724
has answer: http://stackoverflow.com/a/22824724
type: Question
tagged with: android-layout
upvote count: 5
tagged with: java
answer count: 2
score: 5
has body: I have a layout which has four buttons spread along the bottom of my app using the layout weight to distribute them evenly. I also want to increase the hight of the buttons using the same sort of weighting. So far all i can see is either calculating the width with a horizontal linearlayout or height using a vertical linearlayout. the width is working great its just the height. If the weight cannot be used at the same time how can i set the height so that it is relative on every screen size. &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:weightSum="1.0" android:gravity="bottom"&gt; &lt;ImageButton android:id="@+id/Button1" android:layout_width="fill_parent" android:layout_height="80dp" android:layout_weight="0.25" android:src="@drawable/b1" android:text="Left" /&gt; &lt;ImageButton android:id="@+id/Button2" android:layout_width="fill_parent" android:layout_height="80dp" android:layout_weight="0.25" android:src="@drawable/b2" android:text="RotL" /&gt; &lt;ImageButton android:id="@+id/Button3" android:layout_width="fill_parent" android:layout_height="80dp" android:layout_weight="0.25" android:src="@drawable/b3" android:text="RotR" /&gt; &lt;ImageButton android:id="@+id/Button4" android:layout_width="fill_parent" android:layout_height="80dp" android:layout_weight="0.25" android:src="@drawable/b4" android:text="Right" /&gt; &lt;/LinearLayout&gt; I dont want to hardcode the heights of the buttons
downvote count: 0
has answer: http://stackoverflow.com/a/22824289
favorite count: 0
has title: Is there a way to use weights with both layout width and height
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22824289

http://stackoverflow.com/comment/34812601
score: 0
has text: @KyleM right, I am just too HTTP centered these days... user325.. put the communication with the server in a different thread so it won't get blocked.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22824750

http://stackoverflow.com/comment/132008876
comment on: http://stackoverflow.com/q/22862226
has text: @MarkoTopolnik So if I want to be able to get the latest value of `x` without locking, should `x` be declared volatile?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22831472
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/22831382
has body: Implementing a KeyListener doesn't mean your program is using it. You have to add it to your applet. public class Appl extends Applet implements KeyListener { @Override public void keyTyped(KeyEvent ke) { System.out.println("Pressed: " + ke.getKeyCode()); } @Override public void keyPressed(KeyEvent ke) { System.out.println("Pressed: " + ke.getKeyChar()); } @Override public void keyReleased(KeyEvent ke) { System.out.println("Pressed: " + ke.getKeyChar()); } public void init() { // YOUR CODE addKeyListener(this); } }
upvote count: 1
answers question: http://stackoverflow.com/q/22831382

hashmap
tags question: http://stackoverflow.com/q/22898596
tags question: http://stackoverflow.com/q/22928503
tags question: http://stackoverflow.com/q/22932218
tags question: http://stackoverflow.com/q/22812349
tags question: http://stackoverflow.com/q/22859830
tags question: http://stackoverflow.com/q/22827865
tags question: http://stackoverflow.com/q/22876139
tags question: http://stackoverflow.com/q/22855155
tags question: http://stackoverflow.com/q/22892556
tags question: http://stackoverflow.com/q/22927184
tags question: http://stackoverflow.com/q/22861311
tags question: http://stackoverflow.com/q/22952061
tags question: http://stackoverflow.com/q/22912066
tags question: http://stackoverflow.com/q/22867038
tags question: http://stackoverflow.com/q/22867228
tags question: http://stackoverflow.com/q/22905396
tags question: http://stackoverflow.com/q/22902835
tags question: http://stackoverflow.com/q/22918933
tags question: http://stackoverflow.com/q/22893152
tags question: http://stackoverflow.com/q/22935398
tags question: http://stackoverflow.com/q/22912859
type: Tag
tags question: http://stackoverflow.com/q/22943865
tags question: http://stackoverflow.com/q/22918109
tags question: http://stackoverflow.com/q/22813022
tags question: http://stackoverflow.com/q/22900600
tags question: http://stackoverflow.com/q/22816463
tags question: http://stackoverflow.com/q/22890967
tags question: http://stackoverflow.com/q/22812385
tags question: http://stackoverflow.com/q/22922985
tags question: http://stackoverflow.com/q/22935616
tags question: http://stackoverflow.com/q/22826326
tags question: http://stackoverflow.com/q/22944918
tags question: http://stackoverflow.com/q/22951011
tag name: hashmap
tags question: http://stackoverflow.com/q/22883256
tags question: http://stackoverflow.com/q/22810199
tags question: http://stackoverflow.com/q/22934817
tags question: http://stackoverflow.com/q/22843880
tags question: http://stackoverflow.com/q/22868170
tags question: http://stackoverflow.com/q/22827652

http://stackoverflow.com/comment/34873144
type: Comment
comment on: http://stackoverflow.com/a/22843163
has text: So *you're running the wrong code*. You've changed it from what the OP posted, so it's completely irrelevant that yours doesn't fail in the same way. Run the OP's code, you will see exactly where it fails.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/84529428
comment on: http://stackoverflow.com/a/36590400
type: Comment
has text: In which IDE can I do that?
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35004256
comment on: http://stackoverflow.com/q/22931006
type: Comment
type: QuestionComment
score: 0
has text: You keep incrementing `i` until you find either `z` or `x`, but `"Pony"` doesn't contain any of these. Now, what happens to `i`? And what happens to `letter`?

http://stackoverflow.com/a/22953466
has body: I've figured out myself. Just FYI, Apache commons' FastDateFormat seems accepting the SSS000 format and parses the time correctly.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22952618
answers question: http://stackoverflow.com/q/22952618
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/comment/35045246
has text: Well in my ´askTableInfo()´ method I do have a ´scrollPane = new JScrollPane(table);´. This could be the problem? In that case, how do I update the allready painted Scrollpane with new info?
comment on: http://stackoverflow.com/q/22953913
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35074356
score: 0
comment on: http://stackoverflow.com/a/22952836
type: Comment
has text: Yes, something is being deleted from the database.
type: AnswerComment

http://stackoverflow.com/q/22855661
has comment: http://stackoverflow.com/comment/34869212
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/22876713
has comment: http://stackoverflow.com/comment/34869328
score: 1
possible better answer: http://stackoverflow.com/a/22856520
favorite count: 0
answer count: 2
upvote count: 1
has body: <%@ta glib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> Bin UPC Code Total Tickets Balance Value Tickets Sold Total End of Life <c:forEach items="${scratchlistlotto }" var="sl"> </c:forEach> JS function Total(v) { var closingbalnce = parse Float(v); var openingbalance = document.getElementById["openingbalance"].value; var ob = document.getElementById["closingbalnce"].value; alert("hiiii "+ob); alert("closingbalnce "+openingbalance); var totalscratchtotal = parseFloat(document.name.totalscratchtotal.value); var ts = closingbalnce-openingbalance; document.name.ticketssold.value = ts; var value = parseFloat(document.name.value.value); document.name.total.value = ts *value; document.name.totalscratchtotal.value = totalscratchtotal + (ts * value); } I am displaying my list value in jsp page by using jstl tags my array list is (scratchlistlotto) i want send my opening balance into java script method when i put my closing balance in >text box please help me
tagged with: java
has comment: http://stackoverflow.com/comment/34868771
has answer: http://stackoverflow.com/a/22876713
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
has title: How do I pass list values displayed in jsp page into javascript method in java
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/22856520
has comment: http://stackoverflow.com/comment/34874078
has comment: http://stackoverflow.com/comment/34874158
type: Question

http://stackoverflow.com/q/22964717
favorite count: 0
score: 0
tagged with: constructor
type: UnansweredQuestion
has body: I am trying to write a method which adds a phone directory entry to theDirectory - an array which holds all my DirectoryEntrys. Each directory entry contains 2 strings, a name, and a telno. I was given this pseudocode to point me in the right direction: Algorithm for add if size &gt;= capacity reallocate() set theDirectory[size] to new DirectoryEntry(name, telno) increment size And this is what I came up with, however I get an error in the constructor of my new DirectoryEntry, stating it cannot find symbol, for neither name nor telno. Any help towards solving the problem would be much appreciated! My Code: private void add() { if (size &gt;= capacity) { reallocate(); } theDirectory[size] = new DirectoryEntry(name, telno); size = size +1; } }
upvote count: 1
downvote count: 1
has title: Stuck on adding to an array
type: Question
has answer: http://stackoverflow.com/a/22964780
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/22964785
tagged with: arrays

http://stackoverflow.com/comment/34991876
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22923654
has text: yes, i have searched more then 3 hrs for this. in stack OverFlow and in google too. but not able to understand.

http://stackoverflow.com/a/22878774
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22878501
score: 2
downvote count: 0
has body: There is nothing we can really tell unless you tell us what the "noticeable large amount" is, and what is the expected time. It is recommended that you start a profiler to find what logic takes most time. Some recommendations I can give from briefly reading your code is: If the result Set is going to be huge, it will involve lots of resize and rehashing when your HashSet resize. It is recommended you first allocate required size. e.g. HashSet hashSet = new HashSet&lt;String&gt;(input.size() / 3 + 1, 1.0); This will save you lots of time for unnecessary rehashing Never use exception to control your program flow. Why not simply do: int i = 0; for (int i = 0; i &lt; input.size(); i += 3) { if (i + 3 &gt; input.size()) { // substring from i to end } else { // subtring from i to i+3 } }

http://stackoverflow.com/a/22878620
answers question: http://stackoverflow.com/q/22878446
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34942920
has comment: http://stackoverflow.com/comment/34910307
type: Answer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/22878446
score: -1
has body: Start with theory: Amazon Dynamo Then there's quite a big list of distributed stores

http://stackoverflow.com/comment/35045878
score: 0
type: Comment
type: QuestionComment
has text: Either use a different JDK (NetBeans 8 does not mean you have to use Java 8) or use other libraries, e.g.: http://ucanaccess.sourceforge.net/site.html
comment on: http://stackoverflow.com/q/22954190

stack
tags question: http://stackoverflow.com/q/22943605
tags question: http://stackoverflow.com/q/22876647
tags question: http://stackoverflow.com/q/22849687
tags question: http://stackoverflow.com/q/22902275
tags question: http://stackoverflow.com/q/22883069
tags question: http://stackoverflow.com/q/22832344
tags question: http://stackoverflow.com/q/22872980
type: Tag
tag name: stack
tags question: http://stackoverflow.com/q/22875743
tags question: http://stackoverflow.com/q/22829653
tags question: http://stackoverflow.com/q/22890798

http://stackoverflow.com/a/22856499
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34869631
has comment: http://stackoverflow.com/comment/34869262
has body: Your code is an nested class. static modifier means here that this class is accessible without creating outer class object. Assuming that outer class is called OuterClass you can call: KeyEvent ke = new OuterClass.KeyEvent();
downvote count: 0
answers question: http://stackoverflow.com/q/22856452
upvote count: 2
has comment: http://stackoverflow.com/comment/34869702

http://stackoverflow.com/q/22902063
has answer: http://stackoverflow.com/a/22904782
linked to: http://stackoverflow.com/q/6578051
possible better answer: http://stackoverflow.com/a/22902248
tagged with: android
has comment: http://stackoverflow.com/comment/34951886
has comment: http://stackoverflow.com/comment/34952017
has comment: http://stackoverflow.com/comment/34951921
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22902166
tagged with: java
has comment: http://stackoverflow.com/comment/34951970
type: Question
has title: Swapping screens with button. Crashes
accepted answer: http://stackoverflow.com/a/22902166
score: 0
answer count: 3
tagged with: button
has body: I have been messing around with this for a few days now and have the code identical to that in the tutorial and yet it still doesn't want to work, Why? MainActivity.java package com.example.mdpmk1; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; public class MainActivity extends Activity { Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addListenerOnButton(); } public void addListenerOnButton() { final Context context = this; button = (Button) findViewById(R.id.scan); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(context, ScanScreen.class); startActivity(intent); } }); } } activity_main.xml <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Screen One......" android:textAppearance="?android:attr/textAppearanceLarge" /> ScanScreen.java package com.example.mdpmk1; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class ScanScreen extends Activity { Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.scan_screen); } } scan_screen.xml <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="You have done it!!" android:textAppearance="?android:attr/textAppearanceLarge" /> AndroidMainfest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Any help would be lovel…
has answer: http://stackoverflow.com/a/22902248
has comment: http://stackoverflow.com/comment/34951899

http://stackoverflow.com/q/22826357
has body: I'm trying to build a Java Bittorent client. From what I understand after peers handshake with one another they may start sending messages to each other, often sending messages sporadically. Using a DataInputStream connection I can read messages, but if I call a read and nothing is on the stream the peers holds. Is there a way I can tell if something is being sent over the stream? Or should I create a new thread that reads the stream for messages continuously from each peer until the client shuts them down shut down?
favorite count: 0
accepted answer: http://stackoverflow.com/a/22826806
has answer: http://stackoverflow.com/a/23265972
type: Question
tagged with: datainputstream
tagged with: sockets
upvote count: 1
tagged with: bittorrent
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/22826806
has answer: http://stackoverflow.com/a/23265801
possible better answer: http://stackoverflow.com/a/23265801
type: AnsweredQuestion
downvote count: 0
score: 1
has title: What's the proper way to continuously read socket messages through DataInputStream?

http://stackoverflow.com/a/22918414
type: Answer
answers question: http://stackoverflow.com/q/22918360
upvote count: 3
has body: Use an Iterator instead and use Iterator#remove method: for (Iterator&lt;String&gt; it = a.iterator(); it.hasNext(); ) { String str = it.next(); if (!str.equals("foo") || !str.equals("bar")) { it.remove(); } } From your question: messing with for iterators is not really good practice In fact, if you code oriented to interfaces and use List instead of ArrayList directly, using get method could become into navigating through all the collection to get the desired element (for example, if you have a List backed by a single linked list). So, the best practice here would be using iterators instead of using get. what is the best practice to remove items from a list efficiently? Not only for Lists, but for any Collection that supports Iterable, and assuming you don't have an index or some sort of key (like in a Map) to directly access to an element, the best way to remove an element would be using Iterator#remove.
score: 3
has comment: http://stackoverflow.com/comment/34981285
downvote count: 0
has comment: http://stackoverflow.com/comment/34981351

http://stackoverflow.com/a/22953115
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22948156
type: Answer
has body: Since all you need is a notification on a timer, the AlarmManager would be the best way to go. If you used Push Notifications(GCM), that would require server side code and a method to store the device id to send the notification to. Overkill if you ask me. Here are links to the official documentation and example code: Official documentation Vogella's example on services
accepted answer of: http://stackoverflow.com/q/22948156
score: 0

http://stackoverflow.com/comment/50478774
comment on: http://stackoverflow.com/a/24005684
type: Comment
has text: @masterdany88 I updated my answer with files from an older Play 2.2.2 project. Hopefully they help.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22912122
answers question: http://stackoverflow.com/q/22911705
score: 0
has body: Why not use Embedded Derby? It's platform independent, uses standard JDBC, and writes files which are accessible across any platform. http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html There's no reason why you cannot use JDBC in a standalone java application incidentally. Think of JDBC as a kind of socket you can plug into, but what's behind that socket is entirely implementation specific, and usually can be defined by configuration. JCR is another good example of this, but this kind of engineering technique is plentiful in the Java universe.
type: Answer

http://stackoverflow.com/comment/35093424
score: 0
comment on: http://stackoverflow.com/q/22963793
type: Comment
type: QuestionComment
has text: Ok, I found why I had this error.I have to include JUnit.jar in my project additionally to install pluging JUnit using Eclipse tools.

http://stackoverflow.com/a/22872249
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22872004
type: Answer
has body: Aside from everything else, the most fundamental problem you've got here is that you're converting binary data to a string just using the platform default encoding, as if it's actually just text. It's not - it's binary data. If you want one line of text per encrypted input, that's fine - but you need to convert the binary data to text as base64 or something similar. Never, ever, ever treat arbitrary binary data (encrypted data, compressed data, image data, music data... basically anything other than text) as if it's just encoded text. Even when you do have encoded text, specify the encoding explicitly. Fix that - and stop using BufferedReader.ready(), preferring to call readLine() and terminate when it returns null - and you'll be in a better position. Fix the exception handling too, of course. See my blog post about reversible transformations for more information about diagnosing this sort of thing, and Marc Gravell's post about IO for more about IO bugs.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34898464
answers question: http://stackoverflow.com/q/22872004

http://stackoverflow.com/a/22932670
has body: try something like: /** returns minLatitude, maxLatitude, minLongitude, maxLongitude */ public double[] calculateMinMaxValues(double latitude , double longitude, double radius){ double[] res = new double[4]; res[0] /*minLatitude*/ = latitude - (radius*2)/60.0; res[1] /*maxLatitude*/ = latitude + (radius*2)/60.0; res[2] /*minLongitude*/ = (longitude*2)/60.0 *(Math.cos(res[0])); res[3] /*maxLongitude*/ = (longitude*2)/60.0 *(Math.cos(res[1])); return res; }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22929748
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22929748

http://stackoverflow.com/comment/35006213
type: Comment
comment on: http://stackoverflow.com/a/22930660
has text: Then `systemProperties` is a built-in bean from some Framework, as `integrationGlobalProperties` is from Spring Integration. One of your bean has `setProperties` and if it is autowired `byType` you end up with that ambiguity issue.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22858434
tagged with: swing
answer count: 1
tagged with: sudoku
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34872784
has body: I have a problem with threads... I manage to start the thread and the program does what it is supposed to, but it does not start til the main painting i the gui has started. So here it my code; public void getFile() { Runnable r = new Runnable() { public void run() { viewTimeBar(); } }; try { JFileChooser fileChooser = new JFileChooser(); int returnVal = fileChooser.showOpenDialog(this); if(returnVal == JFileChooser.APPROVE_OPTION) { runSudoku = new RunSudoku(fileChooser.getSelectedFile().getName(), 0); } if(runSudoku.boardSize &gt; 8) { r.run(); } runSudoku.runBoard(); printBoard(runSudoku.sudokuBoard, 0); getNextSolution.setText("Solutions: " + (runSudoku.validBoards.size()) + ", press get solution"); getSolution.setEnabled(true); } catch(Exception e) { printError(); } } public void viewTimeBar() { if(sudokuPanel != null) { remove(sudokuPanel); } JPanel timer = new JPanel(); JLabel pleaseWait = new JLabel("Please wait while we try to find solutions!", SwingConstants.CENTER); timer.add(pleaseWait, BorderLayout.NORTH); JProgressBar progressBar = new JProgressBar(); progressBar.setSize(10, 400); progressBar.setIndeterminate(true); progressBar.setStringPainted(true); timer.add(progressBar, BorderLayout.CENTER); timer.setVisible(true); add(timer, BorderLayout.SOUTH); validate(); } The runnable shoud start viewTimeBar if board size is bigger than 8, but it does not paint til printBoard method runs. Anyone who can help me out? Kind regards, Henning
has comment: http://stackoverflow.com/comment/34872641
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/34872774
has title: Problems with new thread in gui
has answer: http://stackoverflow.com/a/22858568
tagged with: multithreading

http://stackoverflow.com/q/22903448
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35005861
type: Question
has body: I want to serialize a complex Java object throw Internet. First time, I used Google Gson to serialize the class. Gson offers an easy way to serialize object into JSON string and deserialize from JSON string to object via toJson and fromJson. However, JSON string is not so compact and introduce large overhead when serialize byte[] array. I am reading Google Protocol Buffer. According to the tutorial, Users have to write .proto file for each message manually. It seems to that Protocol Buffer could not recognize user-defined-class (Google protocol buffers - user defined java objects as messages fields). I have 2 questions: Does protocol buffer know built-in Java-defined class such as BigDecimal, BigInteger,…? If we have a complex class which recursively has other user-defined classes as members, do we need to travel all classes’ definition and declare them as message which their filed in .proto file? If so, It is very terrible for user (and maybe they use some external java library and do not have source code of defined classes in that library) Is there a tool to automatically traverse the Java class and generate .proto?
score: 5
accepted answer: http://stackoverflow.com/a/22992297
answer count: 1
downvote count: 0
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/22992297
upvote count: 5
tagged with: protocol-buffers
linked to: http://stackoverflow.com/q/10230093
has title: Generate .proto file for complex Java object
has comment: http://stackoverflow.com/comment/34954803
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35005347
score: 1
comment on: http://stackoverflow.com/a/22931459
type: AnswerComment
has text: "This definition of equals() is not transitive." I think this is the actual issue with any implementation like this. `equals` needs to be transitive to make any implementation of `hashCode()` make sense beyond `return 0;`.
type: Comment

http://stackoverflow.com/comment/34849320
has text: ill just try to figure it out.. thanks for the help.
score: 0
comment on: http://stackoverflow.com/q/22845480
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22809526
favorite count: 0
has comment: http://stackoverflow.com/comment/34824455
has comment: http://stackoverflow.com/comment/34785262
type: UnansweredQuestion
has title: ListView with Spinner Inside: 1st Item of the listview affects its last item
tagged with: android
has comment: http://stackoverflow.com/comment/34785002
score: 2
has body: I had this weird scenario where every time I select a value from the spinner in the ListView's 1st Item, the last ListView'sitem its spinner value is the same as the first item. This will only happen when the total number of ListView items is 5 and above. I commented out the codes and retain just the declarations and it's still happening. Is this a bug in Android? Clarifications: My ListView's Scroll Listener is empty My spinner's setOnItemSelectedListener is commented out. Android SDK Tool version is 22.6.2 Android SDK Platform-Tools is 19.0.1 Here's the adapter code: @Override public View getView(final int position, View convertView, final ViewGroup parent) { Viewholder v = new Viewholder(); v.rowView = convertView; LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (v.rowView == null) { v.rowView = inflater.inflate(R.layout.inner_base_header_cutom, parent, false); v.spinner = (Spinner) v.rowView.findViewById(R.id.spinner1); v.rowView.setTag(v); } else { v = (Viewholder) v.rowView.getTag(); } return v.rowView; } ViewHolder: class Viewholder{ View rowView; TextView itemPID; TextView itemPrice; TextView itemItemId; Spinner spinner; TextView subtotal; } XML: <Spinner android:id="@+id/spinner1" android:layout_width="100dip" android:layout_height="wrap_content" android:layout_margin="20dip" android:entries="@array/quanitiy" android:layout_alignTop="@+id/itemPrice" android:layout_toRightOf="@+id/imageDisplay" /> Array: Quantity 1 2 3 4 5 6 7 8 9 10 UPDATE I commented out the code for OnItemClickListner. I updated the code above, still the problem exists. The only thing left is the declarations. Scenario: If I select 1 at the first item of the spinner [index 0] of the ListView, the last item of ListView's spinner gets also 1 without interaction. When down the listview's items until the last part, that's where I found out that they are both the same. I commented out the codes and just retained the declarations.
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22831872
has comment: http://stackoverflow.com/comment/34784862
has comment: http://stackoverflow.com/comment/34785545
has comment: http://stackoverflow.com/comment/34827538
type: Question
has comment: http://stackoverflow.com/comment/34826002
has comment: http://stackoverflow.com/comment/34785707
tagged with: android-arrayadapter
linked to: http://stackoverflow.com/q/11945563
linked to: http://stackoverflow.com/q/38550046
tagged with: android-spinner
has comment: http://stackoverflow.com/comment/34785460
has comment: http://stackoverflow.com/comment/34785852
upvote count: 2
has comment: http://stackoverflow.com/comment/64491787
has comment: http://stackoverflow.com/comment/34784672
answer count: 1
has comment: http://stackoverflow.com/comment/34796679

http://stackoverflow.com/a/41778245
upvote count: 2
has comment: http://stackoverflow.com/comment/101343600
answers question: http://stackoverflow.com/q/22959459
type: Answer
score: 2
downvote count: 0
has body: I got the same issue in my Spring Boot application. It turned out that I was compiling without my debug symbols information, as it is mentioned in a comment above. I would like to remark that I could fix the issue in two ways: 1.(My favourite one): Just include this in your pom.xml --> plugins org.apache.maven.plugins maven-compiler-plugin -parameters -parameters If you are using Java 1.8 and Eclipse as an IDE, go to your Project Properties --> Java Compile --> check "Store information about method parameters (usable via reflection)". I found really interesting this link to know more about the issue. Hope it helps!

http://stackoverflow.com/comment/34859316
type: QuestionComment
comment on: http://stackoverflow.com/q/22850587
score: 0
has text: this is the only clue i got @ᴋᴇʏsᴇʀ from Netbeans
type: Comment

http://stackoverflow.com/comment/34937277
type: AnswerComment
score: 0
type: Comment
has text: int success = json.getInt("TAG_SUCCESS"); after this all Tag Strings become wrong
comment on: http://stackoverflow.com/a/22893648

http://stackoverflow.com/comment/36768732
type: AnswerComment
comment on: http://stackoverflow.com/a/22959219
score: 0
type: Comment
has text: Point 1: If your application normally has 10 messages in flight but can have a traffic burst which means that it has 20 messages in flight then you would want to make your buffer >= 30 so that the slow consumer has a chance to clear the backlog. As for Chronicle I'd imagine you would use it to replace the disruptor rather than in addition to it, but thats for you to decide from its documentation.

http://stackoverflow.com/comment/35057474
score: 0
has text: Can't you simply move the generation of "HELLO" to common component both servlets would use?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22961067

http://stackoverflow.com/a/22914239
type: Answer
has body: Consider changing this code @Override public void actionPerformed(ActionEvent e) { this.setVisible(false); new Client().setVisible(true); } to this: @Override public void actionPerformed(ActionEvent e) { Client charlie = new Client("127.0.0.1"); //Server IP Address would be placed here, where not localhost.charlie.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //ensures process closes when 'X' is clicked charlie.setVisible(true); charlie.startRunning(); }
answers question: http://stackoverflow.com/q/22908883
score: 0
has comment: http://stackoverflow.com/comment/34973699

http://stackoverflow.com/comment/34902570
score: 0
type: Comment
has text: You will have to pass the pannel as a parameter to your new class. it is good to make an other class so your code seems more readable. just pass it to the constructor and you will be able to use it
comment on: http://stackoverflow.com/a/22869216
type: AnswerComment

http://stackoverflow.com/q/22852089
tagged with: split
tagged with: substring
has answer: http://stackoverflow.com/a/22852225
score: 0
answer count: 2
tagged with: string
has answer: http://stackoverflow.com/a/22852144
has body: I am trying to solve this in Java. I have a long string of information and I want to split the string based on the length of the fields given. Example: `FirstNameLastName yy-mm-dd549Eastwolframstreet I have a list of fields given along with its length. There are n number of fields. example fields: FirstName length: 9 LastName length: 9 Date length: 8 Address: 30 If the name is less than 9 characters spaces occupy the remaining positions. i.e Lastname is length 9 but there are only 8 letters remaining one is a space. What is the best way to extract those fields from each of its given length?
has title: Split the string at various index position
possible better answer: http://stackoverflow.com/a/22852144
accepted answer: http://stackoverflow.com/a/22852225
tagged with: regex
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/22885751
tagged with: event-dispatch-thread
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34922696
tagged with: serversocket
tagged with: java
has answer: http://stackoverflow.com/a/22887235
has answer: http://stackoverflow.com/a/22886454
tagged with: swing
type: Question
tagged with: actionlistener
has title: method inside a thread does not get called
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34922408
has body: The method serverinititaor().initialize(5555) in serverinitiator class is not getting called in following code. This method will launch a new frame for client on port 5555 for some function like send message or chat purpose. public static void main(String[] args) { new Thread(new Runnable() { public void run() { frame = new JFrame("client list"); panel = new JPanel(); JButton button = new JButton("Refresh Client list"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { if(success){ JButton jb = new JButton("A new Client on port 5555"); jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new ServerInitiator().initialize(5555); } }); panel.add(jb); frame.revalidate(); } }).start(); } ServerInitiator.java synchronized public void initialize(int port){ try { final ServerSocket sc = new ServerSocket(port); System.out.println(SwingUtilities.isEventDispatchThread()); drawGUI(); new Thread(new Runnable(){ public void run() { try { Socket client = sc.accept(); System.out.println("New client Connected to the server"); new ClientHandler(client,desktop); } catch (IOException ex) { } } }).start(); } catch (IOException ex) { ex.printStackTrace(); } } Please reply. Thanks.

http://stackoverflow.com/comment/34871349
has text: Hi, thanks a lot for a detailed answer. I kind of got it figured out after your initial answer, before you edited in the whole code, but thanks for taking your time to do it, I get it now much better :). needless to say it now works. Thank you!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22857510

http://stackoverflow.com/a/59769241
type: Answer
has body: You can do so by using this library I've created: https://github.com/LikeTheSalad/android-stem it will concatenate all of you strings you want to based on a template string you define, and then it generates a final XML string at build time. So for your case, you can define your strings like so: Add self-hosted site The username or password you entered is incorrect \- If you\'re a self hosted user, don\'t forget to tap ${nux_add_selfhosted_blog} and fill the URL field And then after building your project, the following string will be generated: The username or password you entered is incorrect \- If you\'re a self hosted user, don\'t forget to tap Add self-hosted site and fill the URL field The tool will keep this auto-generated string updated for any changes you make to the template and or the values. More info on the repo's page.
score: 0
answers question: http://stackoverflow.com/q/22828986

http://stackoverflow.com/comment/34962626
type: Comment
comment on: http://stackoverflow.com/a/22907725
score: 0
has text: @HakHak check this https://developer.android.com/tools/support-library/setup.html
type: AnswerComment

http://stackoverflow.com/comment/35006431
type: Comment
has text: okay so i directly can convert it into ConcurrentHashMap etc.. without creating a new object of ConcurrentHashMap ...is it ?
type: AnswerComment
comment on: http://stackoverflow.com/a/22932335
score: 0

windowbuilder
tags question: http://stackoverflow.com/q/22962829
tag name: windowbuilder
tags question: http://stackoverflow.com/q/22949455
type: Tag

http://stackoverflow.com/q/22845492
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
has answer: http://stackoverflow.com/a/22846260
has comment: http://stackoverflow.com/comment/34849679
has comment: http://stackoverflow.com/comment/34849295
has body: i have searched for different compression algorithms for java, and i finally set my mind on the the deflate algorithm that is already included in the java SDK. When i started it worked fine with text files, but it didn't do much compression size wise with other type of files like (JPG,etc.), also there is no much difference when i change the compression level. What i need is a library that will compress all files with a notable file size decrease. Is what i am looking for even exists?? Thanks in advance :)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34850012
tagged with: java
tagged with: compression
has comment: http://stackoverflow.com/comment/34849903
downvote count: 1
accepted answer: http://stackoverflow.com/a/22846260
has comment: http://stackoverflow.com/comment/34849610
type: Question
has comment: http://stackoverflow.com/comment/34850196
has title: Can someone point me to a Java library that actually compresses files, with a notable size difference?
score: -1
has comment: http://stackoverflow.com/comment/34849363
upvote count: 0

http://stackoverflow.com/comment/34879218
has text: `x` doesn't have to be volatile, but `lock` must be final for sanity.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22862226

http://stackoverflow.com/a/22915530
type: Answer
has body: First, why do you think you'll get a StackOverflowException? The array will be stored on the heap(the reference will be on the stack). Second, GC is smart enough to clean memory in both cases. Actually as soon as the reference is not needed, Garbage Collector can recall the memory (it can recall memory, while being still in method.)
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22914783
upvote count: 1
has comment: http://stackoverflow.com/comment/35009712

http://stackoverflow.com/a/22835014
has comment: http://stackoverflow.com/comment/34831357
has comment: http://stackoverflow.com/comment/34832555
has comment: http://stackoverflow.com/comment/34830843
answers question: http://stackoverflow.com/q/22834774
has comment: http://stackoverflow.com/comment/34830538
score: 0
type: AcceptedAnswer
has body: First of all, change class name to correct format: Sample1 and make sure that file name is Sample1.java. XML should be: <Class name="Sample1" /> TestNG automatically detect test methods because You annotated them :) .
type: Answer
accepted answer of: http://stackoverflow.com/q/22834774

http://stackoverflow.com/comment/35071742
has text: @DejanLekic, that is NOT the way to build a GUI. You should be using layout managers. You should not need to know the height of any component in advance. The approach to your problem seems incorrect and you still haven't stated a requirement.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22967658

http://stackoverflow.com/a/22968680
answers question: http://stackoverflow.com/q/22955879
type: Answer
score: 0
has body: If the pattern of renaming your files is always the same then using AutoIt could be a fast and easy solution.

http://stackoverflow.com/q/22922997
has answer: http://stackoverflow.com/a/75651370
answer count: 4
score: 8
has answer: http://stackoverflow.com/a/36013606
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34990247
tagged with: java
has body: Is there any way to convert a WebElement type object to a By in selenium? Type casting did not work. I have a function which only takes in By's, so I need to convert a WebElement to a By.
tagged with: selenium
has title: Converting a WebElement type to a By type
type: Question
has comment: http://stackoverflow.com/comment/34994410
has answer: http://stackoverflow.com/a/38225173
accepted answer: http://stackoverflow.com/a/36013606
possible better answer: http://stackoverflow.com/a/69097961
has answer: http://stackoverflow.com/a/69097961
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35005228
has comment: http://stackoverflow.com/comment/47156907
upvote count: 8
has comment: http://stackoverflow.com/comment/34990295

http://stackoverflow.com/comment/90037172
score: 3
has text: *"Important to note that we need to pass "false" when calling getContext, as otherwise it seems not to be getting the same context as slf4j."* Ah, this is really crucial here!
comment on: http://stackoverflow.com/a/38774931
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22838584
answers question: http://stackoverflow.com/q/22838512
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22838512
type: Answer
downvote count: 0
score: 1
has body: The notion of page doesn't exist in a text file encoded in either ASCII or UTF8. If you are working with an output format where the pages notion exists such as word, you'll have to know the internal of this output format to know when a page has been written. As @Starscream1984 said in a comment, in words for example this depends on formatting like margins and font size.

http://stackoverflow.com/a/22931044
has comment: http://stackoverflow.com/comment/35004657
has comment: http://stackoverflow.com/comment/35005123
has comment: http://stackoverflow.com/comment/35004456
score: 0
has comment: http://stackoverflow.com/comment/35004373
has body: It's this for(int j = 0; j &lt;= columns; j++) { figures[j] = new double[j] ; } I think you meant actually figures[t] = new double[columns];
type: Answer
has comment: http://stackoverflow.com/comment/35004529
answers question: http://stackoverflow.com/q/22930814

http://stackoverflow.com/q/22829150
tagged with: qsub
score: 1
tagged with: hpc
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22848815
has answer: http://stackoverflow.com/a/22845431
has body: I would like to submit a job in the hpc and the job is running a java application. I edit the pbs_script files as following: #/bin/sh #PBS -q serial #PBS -l nodes=1:ppn=4 module load java-jdk/1.7.0-17 java myjavapp I submitted the job $qsub pbs_script however the job return a error: could not find or load main class myjava. but I use the same command to run the java program under the command-line. what is the problem?
downvote count: 0
has title: how to use qsub to implement a java program
answer count: 3
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/34194305
type: UnansweredQuestion

http://stackoverflow.com/comment/34893520
type: Comment
has text: How is the array that you're trying to find the minimum & maximum values of getting into your code? Is this part of a program that interrogates the user for values? And more importantly, is that array actually a member of the `ScanArray` class? Whether it is or not will affect what the best way to fix this error is.
comment on: http://stackoverflow.com/q/22869940
score: 0
type: QuestionComment

http://stackoverflow.com/a/22895463
score: 2
downvote count: 0
has body: In fact, JIT eliminates the check of test field in the loop. Though it seems JIT is not smart enough to throw away the loop itself when the type of data differs from the type of loop index i: 0x000000000222f570: inc %ebx ; OopMap{rbp=Oop off=178} ;*goto ; - RemoveJump::testLoop@82 (line 28) 0x000000000222f572: test %eax,-0x20ff578(%rip) # 0x0000000000130000 ;*iload ; - RemoveJump::testLoop@20 (line 28) ; {poll} 0x000000000222f578: movslq %ebx,%r10 0x000000000222f57b: cmp %r14,%r10 0x000000000222f57e: jl 0x000000000222f570 If you change getData() to return int, the optimization will work, and there will be no loop at all in the result assembly. However your test case will not reveal the optimization effect, because the loop starts executing in the interpreter mode, gets compiled in the middle of execution (while being inside the loop), so even after the compilation the execution remains inside the loop. But if you invoke your testLoop() several times, you'll see that the further invocations of the method will instantly print the result without going through the loop: for (int i = 1; i &lt;= 5; i++) { System.out.println("Run #" + i); RemoveJump.getInstance().testLoop(); } Run #1 1897 0 Run #2 1895 0 Run #3 0 0 Run #4 0 0 Run #5 0 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22890760
answers question: http://stackoverflow.com/q/22890760
type: Answer

http://stackoverflow.com/a/22831729
type: Answer
answers question: http://stackoverflow.com/q/22831641
score: 0
has body: Just go for multiple catch rather than using instance of Java supports multiple catch statements for a reason, as of Java 7 you can even use a 'multicatch' like this: try { ... } catch (IOException | OtherException | MyException e) { ... } More information :- http://baptiste-wicht.com/posts/2010/05/better-exception-handling-in-java-7-multicatch-and-final-rethrow.html http://tutorials.jenkov.com/java-exception-handling/catching-multiple-exceptions.html

http://stackoverflow.com/comment/35007372
has text: Should after `9` be `10` or `0`, or maybe such case can't exists?
comment on: http://stackoverflow.com/q/22931991
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34868069
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22841156
has text: Would look forward to your response. The only reason i am required to send xml as html form parameter is that there are other non-xml type parameters also along with the xml which cant be included within the xml.

http://stackoverflow.com/q/22835093
tagged with: smtp
has title: Couldnot connect to smtp.gmail.com at port 465
has comment: http://stackoverflow.com/comment/34830719
has comment: http://stackoverflow.com/comment/34830511
tagged with: gmail
has comment: http://stackoverflow.com/comment/34830818
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/54707891
has comment: http://stackoverflow.com/comment/34830573
type: Question
has comment: http://stackoverflow.com/comment/34830629
has body: I am developing an application in which i have to send mail through java code. I am using smtp.gmail.com as server and port 465(also tried 25 and 567). The same code is running well on my friend's system. But in my system, it is showing exception. Even telnet smtp.gmail.com 465 is not getting connected.help please
tagged with: java
has comment: http://stackoverflow.com/comment/34830478
score: 0
has comment: http://stackoverflow.com/comment/34830571
answer count: 1

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

http://stackoverflow.com/q/22828555
has comment: http://stackoverflow.com/comment/34819155
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35043930
tagged with: jsp
has comment: http://stackoverflow.com/comment/34819170
favorite count: 0
has comment: http://stackoverflow.com/comment/34852426
has comment: http://stackoverflow.com/comment/34861574
has comment: http://stackoverflow.com/comment/34852481
type: AnsweredQuestion
tagged with: cookies
score: 1
has title: Passing values using cookies
tagged with: java
has body: in my servlet.java I've declared a cookie, String loc = "Some random data"; Cookie thecookie = new Cookie("thecookie", loc); response.addCookie(thecookie); Later after performing some file upload stuff I am setting a value to this cookie again, fileTxt = FileUtils.readFileToString(uploadedFile); thecookie.setValue(fileTxt); RequestDispatcher rd = request.getRequestDispatcher("thejsppage.jsp"); rd.forward(request, response); Now in my jsp page as redirected above, &lt;% Cookie[] my = request.getCookies(); for(int i=0;i&lt;my.length;i++){ String filetext = my[i].getValue().toString(); } %&gt; &lt;div id="editor"&gt;&lt;%=filetext %&gt;&lt;/div&gt; But this is returning a garbage value, what is my mistake? How do I pass values using cookies? I do not want to use request.setAttribute("name", value); method.
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35029453
has answer: http://stackoverflow.com/a/23006509
accepted answer: http://stackoverflow.com/a/23006509

http://stackoverflow.com/a/22952836
has body: Try invoking notifyDataSetChange() from exampleListView.post() like this: exampleListView.post(new Runnable() { public void run() { exampleAdapter.notifyDatasetChange(); } }
has comment: http://stackoverflow.com/comment/35043627
answers question: http://stackoverflow.com/q/22952741
has comment: http://stackoverflow.com/comment/35059461
has comment: http://stackoverflow.com/comment/35074356
score: 0
has comment: http://stackoverflow.com/comment/35062488
has comment: http://stackoverflow.com/comment/35059058
type: Answer

http://stackoverflow.com/comment/35030934
type: QuestionComment
comment on: http://stackoverflow.com/q/22945694
has text: What is the difference between these? "1. My first approach is to accept an object at default constructor level and run associated methods on it." "2. Second approach is to accept object thru a constructor and run methods on it." Besides the phrase "at default constructor level" these sentences are the same. What do you mean by this phrase and how does it differentiate the two?
score: 0
type: Comment

http://stackoverflow.com/q/22963865
type: UnansweredQuestion
has body: I have created a jar file in java , the problem is when ever the system gets restart i need to manually run the jar file so i have decided to convert my jar file to a windows service . if anyone knows please help me out
has comment: http://stackoverflow.com/comment/35062744
has answer: http://stackoverflow.com/a/22964027
upvote count: 0
favorite count: 0
has title: how to convert an executable java jar file to an window service
type: Question
linked to: http://stackoverflow.com/q/68113
score: -2
duplicate of: http://stackoverflow.com/q/68113
tagged with: java
downvote count: 2
answer count: 1

http://stackoverflow.com/q/22965626
has comment: http://stackoverflow.com/comment/35066001
has body: When I create an activity using the fullscreen activity wizard it creatres a fullscreen activity that whenever I click anywhere on the screen the status bar and navigation/system bar shows for a few seconds and hide again.now I want to know How can I change it to hide/show on long click? If my question is in low level please don't minus it. Thanks the code is too long sorry for that and thanks for considration: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#0099cc" tools:context=".FullscreenActivity" &gt; &lt;!-- The primary full-screen view. This can be replaced with whatever view is needed to present your content, e.g. VideoView, SurfaceView, TextureView, etc. --&gt; &lt;TextView android:id="@+id/fullscreen_content" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:keepScreenOn="true" android:text="@string/dummy_content" android:textColor="#33b5e5" android:textSize="50sp" android:textStyle="bold" /&gt; &lt;!-- This FrameLayout insets its children based on system windows using android:fitsSystemWindows. --&gt; &lt;FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" &gt; &lt;LinearLayout android:id="@+id/fullscreen_content_controls" style="?buttonBarStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" android:background="@color/black_overlay" android:orientation="horizontal" tools:ignore="UselessParent" &gt; &lt;Button android:id="@+id/dummy_button" style="?buttonBarButtonStyle" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/dummy_button" /&gt; &lt;/LinearLayout&gt; &lt;/FrameLayout&gt; &lt;/FrameLayout&gt; the java code, these are three uti…
has title: How to make personalize fullscreen activity of android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22996073
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22996073
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35066122
answer count: 1

http://stackoverflow.com/comment/79468628
has text: setPreferedSize must be setPreferredSize and (width, height) must be (new Dimension(width, height))
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22920121

http://stackoverflow.com/a/22828898
type: Answer
accepted answer of: http://stackoverflow.com/q/22828752
answers question: http://stackoverflow.com/q/22828752
score: 0
type: AcceptedAnswer
has body: First learn about sessions. Sessions start when your website is opened in a particular browser and is carried on with different tabs in the same browser. A new session will be created only if it expires after certain tiemout or if the browser is closed. Sessions are specific to browser and not tabs.

http://stackoverflow.com/a/22858075
has comment: http://stackoverflow.com/comment/34872426
has comment: http://stackoverflow.com/comment/34874071
has body: Move stage.draw() out of the batch.begin() and batch.end(). Furthermore in case you are using the latest nighty build of libgdx, you should add stage.getViewport().update(width, height, true) to your resize(...) method. Furthermore you are doing this titleSprite.setColor(1,1,1,0) which sets the alpha of the background sprite to 0 which means 100% transparent = invisible. Do this instead: titleSprite.setColor(1,1,1,1). In total your render should look like this: batch.begin(); titleSprite.draw(batch); batch.end(); stage.act(delta); stage.draw();
has comment: http://stackoverflow.com/comment/34872355
has comment: http://stackoverflow.com/comment/34872611
accepted answer of: http://stackoverflow.com/q/22857985
score: 1
has comment: http://stackoverflow.com/comment/34873230
answers question: http://stackoverflow.com/q/22857985
has comment: http://stackoverflow.com/comment/34872846
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34874205
type: Answer
has comment: http://stackoverflow.com/comment/34872275
upvote count: 1

http://stackoverflow.com/comment/34890133
has text: @MightyPork don't think its possible to delete now that you have answers
comment on: http://stackoverflow.com/q/22868074
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35057668
type: Comment
has text: Do you want to say a few words about why 2048M specifically?
type: AnswerComment
comment on: http://stackoverflow.com/a/22961246
score: 0

http://stackoverflow.com/a/22945187
has body: I think the JLabel approach would be undesirable, I think one component with custom painting would be more desirable, because it seems a bit easier. If you have your classes in that abstract format not tied to the UI or anything (so playable even on the command line where you could output in a text a representation of the board), then it should be simple to loop through the spaces representing the board and make the small set of drawing calls to draw each slot (empty or not). Seems better to if you wanted to introduce animations like pieces falling down and then bumping up for a while when they hit the piece below it.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22944919
upvote count: 1
has comment: http://stackoverflow.com/comment/35030168
has comment: http://stackoverflow.com/comment/35029833
score: 1
has comment: http://stackoverflow.com/comment/35030100

http://stackoverflow.com/q/22810806
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/53664174
upvote count: 5
tagged with: arrays
has comment: http://stackoverflow.com/comment/34787242
score: 4
has answer: http://stackoverflow.com/a/22811099
answer count: 3
has answer: http://stackoverflow.com/a/22810987
has body: Following is the problem- Given an array of integers as input, return an array that contains the same numbers as that in the input array, but rearranged so that all the even numbers are in front and the odds numbers are at the back. Note that the order of the even numbers and odd numbers should be maintained i.e. if an even number n1 that appears before an even number n2 in the input, then in the output array n1 should appear before n2. The same is true for odd numbers. Also note that in this problem you should not create any new array. What is done so far is as follows but I am unable to get the expected output. public class MoveEvenToFront { static int[] testcase1 = {3, 5, 4, 6, 8, 9, 7, 10}; public static void main(String[] args) { MoveEvenToFront testInstance = new MoveEvenToFront(); int[] result = testInstance.moveEvenToFront(testcase1); System.out.print("{"); for (int i = 0; i &lt; result.length; i++) { if (i &gt; 0) { System.out.print(","); } System.out.print(result[i]); } System.out.print("}"); } public int[] moveEvenToFront(int[] arr) { int temp = 0; for (int i = 1; i &lt; arr.length; i++) { if (arr[i - 1] % 2 != 0) { temp = arr[i - 1]; arr[i - 1] = arr[i]; arr[i] = temp; } } return arr; } } The expected output for testcase {1,2,3,4,5,6,7,8,10,12} is {2,4,6,8,10,12,1,3,5,7}.
possible better answer: http://stackoverflow.com/a/22811099
favorite count: 0
has title: How can I move all even numbers to front in an array?
accepted answer: http://stackoverflow.com/a/22810987
type: AnsweredQuestion

http://stackoverflow.com/comment/34965108
comment on: http://stackoverflow.com/a/22908203
type: Comment
has text: I have removed the type parameter in the answer. Sadly, generics are not supported by the Restlet converter, but it should work anyway.
score: 0
type: AnswerComment

private-members
tags question: http://stackoverflow.com/q/22837923
tag name: private-members
type: Tag

http://stackoverflow.com/a/22809431
downvote count: 0
has comment: http://stackoverflow.com/comment/34834667
has body: Use Collections.shuffle(YOUR_ARRAY_LIST); to do it. List&lt;String&gt; ranList = new ArrayList&lt;String&gt;(); // populate the list ranList.add("A"); ranList.add("B"); ranList.add("C"); System.out.println("Initial collection: " + ranList); // shuffle the list Collections.shuffle(ranList); System.out.println("Final collection after shuffle: " + ranList); The way of approach for manual sorting goes like this: Read and add your data from file to Map private static Map&lt;String, String&gt; readFile(String fileNameWithPath) throws Exception { Map&lt;String, String&gt; map = new LinkedHashMap&lt;String, String&gt;(); File file = new File(fileNameWithPath); BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); String sCurrentLine; String[] splitPosition; while ((sCurrentLine = bufferedReader.readLine()) != null) { splitPosition = sCurrentLine.split("~"); map.put(splitPosition[0], splitPosition[1]); } return map; } And your main method is like: try { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); List&lt;String&gt; customeRandomList = new LinkedList&lt;String&gt;(); list.add("A"); list.add("B"); list.add("C"); list.add("D"); list.add("E"); Map&lt;String, String&gt; map = Test.readFile("D://RandomList.txt"); for (Map.Entry&lt;String, String&gt; entry : map.entrySet()) { customeRandomList.add(list.get(Integer.parseInt(entry.getValue()))); } for (String result : customeRandomList) { System.out.println(result); } } catch (Exception e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/34834743
type: Answer
score: 7
has comment: http://stackoverflow.com/comment/34786662
upvote count: 7
has comment: http://stackoverflow.com/comment/34785027
answers question: http://stackoverflow.com/q/22809348
has comment: http://stackoverflow.com/comment/34831071

http://stackoverflow.com/a/22903912
has comment: http://stackoverflow.com/comment/34958650
has comment: http://stackoverflow.com/comment/34958184
has comment: http://stackoverflow.com/comment/34958580
has comment: http://stackoverflow.com/comment/34959218
has comment: http://stackoverflow.com/comment/34957705
has comment: http://stackoverflow.com/comment/34958867
has comment: http://stackoverflow.com/comment/34959332
has comment: http://stackoverflow.com/comment/34958846
has comment: http://stackoverflow.com/comment/34958234
has comment: http://stackoverflow.com/comment/34958556
score: 0
has body: U can do one thing that Compare both thing if(COMPLETEDATE != null || !("".equals(COMPLETEDATE.trim()))) { css.setString(intlength, xyz); } else { css.setString(intlength, "Stringdate"); } May this will help. and if u Taking loop then try this. if(country[23] != null &amp;&amp; !(country[23].equals(""))){ // set your date code }else{ // set String date }
has comment: http://stackoverflow.com/comment/34958784
has comment: http://stackoverflow.com/comment/34958643
type: Answer
answers question: http://stackoverflow.com/q/22903465
has comment: http://stackoverflow.com/comment/34957318
has comment: http://stackoverflow.com/comment/34959428

http://stackoverflow.com/comment/34865680
has text: Are you sure your `ajax` is setup with `GET`?
comment on: http://stackoverflow.com/q/22854419
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34965224
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22909261
has text: @Ayoshna Yes, after that it should be obvious when an error should be raised, e.g. you want to add but there is only one operand: `1+`

http://stackoverflow.com/comment/34892788
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22868354
type: Comment
has text: Of course, every uncaught exception killing process and VM dying too. This method will work only in manually created threads, not in main.

documentlistener
tags question: http://stackoverflow.com/q/22883951
tags question: http://stackoverflow.com/q/22902247
tag name: documentlistener
type: Tag

http://stackoverflow.com/q/22862255
tagged with: jaxb
has title: Specifying jaxb version to wsgen
type: Question
has comment: http://stackoverflow.com/comment/34881076
tagged with: jaxb2
score: 0
linked to: http://stackoverflow.com/q/7232331
has body: I'm suffering from the same error as this question, but I can't use that answer since I'm not using Maven, so I'm stuck on how to specify what version of jaxb to use with wsgen. I'm downloaded the 2.2.7 jars and added them to my classpath, but my generated files still say that they've been generated using 2.2.4b1, which I presume was included in the JDK. Anybody know how to specify to wsgen what jaxb version I want to use?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34881453
answer count: 0
tagged with: java

http://stackoverflow.com/comment/35355843
type: Comment
has text: @GamerJosh i possibly make question easy now
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22966155

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

http://stackoverflow.com/comment/88061645
has text: I used Hibernate
comment on: http://stackoverflow.com/a/39615854
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22957332
has comment: http://stackoverflow.com/comment/35164350
has comment: http://stackoverflow.com/comment/35104779
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/35107561
has comment: http://stackoverflow.com/comment/35135726
downvote count: 2
has comment: http://stackoverflow.com/comment/35065461
score: 1
has comment: http://stackoverflow.com/comment/35124502
answers question: http://stackoverflow.com/q/22953136
has body: This problem could be solved using OOP techniques. In java it would look like this: public abstract class AObject{ public abstract void doSomething(); public void up(){ //do something here } public void down(){ //do something here } public void left(){ //do something here } public void right(){ //do something here } public void stop(){ //do something here } } public class AObject12 extends AObject{ public void doSomething(){ up(); left(); stop(); } } public class AObject304 extends AObject{ public void doSomething(){ right(); up(); stop(); } } public class AObject962 extends AObject{ public void doSomething(){ down(); left(); up(); stop(); } } Executing doSomething on a instance of a concrete class will trigger the appropriate behavior. So no more if/else is necesary. See code below for an example: AObject A12 = new AObject12(); A12.doSomething(); // Will run Up left stop in that order AObject A304 = new AObject304(); A304.doSomething(); // Will run right Up stop in that order AObject A962 = new AObject962(); A962.doSomething(); // Will run down left up stop in that order Some more info on this kind of programming can be found here: http://en.wikipedia.org/wiki/Polymorphism_%28computer_science%29 If you would like to be able to change the behavior of the object dynamicly you could consider applying a state pattern: http://en.wikipedia.org/wiki/State_pattern

http://stackoverflow.com/q/22877350
linked to: http://stackoverflow.com/q/59126518
favorite count: 0
has answer: http://stackoverflow.com/a/58682577
has answer: http://stackoverflow.com/a/22877465
tagged with: ip-address
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/104214763
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/29641322
has title: How to extract IP Address in Spring MVC Controller get call?
has answer: http://stackoverflow.com/a/44098402
upvote count: 152
has answer: http://stackoverflow.com/a/29641322
has answer: http://stackoverflow.com/a/61495191
type: Question
has answer: http://stackoverflow.com/a/55266907
accepted answer: http://stackoverflow.com/a/22877465
score: 152
linked to: http://stackoverflow.com/q/19271807
has answer: http://stackoverflow.com/a/74596651
answer count: 11
has body: I am working on Spring MVC controller project in which I am making a GET URL call from the browser - Below is the url by which I am making a GET call from the browser - http://127.0.0.1:8080/testweb/processing?workflow=test&amp;conf=20140324&amp;dc=all And below is the code in which the call comes after hitting at the browser - @RequestMapping(value = "processing", method = RequestMethod.GET) public @ResponseBody ProcessResponse processData(@RequestParam("workflow") final String workflow, @RequestParam("conf") final String value, @RequestParam("dc") final String dc) { System.out.println(workflow); System.out.println(value); System.out.println(dc); // some other code } Problem Statement:- Now is there any way, I can extract IP Address from some header? Meaning I would like to know from which IP Address, call is coming, meaning whoever is calling above URL, I need to know their IP Address. Is this possible to do?
has answer: http://stackoverflow.com/a/57442234
downvote count: 0
has answer: http://stackoverflow.com/a/55025170
has answer: http://stackoverflow.com/a/62580113
has answer: http://stackoverflow.com/a/70677455

http://stackoverflow.com/comment/35018799
type: AnswerComment
type: Comment
has text: @user3006193 maybe you should try on the other device or emulator
comment on: http://stackoverflow.com/a/22938332
score: 0

http://stackoverflow.com/comment/34902257
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22874253
type: AnswerComment
has text: Not only have you answered my question, but you cleaned up my code, as well. Thank you for the assistance, I've been at this for 5 hours.

http://stackoverflow.com/q/22827163
answer count: 2
has title: How to select a random values from the property file for Selenium Webdriver?
has comment: http://stackoverflow.com/comment/34817817
has comment: http://stackoverflow.com/comment/34863814
score: 0
has answer: http://stackoverflow.com/a/22911107
has comment: http://stackoverflow.com/comment/34823169
has comment: http://stackoverflow.com/comment/34816775
type: UnansweredQuestion
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/34863782
has body: Currently I'm working on Selenium WebDriver and using Java. I have a Filter Section with many drop downs In each drop down I have many options for all the drop downs. All the options i have put it in a property file called Dropdown.properties I have a property file (dropdown.properties) in the C: directory. In looks like visualizationId=Day,Week,Month,Quarter,Semester,Year,RD Tech Group,ICC,Center,Software Pack,Product,Project,Customer PRs,Severity,Priority periodId=Last 4 Weeks,Last 52 Weeks,Date Range,Week Range,Month Range,Year To Date classificationId=All PRs,External PRs,Internal PRs,Customer PRs topographyId=Overall,Center,ICC swpacksId=ADVIP,ADVLEG,ADVSEC,Boot,H323,IBC,MULTI,None,OneOS_EAD,PROXY,SBO,SIP,TDRE,VoDSL priorityId=Very Urgent,Urgent,Routine,Not Urgent,On Hold,Not Assigned severityId=Blocking,Major,Minor,Cosmetic,OLD PR By using Java for each drop down it need to pick few values from the property file and it need to compare with the UI whether the options is present or not. It should not check the order or something just want to check whether the randomly picked options from the property file is available in the UI Please suggest me any solution. I have read all the values from Property file using the code Properties APPTEXT = new Properties(); Log.info("Getting Input from the Property file"); FileInputStream fs = new FileInputStream("C:\\FilterSection\\dropdown.properties"); APPTEXT.load(fs); System.out.println("Propertyfile : " +APPTEXT); Could any one help me to pick few values from property file and need to check in UI.
tagged with: java
tagged with: selenium
tagged with: webdriver
has comment: http://stackoverflow.com/comment/34821564
type: Question
has answer: http://stackoverflow.com/a/22829800
has comment: http://stackoverflow.com/comment/34821389

http://stackoverflow.com/comment/35034442
has text: You have to loop through your buttons. It would probably be easier to implement and understand the logic is the buttons were in a 2-D, [3][3] array.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22947294
score: 0

http://stackoverflow.com/comment/34903690
type: Comment
type: QuestionComment
has text: Did you color the text using HTML tags?
comment on: http://stackoverflow.com/q/22874269
score: 0

http://stackoverflow.com/comment/34889788
score: 0
has text: "what if the jar is added through another android project in the workspace (settings > android > add library project)? – ferdy182 Nov 16 '12 at 14:48" - Why no one answered? I did this.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22867670

http://stackoverflow.com/comment/35740588
has text: is it really so that these kind of things won't be fixed in java 8 at all, but have to wait until java 9?
comment on: http://stackoverflow.com/a/23031415
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22919561
score: 4
answers question: http://stackoverflow.com/q/22917462
has body: The stacktrace shows that the class org.objectweb.asm.ClassReader.readClass gives an exception. I suppose this is a parser that Glassfish uses internally. One of the reasons it would crash, is because it is not configured to handle the given input properly. In this case the given input is a lambda expression and it does not know how to handle it. You will need to look for Java 8 bytecode (lambda) support for Glassfish and Tomcat. If it is not the issue, then it might be a bug in the parser that is internally used.
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/34992243
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22924073
has text: ok, i am officially going to sleep. thank you guys

http://stackoverflow.com/comment/34840221
type: Comment
score: 0
has text: See, i have no problems with having a person in a Phonebook that has no numbers. If you give back a empty list/map it would be ok for me because it signalize: `hey, i have 0 numbers for this person`, but `null` is questionable! Maybe i dont understand the differece between `null` and `empty list`? In what conditions is `null` better than an empty list?
type: AnswerComment
comment on: http://stackoverflow.com/a/22835193

http://stackoverflow.com/comment/35007689
has text: Sorry, I can't follow it. Can you tell me your email, I will post the entire code to you.
comment on: http://stackoverflow.com/a/22928560
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22840391
score: 3
has body: Here is the culprit: both are in one folder. Java compiler relies on a convention of naming source files and folders in a way that lets it find the source code by examining only the names of files, i.e. without checking their content; package name is part of the naming convention. That is why the compiler expects to find MyClass.java in a different folder. Since class MyClass is in the my.mypackage package, while class a is in the default package, their .java files must not be placed in the same folder. Instead, MyClass.java file needs to be placed in the my/mypackage/ (on Windows, my\mypackage\) folder in relation to the a.java file's location.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34941714
accepted answer of: http://stackoverflow.com/q/22840259
upvote count: 3
answers question: http://stackoverflow.com/q/22840259
has comment: http://stackoverflow.com/comment/34883418
has comment: http://stackoverflow.com/comment/34885652
has comment: http://stackoverflow.com/comment/34880160

http://stackoverflow.com/comment/34863663
comment on: http://stackoverflow.com/q/22853226
type: QuestionComment
type: Comment
score: 1
has text: That depends entirely on you. I'd be focusing on Java 7 feature no (I love you multi catch). Frankly, there's no point in using a JDK if you're noting going to take advantage of its features, you might as well stick with the one your targeting. In most cases (the school is obviously not something you can control), but if you need a particular feature or bug fix, then your users will need to upgrade. This is of course, entirely contextual

http://stackoverflow.com/a/57794420
answers question: http://stackoverflow.com/q/22863534
upvote count: 1
score: 1
downvote count: 0
has body: "DocumentType" discard duplicates of attributes "entities" and "notations" by Interface Definition (see W3C DOM Spec. W3C SPEC - REC-DOM-Level-3-Core) A NamedNodeMap containing the general entities, both external and internal, declared in the DTD. Parameter entities are not contained. Duplicates are discarded. For example in: &lt;!DOCTYPE ex SYSTEM "ex.dtd" [ &lt;!ENTITY foo "foo"&gt; &lt;!ENTITY bar "bar"&gt; &lt;!ENTITY bar "bar2"&gt; &lt;!ENTITY % baz "baz"&gt; ]&gt; &lt;ex/&gt; the interface provides access to foo and the first declaration of bar but not the second declaration of bar or baz. Every node in this map also implements the Entity interface. The DOM Level 2 does not support editing entities, therefore entities cannot be altered in any way. I think that you need to use another method to parse/check this information... e.g. you can use a regular expression.
type: Answer

http://stackoverflow.com/comment/34961361
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22907470
has text: If you use some refactoring solution when you rename your class it should take care of those references for you.
score: 1

http://stackoverflow.com/a/22971460
type: Answer
score: 1
upvote count: 1
has body: It would mean that the junit.textui package is on your classpath already. To display the current default classpath, you can use "echo $CLASSPATH". In many cases the default classpath ($CLASSPATH) won't hold every necessary library, so you need to specify them separately with the -cp command line switch, therefore whenever you're creating for example batch files / shell scripts, you should consider that all the required libraries are explicitly specified (i.e. all the libraries not included in the default JDK).
accepted answer of: http://stackoverflow.com/q/22943216
answers question: http://stackoverflow.com/q/22943216
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22917384
has comment: http://stackoverflow.com/comment/34998875
answers question: http://stackoverflow.com/q/22917358
upvote count: 6
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/35003979
has body: You need to escape '*' as it is a special character in regex: patterns = bal.split("\\*\\*\\*");
downvote count: 0

http://stackoverflow.com/a/22896575
answers question: http://stackoverflow.com/q/22896401
type: Answer
has comment: http://stackoverflow.com/comment/34944015
has comment: http://stackoverflow.com/comment/34942185
score: 1
upvote count: 1
has body: FileWriter extends OutputStreamWriter which is where it gets its write method from. http://docs.oracle.com/javase/7/docs/api/java/io/OutputStreamWriter.html#write(char[], int, int) According to the docs write throws an IOException. In Java you have to either wrap the code that throws an exception in a try catch block. Or throw the exception. private void ExportGoActionPerformed(java.awt.event.ActionEvent evt) { FileWriter writer; try { writer = new FileWriter("Inventory.txt"); for (String str : Inventory) { writer.write(str); } writer.close(); } catch (IOException e) { //Do something here to handle the error. Maybe publish a notification to the user that their file didn't write. } finally { try { writer.close(); } catch (IOException ignore){} } } Note that the FileWriter constructor you're using can also throw an IOException (http://docs.oracle.com/javase/7/docs/api/java/io/FileWriter.html#FileWriter(java.lang.String)) as well as the close method. So you need to include all of those statements within the try block. The finally block is there to close your handle to the file if at all possible. The try-with-resource gets rid of the need to do that though. So I recommend using it. http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
downvote count: 0

http://stackoverflow.com/comment/35019548
comment on: http://stackoverflow.com/a/22939524
score: 0
type: AnswerComment
type: Comment
has text: It's very difficult to change implementation if project was started in 1996. The project is really very big.

http://stackoverflow.com/comment/34800758
comment on: http://stackoverflow.com/q/22818292
type: Comment
type: QuestionComment
has text: possible duplicate of [Android Reading from an Input stream efficiently](http://stackoverflow.com/questions/2492076/android-reading-from-an-input-stream-efficiently)
score: 1

http://stackoverflow.com/q/22892251
has title: Easing a Vector3 to a new position
type: AnsweredQuestion
tagged with: vector
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34934039
accepted answer: http://stackoverflow.com/a/22892637
favorite count: 0
type: Question
tagged with: android
upvote count: 2
has body: Not sure if libgdx offers this functionality, so it might be a maths question. I have various 3D camera coordinates stored as a Vector3, and I want to move the camera from one to the other. Vector3 CAM_POSITION_DEFAULT = new Vector3(0f, 1f, -5f); Vector3 CAM_POSITION_TOP = new Vector3(0f, 10f, -5f); I could just set the camera position to the new one, but this is a but too sharp. A nice smooth transition, with some easing (slow start, fast mid, slow end) would be ideal. Is this just a simple matrix manipulation, or is there a tidy way to get this functionality with easing? Secondly, if easing is available, is it possible to use different forms of easing (like in javascript's jQuery library)? Many thanks.
answer count: 1
tagged with: easing
has answer: http://stackoverflow.com/a/22892637
tagged with: libgdx
tagged with: java

http://stackoverflow.com/q/22968303
type: Question
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/33890560
accepted answer: http://stackoverflow.com/a/22980402
answer count: 2
score: 5
has body: I am trying to generate a docx in jasper report. I have this code: JRDocxExporter exporter = new JRDocxExporter(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos); exporter.exportReport(); How do I write the report out to file? Most of the examples I have seen are all around using servlets.
has answer: http://stackoverflow.com/a/22980402
favorite count: 0
tagged with: http://stackoverflow.com/tag/docx
upvote count: 5
has title: How to generate, export to word docx file?
possible better answer: http://stackoverflow.com/a/33890560
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: export-to-word

http://stackoverflow.com/comment/34900250
type: QuestionComment
has text: I don't know how to do it simply. I don't know where to start.
comment on: http://stackoverflow.com/q/22873405
score: 0
type: Comment

http://stackoverflow.com/comment/34968644
score: 1
comment on: http://stackoverflow.com/q/22911722
has text: there are simpler (and quicker) things than sorting...
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22890411
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22883296
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22883296
has body: As mentioned in the comments, you can't rely on characters() to provide all of an element's text in one shot. I recommend something like this (look for the comments in the code to see where I modified it) and then making a similar modification for the title: // buffer to hold description private StringBuffer descriptionBuffer; public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if ("item".equals(qName)) { currentItem = new Item(); } else if ("title".equals(qName)) { parsingTitle = true; } else if ("description".equals(qName)) { parsingDescription = true; // initialize buffer descriptionBuffer = new StringBuffer(); } } @Override public void endElement(String uri, String localName, String qName) throws SAXException { System.out.println("Testing endelement"); if ("item".equals(qName)) { Items.add(currentItem); currentItem = null; } else if ("title".equals(qName)) { parsingTitle = false; } else if ("description".equals(qName)) { // Put contents of buffer into description currentItem.setDescription(descriptionBuffer.toString()); descriptionBuffer = null; parsingDescription = false; } } @Override public void characters(char[] ch, int start, int length) throws SAXException { System.out.println("writing"); if (parsingTitle) { if (currentItem != null) currentItem.setTitle(new String(ch, start, length)); } else if (parsingDescription) { // add to buffer descriptionBuffer.append(ch, start, length); } }
type: Answer

http://stackoverflow.com/comment/34947197
type: Comment
has text: I am glad you like it :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22899140

http://stackoverflow.com/a/22883175
answers question: http://stackoverflow.com/q/22883088
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34918317
type: Answer
has body: My Android app needs to make contact with a web service(which does not exist yet) which should return a jpg image and some text to go along with it... is that even possible ? The conventional approach for this is for the Web service to return JSON/XML/whatever that contains a URL to download the image. For example, the StackExchange API for questions returns links to the URLs for the profile images for the people asking questions and supplying answers. How is that implemented? On the server side, that would depend upon the implementation of the server. Please feel free to ask a separate, appropriately-tagged StackOverflow question to get assistance with your Web service implementation. On the client side, you perform one HTTP request to get the basic data, and separate HTTP request(s) to get the image(s). This sample project, for example, uses Retrofit to retrieve StackOverflow questions with the android tag and Picasso to download the profile images for the people asking the questions.
accepted answer of: http://stackoverflow.com/q/22883088
has comment: http://stackoverflow.com/comment/34918157

http://stackoverflow.com/comment/34969102
has text: Maybe [this](http://stackoverflow.com/questions/5070924/enable-glassfish-compression) or [this](http://www.vikasing.com/2010/01/enable-gzip-compression-on-glassfish-v3.html) is what you are looking for. It will not send file with `zip` extension, but will compress send data with GZip which then is unzipped by browser. You can find more info [here](https://www.google.pl/search?q=glassfish+gzip+compression&oq=glassfish+gzi&aqs=chrome.2.69i57j0l5.10778j0j1&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22911742
type: QuestionComment

http://stackoverflow.com/a/22935115
has comment: http://stackoverflow.com/comment/35011813
has comment: http://stackoverflow.com/comment/35013722
accepted answer of: http://stackoverflow.com/q/22934604
type: Answer
answers question: http://stackoverflow.com/q/22934604
has comment: http://stackoverflow.com/comment/35014461
upvote count: 1
has comment: http://stackoverflow.com/comment/35012669
has body: I'm not clear on how you are creating your graph instance with the GraphOfTheGodsFactory and how you are connecting the graph in Rexster, but assuming you ran your modified GraphOfTheGodsFactory, created the graph and then connected it to Rexster to that graph, you would also need to set auto-type to none in rexster.xml for that setting to be respected by Rexster.
has comment: http://stackoverflow.com/comment/35015765
has comment: http://stackoverflow.com/comment/35015666
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/a/22960514
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22820864
has body: It is not clear what is the answer you are trying to get. The question should be set with example data to specify exactly what is it that you want to get. Given the part of the program you provided. I guess what you are looking for is all possible subsets. the following code will get you all the possible subsets. You can easily modify this program to give you all possible subsets of a specific size (Try it to make sure you understand how it works). static void subsets(String[]arr) { int len = arr.length; for (int i = 0; i &lt; (1 &lt;&lt; len); i++) { // 1 &lt;&lt; len means 2 ^ len there are 2 ^ n subsets for a set of size n /* * We will use the bits of the integer i to represent which elements are taken * a bit of value 1 means this element is included in the current subset * a bit of value 0 means that we do not take the element in the given position */ String res = "["; for(int j = 0; j &lt; len; j++) { //loop over the bits of i from 0 to len -1 if ( (i &amp; (1 &lt;&lt; j)) != 0) { //the jth bit is 1 in the integer i as such the jth //element is taken in the current subset res += (arr[j]+", "); } } res += "]"; int lastCommaPosition = res.lastIndexOf(','); if (res.lastIndexOf(',') != -1) { // a comma exists res = res.substring(0, lastCommaPosition)+ "]";//remove the extra comma and space } System.out.println(res); } } You can modify the method above to take an integer size for example, count the number of bits of value 1 (the number of elements taken) if this count is equal to the size you print it otherwise you don't. Feel free to modify the question if this is not the answer you wanted or ask in the comments if there is something you don't understand.

http://stackoverflow.com/comment/34971855
comment on: http://stackoverflow.com/a/22912787
type: AnswerComment
has text: so linesToDeleteOffset[] will be my position.get(0) and linesToDeleteLength[] will be new_position.get(0) ? app always remove 4 lines so it could be constant value. Did I get it ?
type: Comment
score: 0

http://stackoverflow.com/comment/34979235
has text: thanks for your reply, I need to turn a coloured picture into a purply picture some how and I am told I need to average the values of red and blue without the green?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22917235
type: Comment

http://stackoverflow.com/comment/34923361
type: Comment
has text: @RC Yep, that much I know, like I mentioned, /sbin/init with a custom script in /etc/init.d, would do the job, but is it really the idea that everyone should build his own script to manage the daemon (start, stop, restart, status)? Feels like something is missing on that solution.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22886083

http://stackoverflow.com/comment/74237782
score: 1
has text: More elegant than others, but you didn't remove elements. Am I right?
type: AnswerComment
comment on: http://stackoverflow.com/a/22859478
type: Comment

http://stackoverflow.com/comment/34956017
type: AnswerComment
score: 10
comment on: http://stackoverflow.com/a/22904195
type: Comment
has text: Awesome answer. I really don't understand why these kinds of questions are looked down on here. +1

http://stackoverflow.com/a/22825405
has body: It is possible to make the interface generic, specifying the type of configuration with a generic type parameter, with an upper bound. public interface Configurable&lt;C extends Configuration&gt; { public Configurable setConfig(C config); } Then the subclass can specify which Configuration is required. public class SubConfigurable implements Configurable&lt;SubConfigurable&gt; { @Override public SubConfigurable setConfig(SubConfiguration config) { this.config = config; return this; } } This is not necessary for the return type, because Java return types are covariant. A subclass can return a subtype of the original method and still override that original method. Parameter types in overriding methods are not covariant, but using generics in this way is a valid solution.
answers question: http://stackoverflow.com/q/22825369
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/34814233
has comment: http://stackoverflow.com/comment/34813515
score: 4
accepted answer of: http://stackoverflow.com/q/22825369

http://stackoverflow.com/comment/34943908
score: 0
type: Comment
type: QuestionComment
has text: Ok, it says: The process cannot access the file because it is being used by another process. How could it be if I'm not playing that file?
comment on: http://stackoverflow.com/q/22897673

http://stackoverflow.com/q/22900816
accepted answer: http://stackoverflow.com/a/22900839
tagged with: servlets
type: Question
answer count: 1
tagged with: jsp
has title: Show the current date using JSP and Servlets
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22900839
tagged with: java
has body: I am trying to do a homework about Web Programming (JSP and Servlets) and I can't see what is wrong here in the code. My index.jsp is: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Data (sem JavaBeans) Atualizar data <% if (request.getAttribute("dia") != null) { int dia = (Integer) request.getAttribute("dia"); int mes = (Integer) request.getAttribute("mes"); int ano = (Integer) request.getAttribute("ano"); int hora = (Integer) request.getAttribute("hora"); int minuto = (Integer) request.getAttribute("minuto"); String sDia = String.format("%2d",Integer.toString(dia)); String sMes = String.format("%2d",Integer.toString(mes)); String sAno = String.format("%4d",Integer.toString(ano)); String sHora = String.format("%2d",Integer.toString(hora)); String sMinuto = String.format("%2d",Integer.toString(minuto)); out.print("A hora atual é: " + sDia + "/" + sMes + "/" + sAno + " - " + sHora + ":" + sMinuto); } %> and my servlet is: package br.com.gabriel; import java.io.IOException; import java.util.Calendar; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class Data */ @WebServlet("/Data") public class Data extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Data() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ @SuppressWarnings("deprecation") protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Date d = new Date(); int dia = d.getDate(); int mes = d.getMonth() + 1; int ano = d.getYear() + 1900; int hora = d.getHours(); int minuto = d.getMinutes(); request.setAttribute("dia", dia); request…

http://stackoverflow.com/comment/35005478
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22931743
has text: Save in a `ByteArrayOutputStream`? But it will eat heap space, of course

http://stackoverflow.com/comment/35011963
type: Comment
score: 1
has text: @HonzaZidek: the stream itself is lazy, but if you did, for example Lists.newArrayList(iterable).stream() to construct the stream, the construction of the stream wouldn't be lazy.
type: QuestionComment
comment on: http://stackoverflow.com/q/22929820

http://stackoverflow.com/a/22843630
type: Answer
answers question: http://stackoverflow.com/q/22843587
has comment: http://stackoverflow.com/comment/34845788
score: 0
has body: Create a string before your loop and append that text to the string in the loop. Then when you exit out of the loop simply display your string. Edit: Your original code doesn't have newlines at all so yeah. For tabs, wrap the string in a JTextArea. Play around with the "\n\t" string because I'm not quite sure if that's what you want. for (Vehicle r : resultList) { message += r.getPlate() + " " + r.getYear() + " " + r.getMfg() + " " + r.getStyle() + " " + r.getColor() + "\n\t"; } JOptionPane.showMessageDialog(null, new JTextArea(message));

http://stackoverflow.com/q/22933401
has comment: http://stackoverflow.com/comment/35009152
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/35010153
has answer: http://stackoverflow.com/a/69473640
tagged with: java
has body: I am using the following code to download a file within the WEB-INF protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String b = null; Cookie[] cookies = request.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (cookie.getName().equals("thecookie")) { b = cookie.getValue(); } } } BufferedReader br = new BufferedReader(new FileReader(b+"/logs.txt")); String path = br.readLine(); br.close(); File file = new File(path+"/Results.xlsx"); FileInputStream fileIn = new FileInputStream(file); ServletOutputStream out = response.getOutputStream(); response.setHeader("Content-Disposition", "attachment; filename=Result.xlsx"); response.setContentType( "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); byte[] outputByte = new byte[4096]; int bytesRead; //copy binary contect to output stream while((bytesRead = fileIn.read(outputByte)) != -1) { out.write(outputByte, 0, bytesRead); } fileIn.close(); out.flush(); out.close(); } along with this I want to download another file at the same location Results.csv I've tried using the same code above twice but it didn't work. How to download multiple files without using zipoutputstream?
type: Question
has comment: http://stackoverflow.com/comment/35009106
possible better answer: http://stackoverflow.com/a/69473640
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22933915
has title: Download multiple files Java
favorite count: 0
tagged with: download
upvote count: 2
has comment: http://stackoverflow.com/comment/35039444
accepted answer: http://stackoverflow.com/a/22933915
has comment: http://stackoverflow.com/comment/35009185

http://stackoverflow.com/a/29437376
has comment: http://stackoverflow.com/comment/47134932
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/22961733
has comment: http://stackoverflow.com/comment/78587584
has body: I think that document is dated. SEI has published the latest standards - cool and really good.
score: 3
downvote count: 0

http://stackoverflow.com/comment/44893423
type: AnswerComment
comment on: http://stackoverflow.com/a/25676881
type: Comment
has text: As of writing, the URL has changed to https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
score: 2

http://stackoverflow.com/q/22911295
has answer: http://stackoverflow.com/a/22911386
has comment: http://stackoverflow.com/comment/34968134
has body: I have two strings in java: s1 = "-7ff9"; s2 = "-7ff9"; I get the s2 string from a response from a server. Instead string s1 is a value of a parameter. When I ask : if(s1.equals(s2)){ System.out.println("YES");} else System.out.println("NO"); I get the response NO. I then compared the to strings: System.out.println(s1.compareTo(s2)); I get an 19 output which means " string s1 is lexicographically greater than the string argument s2" I just don't know how to solve this ...
downvote count: 6
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34967839
possible better answer: http://stackoverflow.com/a/22911489
has title: What does it mean a string is lexicographically greater than another string?
type: Question
score: -2
has answer: http://stackoverflow.com/a/22911489
accepted answer: http://stackoverflow.com/a/22912357
upvote count: 4
answer count: 3
has comment: http://stackoverflow.com/comment/34968544
tagged with: string
has answer: http://stackoverflow.com/a/22912357
has comment: http://stackoverflow.com/comment/34967850
favorite count: 0

http://stackoverflow.com/comment/35006216
type: Comment
has text: that means the only difference between arraylist and arrays are that arraylists are dianamic and latter is static
type: AnswerComment
comment on: http://stackoverflow.com/a/22932233
score: 0

http://stackoverflow.com/comment/35011836
type: Comment
type: QuestionComment
has text: Your title and body don't match. 5,447 != 5,4447
score: 0
comment on: http://stackoverflow.com/q/22935466

http://stackoverflow.com/q/22810977
score: 0
has title: JAR not on classpath, force classloader to read file from it
tagged with: java
has answer: http://stackoverflow.com/a/22811854
type: AnsweredQuestion
tagged with: jar
type: Question
accepted answer: http://stackoverflow.com/a/22811854
tagged with: classloader
has body: I am trying to read class name from a file inside a jar file which is passed to the method and put the determined class name into passed StringBuilder. For the driver file jtds-1.3.1.jar i should get net.sourceforge.jtds.jdbc.Driver but I get sun.jdbc.odbc.JdbcOdbcDriver instead of it independently from passed file. I suppose the child classloader reads from /META-INF/services/java.sql.Driver which is somewhere on my classpath (but I don't really know where) and I can't figure it out how to manage this classloader thing. The code concerning this matter below: public String determineAndSetDriverClass(File jar, StringBuilder classNameBuilder) { BufferedReader br = null; URLClassLoader child = null; try { URL[] urls = {jar.toURI().toURL()}; child = new URLClassLoader(urls, this.getClass().getClassLoader()); br = new BufferedReader(new InputStreamReader(child.getResourceAsStream("/META-INF/services/java.sql.Driver"))); classNameBuilder.append(br.readLine()); return null; } catch (Exception e) { e.printStackTrace(); return e.getMessage(); } finally { try { if (br != null) br.close(); if (child != null) child.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } } According to javadoc of getResource method: "This method will first search the parent class loader for the resource;" It seems that getResourceAsAstream has the same behaviour. Sow how can I force loading from child classloader?
answer count: 1

http://stackoverflow.com/comment/34882786
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22859393
has text: @Codor: Can you recommend a good book on Approximation algorithms that might help me in this case.

http://stackoverflow.com/q/22902836
tagged with: java
has title: what's the use of the limit() in nio buffer class
type: Question
has answer: http://stackoverflow.com/a/22902881
tagged with: nio
possible better answer: http://stackoverflow.com/a/22902881
accepted answer: http://stackoverflow.com/a/22903035
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22902887
has body: the nio buffer class has two fields: A buffer's capacity is the number of elements it contains. The capacity of a buffer is never negative and never changes. A buffer's limit is the index of the first element that should not be read or written. A buffer's limit is never negative and is never greater than its capacity. what's the use of the limit ?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22903035

http://stackoverflow.com/comment/34928684
has text: Exact duplicate of [How can I convert my encryption to decryption?](http://stackoverflow.com/questions/22886856/how-can-i-convert-my-encryption-to-decryption)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22889129

http://stackoverflow.com/a/22915462
accepted answer of: http://stackoverflow.com/q/22911929
score: 0
answers question: http://stackoverflow.com/q/22911929
type: AcceptedAnswer
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34979666
has body: The answer that I guessed at just before Absurd-Mind was headed down that path, was that my main class extended and implemented other classes that were not in the classpath. I tracked down all of the classes used and added them to the classpath and started getting other class not found exceptions, which I expected. Now you know.

http://stackoverflow.com/q/22960849
tagged with: jtable
has answer: http://stackoverflow.com/a/23135117
has comment: http://stackoverflow.com/comment/35058594
score: 3
downvote count: 0
favorite count: 0
type: Question
tagged with: swing
has comment: http://stackoverflow.com/comment/35058375
answer count: 1
upvote count: 3
tagged with: java
tagged with: defaulttablemodel
tagged with: undo-redo
has body: Have a look at the code shown below. When I add two rows to the table and afterwards try to perform an undo operation I get a java.lang.ArrayIndexOutOfBoundsException: 11 &gt;= 11. Can anyone please tell me what is wrong with the code? import java.awt.*; import java.awt.event.*; import java.util.Vector; import javax.swing.*; import javax.swing.event.*; import javax.swing.table.*; import javax.swing.text.TabExpander; import javax.swing.undo.*; public class UndoTable { public static void main(String[] args) { Object data[][] = { {"AMZN", "Amazon", 41.28, "BUY"}, {"EBAY", "eBay", 41.57, "BUY"}, {"GOOG", "Google", 388.33, "SELL"}, {"MSFT", "Microsoft", 26.56, "SELL"}, {"NOK", "Nokia Corp", 17.13, "BUY"}, {"ORCL", "Oracle Corp.", 12.52, "BUY"}, {"SUNW", "Sun Microsystems", 3.86, "BUY"}, {"TWX", "Time Warner", 17.66, "SELL"}, {"VOD", "Vodafone Group", 26.02, "SELL"}, {"YHOO", "Yahoo!", 37.69, "BUY"} }; String columns[] = {"Symbol", "Name", "Price", "Guidance"}; final JvUndoableTableModel tableModel = new JvUndoableTableModel(data, columns); final JTable table = new JTable(tableModel); JScrollPane pane = new JScrollPane(table); JvUndoManager undoManager = new JvUndoManager(); tableModel.addUndoableEditListener(undoManager); JMenu editMenu = new JMenu("Edit"); Action addrowaction = new AbstractAction("Add Row") { private static final long serialVersionUID = 1433684360133156145L; public void actionPerformed(ActionEvent e) { tableModel.insertRow(table.getRowCount(), new Object[]{"YHOO", "Yahoo!", 37.69, "BUY"}); } }; editMenu.add(undoManager.getUndoAction()); //editMenu.add(undoManager.getRedoAction()); JMenuBar menuBar = new JMenuBar(); menuBar.add(editMenu); editMenu.add(addrowaction); JFrame frame = new JFrame("Undoable JTable"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setJMenuBar(menuBar); frame.add(pane, BorderLayout.CENTER); frame.setSize(300, 150); frame.setLocation(200, 300); frame.setVisible(true); } } class JvUndoableTableModel extends DefaultTab…
has title: Undo in JTable in swing
type: UnansweredQuestion

http://stackoverflow.com/a/22910346
answers question: http://stackoverflow.com/q/22909717
has comment: http://stackoverflow.com/comment/34996492
has comment: http://stackoverflow.com/comment/34996658
has comment: http://stackoverflow.com/comment/34991334
has body: a static inner builder, made famous by josh bloch in effective java. Required parameters are constructor args, optional are methods. An example. The invocation where only username is required : RegisterUserDto myDto = RegisterUserDto.Builder(myUsername).password(mypassword).email(myemail).Build(); And the underlying code(omitting the obvious instance vars) : private RegisterUserDTO(final Builder builder) { super(); this.username = builder.username; this.firstName = builder.firstName; this.surname = builder.surname; this.password = builder.password; this.confirmPassword = builder.confirmPassword; } public static class Builder { private final String username; private String firstName; private String surname; private String password; private String confirmPassword; public Builder(final String username) { super(); this.username = username; } public Builder firstname(final String firstName) { this.firstName = firstName; return this; } public Builder surname(final String surname) { this.surname = surname; return this; } public Builder password(final String password) { this.password = password; return this; } public Builder confirmPassword(final String confirmPassword) { this.confirmPassword = confirmPassword; return this; } public RegisterUserDTO build() { return new RegisterUserDTO(this); } }
has comment: http://stackoverflow.com/comment/34968767
type: Answer
has comment: http://stackoverflow.com/comment/34968949
has comment: http://stackoverflow.com/comment/34991478
has comment: http://stackoverflow.com/comment/34989064
downvote count: 1
score: 3
has comment: http://stackoverflow.com/comment/34968519
has comment: http://stackoverflow.com/comment/34966449
has comment: http://stackoverflow.com/comment/34967181
has comment: http://stackoverflow.com/comment/34992780
upvote count: 4
has comment: http://stackoverflow.com/comment/34968567
has comment: http://stackoverflow.com/comment/34989454
has comment: http://stackoverflow.com/comment/34969244

http://stackoverflow.com/a/22930462
answers question: http://stackoverflow.com/q/22929851
type: Answer
accepted answer of: http://stackoverflow.com/q/22929851
has body: It's funny to ask this question exactly in the time when the guide is not available for unknown reasons. Perhaps it is being rewritten for Java 8? Anyway, it's mostly still valid. There are some controversial points (as in every styleguide) and there are lots of advice missing because of the last revision date (generics, enums, varargs, etc. - don't forget to have some conventions for those, too). The main point is - you don't have to adhere to it religiously. Read it, let it sink in, try to use as much of it as possible for you and your team. If you find something that doesn't suit you, because you feel it's an outdated opinion, you can simply drop it. The only thing you have to be is consistent. If you start with one style, don't switch to another while still having old code. By the way, there are many style guides out there. If you want something "new" (but a lot less thorough), see for example the very new Google styleguide.
upvote count: 9
score: 9
has comment: http://stackoverflow.com/comment/35003589
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34809489
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22822825
has text: thanks to you. it doesn't work (simply it continue running), but i'm tired to lose time on charva. i'll find something serious.

http://stackoverflow.com/a/22901897
has comment: http://stackoverflow.com/comment/34951687
accepted answer of: http://stackoverflow.com/q/22901885
score: 0
has body: You will get an exception whenever that is null, also your variable assignment is redundant. public int compareTo(Letter that) { if (this.toAddress == null) { if (that == null || that.toAddress == null) { return 0; } return -1; } if (that == null) return 1; // &lt;-- Add something like this. // int value; // value = this.toAddress.getZip().compareTo(that.toAddress.getZip()); return this.toAddress.getZip().compareTo(that.toAddress.getZip()); }
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22901885

http://stackoverflow.com/a/22963172
answers question: http://stackoverflow.com/q/22962432
has body: Please check you have not created ambiguity while creating views this could cuase a problem if you tried to define view with same ids
type: Answer
score: 0

http://stackoverflow.com/q/22912883
tagged with: jsoup
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22913554
accepted answer: http://stackoverflow.com/a/22913554
has comment: http://stackoverflow.com/comment/34973534
has body: I'm currently using a network software(IxChariot). This soft exports the output into the html format. And I would like to create a soft which transform the html code from Ixchariot to an other html code(I would like to add some tips and remove some useless information). I need to remove some table but the only difference between the table is the title. Example of html code : Run Options Other example : Test Setup (Console to Endpoint 1) To perform that I'm trying to use pseudo selector from jsoup like that : Elements table = doc.select("table:has(h2:contains(Run Options)").remove(); I already tried like that too : Elements table = doc.select("table"); table:has(h2:contains(title)); But It's not working,(currently, all the code is remove). Could you help me with the pseudo selector ? Or if you have a better idea.. ps: I'm not an expert, I just have some basic knowledge in programming.
type: AnsweredQuestion
tagged with: java
has title: Jsoup, table and combinaison of pseudo selector
type: Question
tagged with: html-table
has comment: http://stackoverflow.com/comment/34973995
has comment: http://stackoverflow.com/comment/34972903

http://stackoverflow.com/comment/35003410
comment on: http://stackoverflow.com/q/22929792
score: 0
type: Comment
type: QuestionComment
has text: I would like to avoid AJAX calls. Do we have another way to send request to the server?

http://stackoverflow.com/comment/71038435
has text: Except constructor injection is not possible. Classic spring.
type: Comment
comment on: http://stackoverflow.com/a/22963184
type: AnswerComment
score: 0

http://stackoverflow.com/q/22822385
tagged with: xpath
tagged with: java
type: Question
has body: I know this is so easy and I've spent all day banging my head. I have an XML document like this: <WMS_Capabilities version="1.3.0" xmlns="http://www.opengis.net/wms"> WMS <Title>Metacarta WMS VMaplv0 <Capability> <Layer> Vmap0 <Title>Metacarta WMS VMaplv0 Vmap0 ... There can be multiple Layer nodes, and any Layer node can have a nested Layer node. I can quickly select all of the layer nodes and iterate through them with the following xpath code: Map<String, String> uris = new HashMap<String, String>(); uris.put("wms", "http://www.opengis.net/wms"); XPath xpath1 = doc.createXPath("//wms:Layer"); xpath1.setNamespaceURIs(uris); List nodes1 = xpath1.selectNodes(doc); for (Iterator<?> layerIt = nodes1.iterator(); layerIt.hasNext();) { Node node = (Node) layerIt.next(); } I get back all Layer nodes. Perfect. But when I try to access each Name or Title child node, I get nothing. I've tried as many various combinations I can think of: name = node.selectSingleNode("./wms:Name"); name = node.selectSingleNode("wms:Name"); name = node.selectSingleNode("Name"); etc etc, but it always returns null. I'm guessing it has something to do with the namespace, but all I'm after is the name and title text values for each one of the Layer nodes I've obtained. Can anybody offer any help:
accepted answer: http://stackoverflow.com/a/22839872
possible better answer: http://stackoverflow.com/a/22824320
has answer: http://stackoverflow.com/a/22824320
has comment: http://stackoverflow.com/comment/34830597
score: 0
answer count: 2
tagged with: dom4j
has title: Simple dom4j parsing in Java - can't access child nodes
has answer: http://stackoverflow.com/a/22839872
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/comment/34932656
has text: @Draiget: what length has your buffer? check the width and height you pass to teximage2d, it should be your frame size
comment on: http://stackoverflow.com/q/22886376
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22815919
has comment: http://stackoverflow.com/comment/34796536
has answer: http://stackoverflow.com/a/22816191
score: 0
has comment: http://stackoverflow.com/comment/34796456
answer count: 3
has title: Java countdown time doesnt display correct time
has answer: http://stackoverflow.com/a/22816139
has body: Im currently working on a project that has a simple countdown where the user enters a time and it starts counting down from that time. it is GUI based and displays the countdown to the user. ive managed to make it count down but its not displaying correctly. For example, if i enter 1min 30secs, it counts down from 1:30, to 1:01 then incorrectly displays 0:00 then it counts down from 0:59. it is correct until i get to a point where the minutes change to seconds and it doesnt display correctly for 1 second. Countdown class: class countdownClass implements ActionListener { //counts down then beeps int counter; public countdownClass(int counter) { this.counter = counter; } public void actionPerformed(ActionEvent sc) { //counts down every second counter--; if(counter &gt;= 1) { //a simple countdown if(counter &gt; 9){ //this statement is for aestetic purpose as before seconds.setText("" + counter); }else{ seconds.setText("0" + counter); } } else if(minutesNum &gt;= 1 &amp;&amp; counter &lt;= 0){ //if minute exists carry on the countdown // 1:01 - &gt; 1:00 - &gt; 0:59 int minuteUpdate = minutesNum - 1; if (minutesNum &lt; 9){ minutes.setText("0" + Integer.toString(minutesNum)); seconds.setText("00"); if(counter &lt;= 0){ minutes.setText("0" + Integer.toString(minuteUpdate)); } }else{ minutes.setText("0" + Integer.toString(minutesNum)); seconds.setText("0" + Integer.toString(00)); minutes.setText("0" + Integer.toString(minuteUpdate)); } counter = 60; } else if(minutesNum == 0 &amp;&amp; counter == 0) { //once the countdown ends plays a beep timer.stop(); seconds.setText("00"); finish.setText("Time is up!"); start.setEnabled(true); try{ clip = AudioSystem.getClip(); clip.open(AudioSystem.getAudioInputStream(new File("ring.wav"))); clip.start(); soundPlay = true; } catch (Exception e){ e.printStackTrace(System.out); } } } } could you please help me identify where the code is going wrong and provide me with a fix for it. Thanks for your time.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22816204
has comment: http://stackoverflow.com/comment/34796816
tagged with: java
type: Question

http://stackoverflow.com/comment/60551486
score: 0
type: AnswerComment
has text: Just a note to say Ebean has it's own type safe queries now via "Query beans" - http://ebean-orm.github.io/docs/query/typesafe
type: Comment
comment on: http://stackoverflow.com/a/24005684

http://stackoverflow.com/comment/34999502
type: Comment
comment on: http://stackoverflow.com/a/22928241
score: 0
type: AnswerComment
has text: i want to move down the 2d array i.e from [4][0] to [5][0] and son on. That's why i put [j][i].

http://stackoverflow.com/comment/34946919
has text: where do you want to use `diff` - in another method in the same class?
type: QuestionComment
comment on: http://stackoverflow.com/q/22899266
score: 0
type: Comment

http://stackoverflow.com/q/22934689
has answer: http://stackoverflow.com/a/23210760
downvote count: 0
has body: I would like to expose the following question. I have an Android App that makes use of both UserLocation (I developped my own class in order to get when the app atars as I explain below) and Google Maps Api v2. Let´s say the app has two buttons Button one--> When the user clicks the app shows a map with a lot of markers, I use the google maps api V2 fragment. And I mahe use of the following line to show the users location. mMap.setMyLocationEnabled(true); Button two--> Starts a AsyncTask to get the users position and calculate the closets places, and show then on a Map and on a ListView. Below I provide all my code to do this: private class findPosicionTask extends AsyncTask&lt;Void,Integer,Location&gt; { private final ProgressDialog dialog = new ProgressDialog(MainActivity.this); private int error = 0; private Activity actividad; private int procesoTerminado=0; public findPosicionTask(Activity actividad) { this.actividad = actividad; } @Override protected void onPreExecute() { if (!LocationSettingsManager.isLocationServiceAvaliable(getApplicationContext())) { cancel(true); } else { this.dialog.setMessage(getString(R.string.obteniendoPoisicion)); this.dialog.show(); } } @Override protected Location doInBackground(Void... params) { if (this.error==0) { try { Looper.prepare(); MyLocationManager.LocationResult locationResult = new MyLocationManager.LocationResult(){ @Override public void gotLocation(Location location) { if (location!=null) { LocationSingleton posicionSingleton = (LocationSingleton)getApplication(); posicionSingleton.setMiPoscion(location); posicionSingleton.setFecha(new Date()); procesoTerminado=1; onPostExecute(location); } else { procesoTerminado=1; onPostExecute(location); } } }; MyLocationManager myLocation = new MyLocationManager(); if (!myLocation.getLocation(getApplicationContext(), locationResult)) { } } catch (Exception e) { error=2; cancel(true); return null; } } return null; } @Override protected void onPostExecute(Location posicion) { if (p…
upvote count: 1
favorite count: 0
tagged with: google-maps-android-api-2
possible better answer: http://stackoverflow.com/a/23332696
has title: How Google Maps API V2 Gets Location?
tagged with: android
has answer: http://stackoverflow.com/a/23332696
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23210760
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35506232
type: Question
answer count: 2

http://stackoverflow.com/a/22864922
answers question: http://stackoverflow.com/q/22864841
type: Answer
score: 1
upvote count: 1
has body: Since BigInteger is an object, you should rather use equals. You use == or != to compare reference of the objects. !(a.gcd(n).equals(BigInteger.ONE));
downvote count: 0

http://stackoverflow.com/comment/34957601
comment on: http://stackoverflow.com/a/22903449
score: 0
type: AnswerComment
has text: Ya, I all-ready created but how i update the content of adapter?
type: Comment

http://stackoverflow.com/comment/34943514
type: QuestionComment
has text: If I remove the selection change listener then the double click listener works fine but it does not work when there is a selection change listener for the same tree. When I debugged the code I found out that, Object item = ((IStructuredSelection) selection).getFirstElement(); has an error wherein getFirstElement() returns null.
comment on: http://stackoverflow.com/q/22861853
score: 0
type: Comment

http://stackoverflow.com/comment/35006870
type: Comment
comment on: http://stackoverflow.com/a/22932335
score: 0
type: AnswerComment
has text: By referring to it as `Map` you are allowed to use any of the subclasses of type `Map`. By referring to it as `HashMap`, you hugely limit the classes that you can use here.

http://stackoverflow.com/comment/35045560
type: QuestionComment
has text: @JqueryLearner i am working on that okey i will let u know :)
comment on: http://stackoverflow.com/q/22952685
score: 0
type: Comment

http://stackoverflow.com/comment/34809104
has text: What does `WorkerSearchParamsDto` contain?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22822744

http://stackoverflow.com/q/22815199
type: UnansweredQuestion
tagged with: package
has answer: http://stackoverflow.com/a/52929630
tagged with: java
tagged with: noclassdeffounderror
type: Question
has comment: http://stackoverflow.com/comment/34814390
has comment: http://stackoverflow.com/comment/34795095
has comment: http://stackoverflow.com/comment/34814310
tagged with: program-entry-point
has comment: http://stackoverflow.com/comment/34795144
score: 0
has comment: http://stackoverflow.com/comment/34814321
answer count: 1
has comment: http://stackoverflow.com/comment/34795035
has body: I get "Exception in thread "main" java.lang.NoClassDefFoundError" while using "package" if I comment "//package com.kevin.corejava; " it would run successfully; Or, I delete the "main" method in "Employee.java", and add a class "Test.java" in folder "E:\Space\java" which imports "Employee.java" (import com.kevin.corejava.*), and reference Employee int its main method, it would still run successfully. Why the "main" method in Employee could not run by itself when I add the sentence "package com.kevin.corejava" (Employee.java is put in path E:\Space\java\com\kevin\corejava\Employee.java) package com.kevin.corejava; import java.util.*; import static java.lang.System.*; public class Employee { public Employee(String n, double s, int year, int month, int day) { name = n; salary = s; GregorianCalendar calendar = new GregorianCalendar(year, month-1,day); hireDay = calendar.getTime(); } public String getName() { return name; } public double getSalary() { return salary; } public Date getHireDay() { return hireDay; } public void raiseSalary(double byPercent) { double raise = salary *byPercent/100; salary+=raise; } private String name; private double salary; private Date hireDay; public static void main(String[] args) { System.out.println("This is main ,I won't say 'Hello World'!"); } }
has title: I get strange error while using package" Exception in thread "main" java.lang.NoClassDefFoundError. "
tagged with: exception

http://stackoverflow.com/a/22930428
has comment: http://stackoverflow.com/comment/35003621
has comment: http://stackoverflow.com/comment/35004192
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22930254
answers question: http://stackoverflow.com/q/22930254
downvote count: 0
has body: Your error is your parsing. Lowercase m means minutes, not month: SimpleDateFormat s2 = new SimpleDateFormat("dd/mm/yyyy"); should be: SimpleDateFormat s2 = new SimpleDateFormat("dd/MM/yyyy"); Here's a simplified example: String d1 = "21/1/2014"; String d2 = "19/1/2014"; SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date dateOne = sdf.parse(d1); Date dateTwo = sdf.parse(d2); long diff = dateOne.getTime() - dateTwo.getTime(); int differenceInDays = (int) (diff / 1000 / 60 / 60 / 24 / 1); System.out.println(differenceInDays); Prints: 2
has comment: http://stackoverflow.com/comment/35003452
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35003553
type: Answer

http://stackoverflow.com/a/22933127
has comment: http://stackoverflow.com/comment/35007814
has body: I don't think it's your code but you are trying to insert an entry with the same primary key to the database. Duplicate entry '' for key 'PRIMARY' This means the item you're inserting has '' (null) as pirmary key and you have already inserted an item with this key. The problem might be that you are creating the table but it is already there from the previous run. When you are creating a new table always try to DROP first.
has comment: http://stackoverflow.com/comment/35007917
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/35012190
answers question: http://stackoverflow.com/q/22933080
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35055993
has text: can't understand what have you written here.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22936596

http://stackoverflow.com/q/22811885
accepted answer: http://stackoverflow.com/a/22812124
tagged with: java
type: AnsweredQuestion
has body: I read the method here to create the label of node through embedded Java Api. But in my problem the label is dynamic because of correction. So, is there a way to change the label? Without this facility the alternate solution I have thought is to create nodes of 'labels' and create edge from entity node to that 'label' node. But this may lead to some disadvantages as not able to make use of index over the label.
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/22812124
tagged with: neo4j
score: 1
has title: How to change label of a node in neo4j?
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/34802508
comment on: http://stackoverflow.com/q/22819287
score: 1
has text: Mostly possibly - Copyright.
type: Comment
type: QuestionComment

rtmp
tag name: rtmp
tags question: http://stackoverflow.com/q/22909434
type: Tag

http://stackoverflow.com/comment/34800372
score: 0
comment on: http://stackoverflow.com/q/22818138
type: Comment
type: QuestionComment
has text: https://www.google.co.uk/search

opennlp
type: Tag
tags question: http://stackoverflow.com/q/22905919
tags question: http://stackoverflow.com/q/22956143
tags question: http://stackoverflow.com/q/22880577
tag name: opennlp

http://stackoverflow.com/comment/34921146
has text: Yes anagram is not the good word for what this user try to test.
comment on: http://stackoverflow.com/a/22885017
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34902824
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22873405
has text: I made a custom class for this and it works great! Just have to wait 8 hours till I can answer my own question because I have below 10 reputation.
score: 0

http://stackoverflow.com/q/22942493
has answer: http://stackoverflow.com/a/22944989
has title: Skip printing every n-th value on the x-axis for an iText/JFreeChart bar chart?
score: 0
tagged with: graphing
type: UnansweredQuestion
has body: I realize that this question has been asked before, but other solutions have not worked out for me and I'm hoping others could find where the inconsistencies may lie. I'm using JFreeChart in iText and building a bar chart using this method below: DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); String rowKey = "score"; for(int i = 0; i &lt;= 100; i++) { double frequency = Collections.frequency(scoreList,i); dataSet.setValue(frequency, rowKey, i+""); } JFreeChart chart = ChartFactory.createBarChart("", "Score Distribution (%)", "Count", dataSet, PlotOrientation.VERTICAL, false, true, false); It's a pretty simple way to make a chart (although I don't know what the false, true, false means within the createBarChart() method). The problem is that there are 101 values on the x-axis and they don't all fit onto the screen/page. I've tried drawing only every 2/3/n-th value, but that causes the graph to become something different entirely, so I only want the labels to appear less, not the actual values and graph bars themselves. Every other solution presented on stackoverflow has suggested using XYPlot. But when I try to use XYPlot, I get: java.lang.ClassCastException: org.jfree.chart.plot.CategoryPlot cannot be cast to org.jfree.chart.plot.XYPlot. Although the language here appears straightforward, I don't know why this error appears. Is it because it's strictly a bar graph that's causing this error? I've been able to do this: CategoryPlot plotCat = (CategoryPlot) chart.getPlot(); ValueAxis yAxis = plotCat.getRangeAxis(); CategoryAxis xAxis = (CategoryAxis) plotCat.getDomainAxis(); So it seems like the x- and y-axes require different types of axis names? I'm confused about this too. In short: how do I skip printing every n-th label on my x-axis for a bar chart?
tagged with: plot
tagged with: java
has answer: http://stackoverflow.com/a/23153498
tagged with: itext
tagged with: jfreechart
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/10913201

http://stackoverflow.com/q/22864465
tagged with: maven
answer count: 1
tagged with: maven-release-plugin
has answer: http://stackoverflow.com/a/22900229
tagged with: svn
tagged with: java
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34884197
accepted answer: http://stackoverflow.com/a/22900229
type: Question
has body: I just used maven-release-plugin to release a version, obviously :) The scm configuration in my parent pom is as follows: scm:svn:http:/localhost/svn/project/trunk/project/3. Implementation/02 Source code As you can see, after trunk we have several more folders (RUP-style) before reaching the source code. A mvn release:prepare results in the following scm configuration: scm:svn:http://localhost/svn/project/tags/project-1.0.0/02 Source code So, somehow, maven-release-plugin manages to replace trunk/project/3. Implementation/02 Source code with tags/project-1.0.0/02 Source code. Why would this not be tags/project-1.0.0, as I would expect? If I would run mvn release:perform the plugin would checkout the entire 3. Implementation directory. For reference, my plugin definition is as follows: org.apache.maven.plugins maven-release-plugin 2.5 http://localhost/svn/project/tags
has comment: http://stackoverflow.com/comment/34883920
upvote count: 2
has title: maven-release-plugin tag creation

http://stackoverflow.com/a/22884907
upvote count: 3
type: Answer
score: 3
has body: Make that: double check = 3.0 / 4; and it'll work. You got 0 because 3 / 4 is an integer division, whose value is 0.
accepted answer of: http://stackoverflow.com/q/22884892
answers question: http://stackoverflow.com/q/22884892
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22914268
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22909429
type: Answer
score: 14
upvote count: 14
has body: (I'm answering my own question) Here is my current solution. It is derived from this source : https://github.com/ultrakain/AndroidBitmapUtil (thanks to ultrakain and @Francescoverheye ) I just fix a little bug in computation of the dummy bytes that must be added to each row (so that the length of each row in bytes is a multiple of 4 (as required by the bmp format specifications). I also made some changes to improve the performances. import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import android.graphics.Bitmap; import android.util.Log; public class AndroidBmpUtil { private static final int BMP_WIDTH_OF_TIMES = 4; private static final int BYTE_PER_PIXEL = 3; /** * Android Bitmap Object to Window's v3 24bit Bmp Format File * @param orgBitmap * @param filePath * @return file saved result */ public static boolean save(Bitmap orgBitmap, String filePath) throws IOException { long start = System.currentTimeMillis(); if(orgBitmap == null){ return false; } if(filePath == null){ return false; } boolean isSaveSuccess = true; //image size int width = orgBitmap.getWidth(); int height = orgBitmap.getHeight(); //image dummy data size //reason : the amount of bytes per image row must be a multiple of 4 (requirements of bmp format) byte[] dummyBytesPerRow = null; boolean hasDummy = false; int rowWidthInBytes = BYTE_PER_PIXEL * width; //source image width * number of bytes to encode one pixel. if(rowWidthInBytes%BMP_WIDTH_OF_TIMES&gt;0){ hasDummy=true; //the number of dummy bytes we need to add on each row dummyBytesPerRow = new byte[(BMP_WIDTH_OF_TIMES-(rowWidthInBytes%BMP_WIDTH_OF_TIMES))]; //just fill an array with the dummy bytes we need to append at the end of each row for(int i = 0; i &lt; dummyBytesPerRow.length; i++){ dummyBytesPerRow[i] = (byte)0xFF; } } //an array to receive the pixels from the source image int[] pixels = new int[width * height]; //the number of bytes used in the file to store raw image data (excluding file headers) …
has comment: http://stackoverflow.com/comment/41355314
has comment: http://stackoverflow.com/comment/44939019
accepted answer of: http://stackoverflow.com/q/22909429

http://stackoverflow.com/comment/34934299
has text: @peeskillet I did not try that yet, i think i will have to change the background into an image and then try, I will try,....
type: Comment
comment on: http://stackoverflow.com/a/22892065
score: 0
type: AnswerComment

casting
tags question: http://stackoverflow.com/q/22887218
tags question: http://stackoverflow.com/q/22815733
tags question: http://stackoverflow.com/q/22903106
tag name: casting
type: Tag
tags question: http://stackoverflow.com/q/22896743
tags question: http://stackoverflow.com/q/22934467
tags question: http://stackoverflow.com/q/22923372
tags question: http://stackoverflow.com/q/22813934
tags question: http://stackoverflow.com/q/22949031

http://stackoverflow.com/comment/34999634
has text: @Unknown, I have added untested code which should get you pretty close.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22927931
type: Comment

http://stackoverflow.com/comment/34788213
has text: @Namalak: No, my question was *which* of those you weren't sure on. Basically the existing questions provide answers to both - it would just change which I'd cast a close vote on...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22811261

http://stackoverflow.com/comment/34895810
has text: http://mvnrepository.com/artifact/org.springframework/spring-expression/3.1.0.RELEASE
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22870058

http://stackoverflow.com/q/22933493
tagged with: httpclient
tagged with: ssl
has title: Android No peer certificate exception
has comment: http://stackoverflow.com/comment/35011877
has body: In my Android application I use http link for get JSON response from server, now they changed to https. My code is return No peer certificate exception. What the things need to get response from server using https in Android. This is the code I used for get response from server for http. public static DefaultHttpClient httpClient; public static ResponseHandler&lt;String&gt; resHandler; public static List&lt;NameValuePair&gt; nameValuePairs; public static HttpPost httpPost; .... httpClient = new DefaultHttpClient(); resHandler = new BasicResponseHandler(); httpPost = new HttpPost("https://www.xxx.com/.../user/renting"); nameValuePairs = new ArrayList&lt;NameValuePair&gt;(6); nameValuePairs.add(new BasicNameValuePair("parking_spot_id".trim(), spotID)); .... for (int i = 0; i &lt; array.length; i++) { nameValuePairs.add(new BasicNameValuePair("date[]", array[i])); } try { httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); jsonResponse = httpClient.execute(httpPost, resHandler); Log.e("rent by day", jsonResponse); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } The above code working well for using http. 1) What are the things I need to get for https. 2) What are the changes in the code. Please help me.
downvote count: 0
has comment: http://stackoverflow.com/comment/47862499
linked to: http://stackoverflow.com/q/9531710
favorite count: 0
has comment: http://stackoverflow.com/comment/35008440
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35010789
tagged with: android
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: https
type: Question

http://stackoverflow.com/comment/34958580
type: Comment
has text: one thing I observed that if I tried this String s,t; s="null"; if(s=="null") { System.out.println("null"); } t=country[23]; if(t=="null") { System.out.println("null"); } with string s its executing print stmt.but not in the case of t.is it bcoz I am reading it from csv file.using string array
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22903912

http://stackoverflow.com/comment/34824514
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22831529
has text: you can manually draw your view to canvas..but it does not make sense, Android does it for you..
score: 0

http://stackoverflow.com/a/22851880
score: 4
accepted answer of: http://stackoverflow.com/q/22850721
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22850721
has comment: http://stackoverflow.com/comment/34863619
has comment: http://stackoverflow.com/comment/34862314
type: Answer
has comment: http://stackoverflow.com/comment/34862323
upvote count: 4
downvote count: 0
has body: This output definitely shows a problem with the logic of the game. Note that it does change from the red square (representing 'blank') to the green circle when the button(s) is(/are) clicked. But it never flips from Player X to Player Y (or vice-versa). As to why you are not seeing any change, I can only conclude one of 3 things: The images are not where you think they are. The images are not named what you think they are. (E.G. x.png != X.png || x.PNG) The images are not using an internal format understood by Java. Try displaying them directly in a JOptionPane. Tips Don't use an ImageIcon to load an image, it does not give feedback. Instead use ImageIO.read(..) which provides lots of helpful feedback. Source This is the slightly altered source used. It hot-links to 3 images (so that users of the code can see it work or fail). import java.awt.*; import java.awt.event.*; import java.net.URL; import javax.swing.*; public class TicTacToe extends JFrame { private static final String TITLE = "Tic Tac Toe"; private static final int width = 600; private static final int height = 800; private Container content; private JButton exitbutton; private JButton initbutton; private JButton[] spaces = new JButton[9]; private CellButtonHandler[] cellHandler = new CellButtonHandler[9]; private InitButtonHandler inithandler; private ExitButtonHandler exithandler; private JLabel turn; private URL base; private Image o, x, blank; private Font myfont = new Font("Times New Roman", Font.BOLD, 78); private ImageIcon icon; private ImageIcon iconx; private ImageIcon icono; private boolean gameover; private boolean turnX; public TicTacToe() { setTitle(TITLE); try { URL url = new URL("https://i.sstatic.net/F0JHK.png"); icon = new ImageIcon(url); URL urlx = new URL("https://i.sstatic.net/T5uTa.png"); iconx = new ImageIcon(urlx); URL urlo = new URL("https://i.sstatic.net/yoKxT.png"); icono = new ImageIcon(urlo); } catch (Exception e) { e.printStackTrace(); } setSize(width, height); setDefaultClose…
has comment: http://stackoverflow.com/comment/34863311

http://stackoverflow.com/a/22889429
has body: You need to put all your code in the onCreateView of the PlaceholderFragment class, before: return rootView; This the new way to code in android.
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22889335

http://stackoverflow.com/comment/35034583
type: Comment
score: 2
type: QuestionComment
has text: `I want to ENFORCE that a subclass of AbstractDiet is always implemented in a subclass of AbstractAnimal.` This statement doesn't make sense. You don't implement a variable or field. You initialize it. What are you really asking?
comment on: http://stackoverflow.com/q/22947781

http://stackoverflow.com/q/22895368
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34949402
tagged with: spring
linked to: http://stackoverflow.com/q/4490138
score: 1
tagged with: java
tagged with: hibernate
tagged with: h2
upvote count: 1
type: Question
has title: How to populate H2 in-memory DB from a file (populate.sql)?
has answer: http://stackoverflow.com/a/22896397
has body: I want to add H2 in-memory db to my Spring MVC application. For ORM I’m using Hibernate. Here is my configs: [hibernate.cfg.xml] <?xml version="1.0" encoding="utf-8"?> <hibernate-configuration> org.h2.Driver jdbc:h2:~/myDB org.hibernate.dialect.H2Dialect sa qwerty true create <mapping class="de.alf.h2.entity.Student"/> </hibernate-configuration> [data.xml] <bean:beans xmlns:bean="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:ctx="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/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 transaction-manager="transactionManager"/> <ctx:component-scan base-package="de.alf.h2.repository"/> <bean:bean id="template" class="org.springframework.orm.hibernate3.HibernateTemplate"> <bean:property name="sessionFactory" ref="sessionFactory"/> </bean:bean> <bean:bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <bean:property name="configLocation" value="classpath:/hibernate/hibernate.cfg.xml"/> </bean:bean> <bean:bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <bean:property name="sessionFactory" ref="sessionFactory"/> </bean:bean> </bean:beans> [web.xml] mvc-dispatcher org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/mvc.xml 1 mvc-dispatcher / contextConfigLocation /WEB-INF/data.xml org.springframework.web.context.ContextLoaderListener I need to create db from a file (resource/db/data.sql). CREATE TABLE student { id INT NOT NULL AUTO_INCREMENT, name VARCHAR (250) } How to do this in my cod…
answer count: 2
has answer: http://stackoverflow.com/a/22896267
downvote count: 0
has comment: http://stackoverflow.com/comment/34940594
favorite count: 0

http://stackoverflow.com/comment/34910425
has text: There's no need to store `_collOfColl` at all.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22878850
type: AnswerComment

http://stackoverflow.com/comment/35069709
type: Comment
comment on: http://stackoverflow.com/q/22967710
score: 2
has text: What is the problem? Your findTest method never gets called? Exception happens?
type: QuestionComment

http://stackoverflow.com/q/22924619
tagged with: freemarker
type: Question
has answer: http://stackoverflow.com/a/23125209
tagged with: templates
has answer: http://stackoverflow.com/a/22997713
score: 0
answer count: 2
has title: Freemarker Customize TemplateCache storage want to read the information from TemplateKey
tagged with: java
tagged with: caching
linked to: http://stackoverflow.com/q/22924831
tagged with: customization
type: UnansweredQuestion
has body: I have my own customized freemarker template storage configured over freemarker, it is working fine. Recently I want to make some changes on the cache management, I need to read the properties from the cache key which is typeof "TemplateKey". Unfortunately the "TemplateKey" is "private final static class". I have no access to this class and I cannot cast the Key object back into TemplateKey object. I see the simplest way is to make source code change in TemplateCache.java to update the TemplateKey to be expose as public class. Question to Freemarker designer: Is it any special reason to make this TemplateKey not be exposed? Is it possible to expose it in next build? Thanks. Rocky

http://stackoverflow.com/comment/34851223
type: QuestionComment
has text: try one test and copy the FooTbl.hbm.xml to the class folder, the same that you have your .class file located
score: 0
comment on: http://stackoverflow.com/q/22846410
type: Comment

http://stackoverflow.com/q/22942041
answer count: 2
upvote count: 1
has title: How to make an exe file to run in all systems which don't having JVM?
type: UnansweredQuestion
has body: I recently developed an desktop application using java....i made .exe file using launch4j... It gets executed on machines that have only JVM... Propose me a way to make it executable on machines that don't have JVM
downvote count: 0
has answer: http://stackoverflow.com/a/22942181
has comment: http://stackoverflow.com/comment/35024132
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/22942241
tagged with: java

http://stackoverflow.com/q/22874849
has body: What's the preferred/recommended way to hande the query part of URLs like: (?)attr=value&amp;attr=value2&amp;attr2=value Specificially the conversion between Map&lt;String,String&gt; and query string url encoded form. Is there any sane implementation that takes care of encoding special chars like &amp; and =? How about "=" in the attr name? Are there any related RFCs?
tagged with: encoding
tagged with: url
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22874896
has title: URL query part composition and decomposition
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22874896
tagged with: java

http://stackoverflow.com/q/22915430
has comment: http://stackoverflow.com/comment/34975705
favorite count: 0
type: UnansweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/34975892
has comment: http://stackoverflow.com/comment/34976211
tagged with: java
tagged with: file
type: Question
score: -2
tagged with: arrays
has answer: http://stackoverflow.com/a/22915590
downvote count: 2
has comment: http://stackoverflow.com/comment/34975910
answer count: 1
has title: How to add elements stored in a file to an array?
has body: I have a file which contains data elements as follows: 1749 12426 19597 38042 43350 52873 67704 75875 81829 96307 11615 16454 20015 27021 52762 66631 70625 83951 96527 96893 3370 5530 28692 39087 50591 59442 61906 69337 70643 91162 1947 4604 9657 16455 21149 22739 32809 66089 73871 97304 3429 5325 7888 24101 28851 31637 32424 57991 62470 65017 I am facing problem to add each element of the file on different index of array. While searching from internet i was only able to store all of the first row on index array[0]. (All line was stored on the index[0]) I want to store all the column elements array array[0] = 1749 array[1] = 11615 array[2] = 3370 array[3] = 1947 array[4] = 3429 In second pass: array[0] = 12426 array[1] = 16454 array[2] = 5530 array[3] = 4604 array[4] = 5325 And so on up to 10th pass..... PLEASE make necessary changes in the code given below: File file = new File("SortedLines.txt"); FileInputStream fis = null; try { fis = new FileInputStream(file); int content; while ((content = fis.read()) != -1) { // convert to char and display it System.out.print((char)content); } } catch (IOException e) { e.printStackTrace(); }

http://stackoverflow.com/comment/35048657
type: Comment
has text: `ojdbc14_g.jar` is very likely a **very old** version, you'd better download a more recent version, and then preferably one for Java 7.
type: AnswerComment
comment on: http://stackoverflow.com/a/22955681
score: 0

http://stackoverflow.com/comment/34896153
type: Comment
has text: Before i try and implement this into my program, i have one qn. Did you test this on Mac first to see the performance? You only mentioned windows.
comment on: http://stackoverflow.com/a/22871371
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34900763
has text: What it's your array Type?, i assumed you're using an int array
comment on: http://stackoverflow.com/a/22873100
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34880488
score: 0
has text: @user3498003 what is `r` object? show some more code
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22862832

http://stackoverflow.com/q/22912155
type: Question
has comment: http://stackoverflow.com/comment/35002161
has title: how to display image plus text in List view using cursor adapter from SQLite?
tagged with: java
has comment: http://stackoverflow.com/comment/35002747
has body: I am getting text absolutely right as what i should get. but image is getting repeated and displaying same image (that is 1st one which i have inserted in database). Code: Samsunglists.java public class Samsunglists extends ListActivity { BaseAdapter adapter = null; Cursor mcursor; static final Class[] classArray = new Class[] { Samsung.class,Samsungs1.class}; @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_samsunglists); Sqlite sqllll = new Sqlite(this); SQLiteDatabase database = sqllll.getReadableDatabase(); ListView lv= getListView(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int pos, long id) { // TODO Auto-generated method stub Intent in = new Intent(Samsunglists.this, classArray[pos]); startActivity(in); } }); mcursor = database.query(Sqlite.TABLE_PRODUCT,new String[] {Sqlite._ID, Sqlite.PRODUCT_IMAGE, Sqlite.PRODUCT_NAME}, null, null, null, null, null, null); startManagingCursor(mcursor); adapter = new ImageCursorAdapter(this, R.layout.samsunglists_entry,mcursor, new String[] {Sqlite.PRODUCT_IMAGE, Sqlite.PRODUCT_NAME}, new int[] {R.id.imageentry, R.id.samsungtype} ); setListAdapter(adapter); adapter.notifyDataSetChanged(); } } code: ImageCursorAdapter.java public class ImageCursorAdapter extends SimpleCursorAdapter { private Cursor c; private Context context; byte[] imgssss; public ImageCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { // TODO Auto-generated constructor stub super(context, layout, c, from, to); this.c = c; this.context = context; } @Override public View getView(int pos, View inView, ViewGroup parent) { // TODO Auto-generated method stub View v = inView; if (v == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(R.layout.samsunglists_entry, n…
score: 0
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/35611609
has comment: http://stackoverflow.com/comment/34999567
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22888982
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22888970
has body: According to the docs, that is the only translate method. So, as you've said, pt.translate(anotherPoint.x, anotherPoint.y); is what you're looking for. Also, accessing the fields of an object is just about as simple as it gets :-)
accepted answer of: http://stackoverflow.com/q/22888970
upvote count: 1

http://stackoverflow.com/a/54216892
answers question: http://stackoverflow.com/q/22931177
downvote count: 0
type: Answer
upvote count: 3
has body: As of now (mongodb 4), you can do the following: mongo shell: db.getCollection('users') .find({}) .collation({'locale':'en'}) .sort({'firstName':1}); mongoose: Users.find({}) .collation({locale: "en" }) .sort({name: 1}) .exec() .then(...) Here are supported languages and locales by mongodb.
score: 3

http://stackoverflow.com/q/22822512
tagged with: mockito
has body: Mockito argument matchers (such as any, argThat, eq, same, and ArgumentCaptor.capture()) behave very differently from Hamcrest matchers. Mockito matchers frequently cause InvalidUseOfMatchersException, even in code that executes long after any matchers were used. Mockito matchers are beholden to weird rules, such as only requiring the use of Mockito matchers for all arguments if one argument in a given method uses a matcher. Mockito matchers can cause NullPointerException when overriding Answers or when using (Integer) any() etc. Refactoring code with Mockito matchers in certain ways can produce exceptions and unexpected behavior, and may fail entirely. Why are Mockito matchers designed like this, and how are they implemented?
has answer: http://stackoverflow.com/a/33547873
accepted answer: http://stackoverflow.com/a/22822514
upvote count: 151
favorite count: 0
has answer: http://stackoverflow.com/a/22822514
linked to: http://stackoverflow.com/q/6800590
possible better answer: http://stackoverflow.com/a/33547873
linked to: http://stackoverflow.com/q/8348046
type: AnsweredQuestion
has title: How do Mockito matchers work?
tagged with: java
downvote count: 3
type: Question
score: 148
answer count: 2
tagged with: mocking

http://stackoverflow.com/comment/34818682
type: AnswerComment
has text: i want to lunch my application as broadcast receiver tigger
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22811565

http://stackoverflow.com/q/22902995
favorite count: 0
has title: Cant find file using FileReader
has comment: http://stackoverflow.com/comment/34953609
tagged with: filereader
accepted answer: http://stackoverflow.com/a/22903024
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34953623
has answer: http://stackoverflow.com/a/22903024
has comment: http://stackoverflow.com/comment/34953646
answer count: 1
has body: I'm working on a project for my class and we are supposed to read in a file called sampleSearch.txt included below is the code that I'm working with. The problem is that through eclipse I can't seem to be able to actually load the file in. It always comes up with File Not Found even though the text file is in the same directory as the rest of the code. import java.util.*; import java.io.*; public class Driver{ public static void main (String[] args){ // try block needed to read in file try { //open the file "sampleSearch.txt" FileReader fileName = new FileReader("sampleSearch.txt"); Scanner fileRead = new Scanner(fileName); //read in the number of rows int numRow = fileRead.nextInt(); fileRead.nextLine(); //read in the number of columns int numCol = fileRead.nextInt(); fileRead.nextLine(); //create a 2d array to hold the characters in the file char[][] array = new char[numRow][numCol]; //for each row in the file for (int r = 0; r &lt; numRow; r++) { //read in the row as a string String row = fileRead.nextLine(); //parse the string into a sequence of characters for (int c = 0; c &lt; numCol; c++) { //store each character in the 2d array array[r][c] = row.charAt(c); } } //create a new instance of the WordSearch class WordSearch ws = new WordSearch(array); //play the game ws.play(); } catch (FileNotFoundException exception) { //error is thrown if file cannot be found. See directions or email me... System.out.println("File Not Found gribble"); } } }

http://stackoverflow.com/comment/35040583
type: Comment
has text: How to do that? All I got till now is, you have to keep calling r.keyPress() repeatedly in order to make it hold down a key = infinite loop
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22950567

http://stackoverflow.com/comment/34935369
comment on: http://stackoverflow.com/q/22893045
score: 0
type: Comment
type: QuestionComment
has text: "Doesn't work" is not very helpful - can you be more specific ?

http://stackoverflow.com/q/22821589
answer count: 2
accepted answer: http://stackoverflow.com/a/22821700
tagged with: arrays
tagged with: string
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/22821774
has body: I have an arraylist with the size 0 or .. any size. And I want to turn anything inside into string list. So, suppose the arraylist has the size of 10 and I only want the first 5 elements of it. Instead of doing a for loop, any other efficient method? Thanks.
has answer: http://stackoverflow.com/a/22821774
type: AnsweredQuestion
type: Question
has title: turn range of arraylist into string array
tagged with: java
has answer: http://stackoverflow.com/a/22821700
score: 0

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/22938962
tags question: http://stackoverflow.com/q/22922148
tags question: http://stackoverflow.com/q/22928522
tags question: http://stackoverflow.com/q/22850228

http://stackoverflow.com/comment/58395512
comment on: http://stackoverflow.com/a/23299330
has text: Hi Asher, I'm not really sure what you mean here. If its possible can you explain a bit in detail
type: AnswerComment
score: 0
type: Comment

xslt
tags question: http://stackoverflow.com/q/22860417
tags question: http://stackoverflow.com/q/22835854
tag name: xslt
type: Tag
tags question: http://stackoverflow.com/q/22835382
tags question: http://stackoverflow.com/q/22875043

http://stackoverflow.com/comment/34906023
type: QuestionComment
has text: What exactly are you trying to do? When do you want the `StatesList` Activity to start? When `textTo` is clicked? Or does the list start before the email Activity?
comment on: http://stackoverflow.com/q/22876234
score: 0
type: Comment

http://stackoverflow.com/q/22849372
accepted answer: http://stackoverflow.com/a/22849429
type: Question
has comment: http://stackoverflow.com/comment/34856662
upvote count: 5
score: 5
answer count: 1
downvote count: 0
has title: Java Code Conventions disappeared (where to find)
favorite count: 0
has comment: http://stackoverflow.com/comment/34856690
has body: Well, look here, please: Code Conventions for the Java Programming Language There is nothing to download or view there. I mean, if you try to download anything, you'll get this: "We're sorry, the page you requested was not found.". Could you help me find these conventions. I mean exactly these ones, not any other. These conventions are likely to be found somewhere on the Internet. I can't find, maybe you can. Thank you in advance.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34856755
tagged with: java
has answer: http://stackoverflow.com/a/22849429

http://stackoverflow.com/a/22907261
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22902177
answers question: http://stackoverflow.com/q/22902177
upvote count: 2
type: AcceptedAnswer
has body: Object ready for Garbage collection, Java says that an object becomes available for gc only when the function ends. No it doesn't. I wrote that answer, and it doesn't say any such thing. What it actually says is that the stack slot remains until the function exits. In the case of your code, all the objects created inside the loop except the last one become unreferenced as soon as the next one is created, because the prior reference in the same stack slot is overwritten. See the comment by @Thilo, which says exactly that.

http://stackoverflow.com/a/38660987
has body: This is a basic example for downloading a file that work with dropbox. it does not include an progress of file download, this is just for straight forward file download. This example uses dropbox API v2 using DbxClientV2 try { //output file for download --&gt; storage location on local system to download file OutputStream downloadFile = new FileOutputStream("C:\\....."); try { FileMetadata metadata = client.files().downloadBuilder("/root or foldername here/Koala.jpg") .download(downloadFile); } finally { downloadFile.close(); } } //exception handled catch (DbxException e) { //error downloading file JOptionPane.showMessageDialog(null, "Unable to download file to local system\n Error: " + e); } catch (IOException e) { //error downloading file JOptionPane.showMessageDialog(null, "Unable to download file to local system\n Error: " + e); } Hope this helps and use this example and edit it to work the way you want it to work.
upvote count: 9
type: Answer
has comment: http://stackoverflow.com/comment/81590230
downvote count: 0
answers question: http://stackoverflow.com/q/22837030
score: 9

http://stackoverflow.com/a/22935864
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22932060
has body: I found the cure! I was just needed to use java.net.URI for that: public static String encode(String urlString) throws UnsupportedEncodingException { try { URI uri = new URI(urlString); return uri.toASCIIString(); } catch (URISyntaxException e) { e.printStackTrace(); } } The toASCIIString() escapes the special characters so when the string arrives to the browser it is shown correctly.
type: Answer
accepted answer of: http://stackoverflow.com/q/22932060
score: 0

http://stackoverflow.com/comment/34843720
score: 0
type: Comment
type: QuestionComment
has text: What element is it erroring out on? Can you provide a bit more of the stack trace? Are you confident that your xpath is correct for the initial find element? I would also look hard at using the explicit wait vs the implicit wait. This will allow your code to move forward as soon a the condition is valid.
comment on: http://stackoverflow.com/q/22838549

http://stackoverflow.com/comment/34803802
type: AnswerComment
comment on: http://stackoverflow.com/a/22819857
type: Comment
has text: Setting ```shortestValue``` to ```null``` will give you a ```NullPointerException``` at ```shortestValue.length()```.
score: 0

http://stackoverflow.com/q/22933898
upvote count: 1
has comment: http://stackoverflow.com/comment/35009706
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35009203
has comment: http://stackoverflow.com/comment/35009900
duplicate of: http://stackoverflow.com/q/16035076
has comment: http://stackoverflow.com/comment/35009357
favorite count: 0
has body: Say I have a Java application which handles thousands of users. So for each user action a certain block of code will be executed repeatedly and I am creating millions of temporary objects. I write my method this way. public void myMethod(ClassB a, ClassA b) { ClassC c = null; ClassD d = null; try { c = new ClassC(); d = new ClassD(); // Some code which uses a, b, c, d. } catch (Exception e) { } finally { a = null; b = null; if (c != null) { c = null; } if (d != null) { d = null; } } } Classes can be of any type. (Primitives, Lists or Maps) I would use clear() or reset() functions if available. Is this really helpful for GC or should I let Java handle this on it's own?
type: UnansweredQuestion
tagged with: garbage-collection
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35009312
has comment: http://stackoverflow.com/comment/35009781
has title: How good a practice is this?
has answer: http://stackoverflow.com/a/22933956
linked to: http://stackoverflow.com/q/16035076
score: 0

http://stackoverflow.com/comment/34853573
type: QuestionComment
comment on: http://stackoverflow.com/q/22847390
score: 1
type: Comment
has text: You should **NOT** abuse `MouseInfo` for something like this. As already mentioned in the answer: Use a proper `MouseListener`, and the problem will vanish anyhow.

http://stackoverflow.com/comment/35052012
type: AnswerComment
has text: The mainifest it's ok. There is already that permission.. So i can't understand the problem. About location, so what you exactly suggest? How can i change the code to have the current location in accurately way?
type: Comment
comment on: http://stackoverflow.com/a/22957876
score: 0

http://stackoverflow.com/q/22879321
tagged with: thread-sleep
has answer: http://stackoverflow.com/a/22884808
has comment: http://stackoverflow.com/comment/34910917
has body: I have web application deployed on WebLogic. This web application has a servlet which tries to connect to a DB and if it fails it will wait/pause/sleep for some configured period of time and try to connect to the DB again. (Actually it will wait and try N times, exponentially, and if all the attempts fail, it will return a FAILURE response). In order to wait/ pause between two attempts, I used Thread.sleep(); But in the production environment where 8 weblogic managed servers are running, I found that Thread.sleep() is not reliable. It sleeps more than the configured time. Is there any workaround for this? Update: Here's my code. Please note that I'm calling this from a managed server enlivenment. public final void checkDBHealth() throws Throwable { for (int attempt=0; attempt&lt;BACK_OFF_MAX_ATTEMPTS; attempt++) { try { pauseExponentially(attempt); connect(); execute(); close(); return; } catch (final Throwable th) { if (ExceptionType.NON_RETRIABLE == ExceptionAnalyzer.translate(th) || (BACK_OFF_MAX_ATTEMPTS-1) == attempt) { throw th; // If exception is thrown I send the failure message } } } } private void pauseExponentially(final int attempt) { if (attempt == 0) { return; } final long delay = (long) (((int)Math.pow(BACK_OFF_BASE, attempt)) * THOUSAND); try { Thread.sleep(delay); } catch (IE e) {…} }
type: UnansweredQuestion
tagged with: multithreading
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/34911246
tagged with: workmanagers
tagged with: java
has comment: http://stackoverflow.com/comment/34915328
has comment: http://stackoverflow.com/comment/34910912
answer count: 1
has title: Pause/ Sleep for n seconds in a Java EE environment
score: 0

http://stackoverflow.com/comment/34897434
comment on: http://stackoverflow.com/q/22872004
type: Comment
type: QuestionComment
score: 2
has text: Well stop catching exceptions, swallowing them and returning `null` and you might see what's going wrong. *At least* add logging into your `catch` blocks, ideally catch more specific exceptions, and preferrably don't catch them at all, but let them bubble up to higher level code. Oh, and don't use the parameterless `String.getBytes()` or the `String(byte[])` constructor - always specify an encoding.

http://stackoverflow.com/comment/35003100
type: QuestionComment
has text: Why do you have all that strange code that creates a `Date`, pulls it apart and parses it again?
comment on: http://stackoverflow.com/q/22930254
score: 4
type: Comment

http://stackoverflow.com/comment/34935610
score: 1
comment on: http://stackoverflow.com/q/22893152
has text: First in Java class are used to start with upper case letter. Secondly why are you trying to do that ?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34946178
comment on: http://stackoverflow.com/q/22898822
type: QuestionComment
type: Comment
has text: Posting examples of input and expected output/result could be very useful for us while creating and testing our regexes (not everyone here uses Arabic characters).
score: 0

http://stackoverflow.com/a/22901278
score: 1
has body: They are different characters. one small dash and other is long one
accepted answer of: http://stackoverflow.com/q/22901220
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22901220
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34811364
comment on: http://stackoverflow.com/a/22824082
type: AnswerComment
score: 0
type: Comment
has text: Still throws stack overflow

http://stackoverflow.com/comment/35029578
comment on: http://stackoverflow.com/a/22945062
type: AnswerComment
score: 0
type: Comment
has text: +1, a commutative, associative operator is the best general answer (xor is typical). Due to the specific data set (using just low values), you may want to xor each `1 << (x%32)` instead of just each x. This happens to be optimal for 5*5 values.

http://stackoverflow.com/comment/35857514
score: 0
type: Comment
type: QuestionComment
has text: See the answer to [this thread](http://stackoverflow.com/questions/18751733/how-to-keep-a-bluetooth-connection-when-sphero-is-synchronized-and-i-use-several/18836065#18836065).
comment on: http://stackoverflow.com/q/22908639

http://stackoverflow.com/comment/34987037
has text: @luizcarlosfx Thanks for the explanation. Would you mind puting your original comment as an answer so I can mark that as the solution for this question? Thanks!
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22920475
type: QuestionComment

http://stackoverflow.com/comment/35067664
type: Comment
comment on: http://stackoverflow.com/a/22966310
has text: so you also need to make `int[] temp = new int[5];` this change.i.e., 3->5
type: AnswerComment
score: 0

http://stackoverflow.com/q/22875743
answer count: 2
has body: I'm trying to implement a stack using an array to reverse sound files. Something is looping infinitely, and, after several hours of trying, I can't seem to figure out what it is. Here is my stack: import java.util.EmptyStackException; import java.util.Arrays; public class ArrayStack implements DStack { private int size = 0; private static int DEFAULT_CAPACITY = 10; private Double ArraySt[]; public ArrayStack(){ ArraySt = new Double[DEFAULT_CAPACITY]; for(int i = 0; i &lt; DEFAULT_CAPACITY; i++){ ArraySt[i] = 0.0; } size = ArraySt.length; } public boolean isEmpty(){ boolean empty = true; if(ArraySt != null) { empty = false; } return empty; } public void push(double d){ if(size == ArraySt.length){ increaseCapacity(); } for(int i = 0; i &lt; size; i++){ ArraySt[i] = d; } } public double pop(){ double popped = 0; boolean empty = isEmpty(); if(empty == true){ throw new EmptyStackException(); } for(int i = 0; i &gt; size; i--){ popped = ArraySt[i]; ArraySt[i] = null; } return popped; } public double peek(){ boolean empty = isEmpty(); if(empty == true){ throw new EmptyStackException(); } double stackTop = pop(); return stackTop; } // private Double[] increaseCapacity(){ // int arrayLength = ArraySt.length; // int newCapacity = ArraySt.length*2; // Double[] increaseArray = new Double[newCapacity]; // for(int i = 0; i &lt; arrayLength; i++){ // Double k = ArraySt[i]; // increaseArray[i] = k; // // } // return increaseArray; // } private void increaseCapacity(){ int newCapacity = ArraySt.length; ArraySt = Arrays.copyOf(ArraySt, newCapacity); } } Here is the client program: import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; /** * Read a .dat file and reverse it. * * @version CSE373, 14sp */ public class ReverseRedux { @SuppressWarnings("unused") public static void main(String[] args) { if (args.length != 3) { System.err.prin…
has answer: http://stackoverflow.com/a/22875826
tagged with: arrays
has comment: http://stackoverflow.com/comment/34904742
has comment: http://stackoverflow.com/comment/34904746
has comment: http://stackoverflow.com/comment/34904733
has answer: http://stackoverflow.com/a/22875775
has title: Infinite loop in an array stack
has comment: http://stackoverflow.com/comment/34904760
type: UnansweredQuestion
tagged with: stack
tagged with: java
type: Question
tagged with: infinite-loop
has comment: http://stackoverflow.com/comment/34904786
score: 0

http://stackoverflow.com/comment/35037573
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22926342
has text: I'm 90% sure, that's why i put that validation "if endDate != null", because before that i receive an exception.

http://stackoverflow.com/a/22852721
downvote count: 0
has body: Make a min int and a max int. int min =1; int max =10; // change to 100 for if you wanted it bigger Then when you get their value simply parse it(Parse turns it into an Interger) int value= Integer.parseInt(words); The final while loop would look like this: while( !(number &gt; min &amp;&amp; number &lt;= max) ){ //Your code }
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22852645

http://stackoverflow.com/comment/34853732
type: Comment
comment on: http://stackoverflow.com/a/22847112
type: AnswerComment
has text: please cybersam , can you try to run this file on your machine
score: 0

http://stackoverflow.com/comment/35020388
score: 0
type: AnswerComment
type: Comment
has text: as it is using android log, i think it will be better if you keep it with android, but i dont think all what it will be doing is logging, so i think it will be best if you pass `FacebookInterface` to your handler via constructor
comment on: http://stackoverflow.com/a/22938939

selenium
tags question: http://stackoverflow.com/q/22961564
tags question: http://stackoverflow.com/q/22860429
tags question: http://stackoverflow.com/q/22827163
tags question: http://stackoverflow.com/q/22951392
tags question: http://stackoverflow.com/q/22922997
tags question: http://stackoverflow.com/q/22906028
tags question: http://stackoverflow.com/q/22944202
tags question: http://stackoverflow.com/q/22876762
tags question: http://stackoverflow.com/q/22915267
tags question: http://stackoverflow.com/q/22838585
tags question: http://stackoverflow.com/q/22834774
tags question: http://stackoverflow.com/q/22832996
tags question: http://stackoverflow.com/q/22879486
tags question: http://stackoverflow.com/q/22860417
tags question: http://stackoverflow.com/q/22864729
tags question: http://stackoverflow.com/q/22918763
tag name: selenium
tags question: http://stackoverflow.com/q/22813433
tags question: http://stackoverflow.com/q/22940467
tags question: http://stackoverflow.com/q/22963537
tags question: http://stackoverflow.com/q/22943101
tags question: http://stackoverflow.com/q/22963443
tags question: http://stackoverflow.com/q/22812476
tags question: http://stackoverflow.com/q/22952787
tags question: http://stackoverflow.com/q/22809576
tags question: http://stackoverflow.com/q/22962721
tags question: http://stackoverflow.com/q/22944526
tags question: http://stackoverflow.com/q/22846061
tags question: http://stackoverflow.com/q/22817600
tags question: http://stackoverflow.com/q/22956260
tags question: http://stackoverflow.com/q/22855131
tags question: http://stackoverflow.com/q/22928858
tags question: http://stackoverflow.com/q/22916621
type: Tag
tags question: http://stackoverflow.com/q/22820527
tags question: http://stackoverflow.com/q/22958248
tags question: http://stackoverflow.com/q/22854513
tags question: http://stackoverflow.com/q/22944517
tags question: http://stackoverflow.com/q/22914332
tags question: http://stackoverflow.com/q/22854719
tags question: http://stackoverflow.com/q/22833307
tags question: http://stackoverflow.com/q/22836616

http://stackoverflow.com/comment/34998369
type: Comment
comment on: http://stackoverflow.com/a/22927529
has text: I am using Nimbus look and feel
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34906477
has text: *"another application wich compiled for java 1.6"* It should be able to run on a 1.6+ (which includes 1.7) JRE. Try it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22860997

http://stackoverflow.com/comment/34881510
type: QuestionComment
has text: yeah netbeans creates the JTextArea automatically , it is hidden code and i made public as well but still cant print in it.
comment on: http://stackoverflow.com/q/22863339
score: 0
type: Comment

http://stackoverflow.com/comment/34814364
has text: It's Java standard :-)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22825839
type: Comment

http://stackoverflow.com/comment/34866368
score: 0
type: Comment
type: AnswerComment
has text: this refer to the inner class .. use YourActivityname.this instead
comment on: http://stackoverflow.com/a/22829416

http://stackoverflow.com/comment/35074526
has text: Glad you found the problem. I never used SQLite, but guess it's good to know that there is no DATE column type by default in that DBMS. And yes its easier/faster to sort/compare numbers than a set of characters, so its better :)
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22958690

http://stackoverflow.com/comment/35093115
has text: @LiemVo I updated my getView() function but still getting nothing on my screen. Can you help me out
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22965482

http://stackoverflow.com/q/22856931
has comment: http://stackoverflow.com/comment/34870828
has answer: http://stackoverflow.com/a/22857096
has comment: http://stackoverflow.com/comment/34870267
tagged with: java
has comment: http://stackoverflow.com/comment/34870474
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22857062
has answer: http://stackoverflow.com/a/22857114
has body: I am trying to insert java.util.Date after converting it to java.sql.Timestamp and I am using the following snippet: java.util.Date utilDate = new java.util.Date(); java.sql.Timestamp sq = new java.sql.Timestamp(utilDate.getTime()); But this is giving me sq as 2014-04-04 13:30:17.533 Is there any way to get the output without milliseconds?
has comment: http://stackoverflow.com/comment/34870187
has answer: http://stackoverflow.com/a/22857065
has comment: http://stackoverflow.com/comment/34870671
score: 53
tagged with: sqldatetime
has comment: http://stackoverflow.com/comment/34870720
possible better answer: http://stackoverflow.com/a/22857050
tagged with: sql
has answer: http://stackoverflow.com/a/22857050
has title: Converting java date to Sql timestamp
has comment: http://stackoverflow.com/comment/34870760
has comment: http://stackoverflow.com/comment/34871303
accepted answer: http://stackoverflow.com/a/22857114
has comment: http://stackoverflow.com/comment/34870522
has comment: http://stackoverflow.com/comment/34870160
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/34870598
tagged with: datetime
upvote count: 54
type: AnsweredQuestion

http://stackoverflow.com/comment/34985765
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22920058
has text: @Quincunx - In other words, you've convinced yourself that it's correct. ;)

http://stackoverflow.com/comment/35056598
comment on: http://stackoverflow.com/q/22930813
has text: Because it is a different issue entirely I suggest opening a new question.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35160203
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22940825
type: QuestionComment
has text: It is not since the OTA dll is not supporting in Mac. So I am using QC10. Can you please let me know whether rest api services available in QC10. if so can you please throw some info on that.

http://stackoverflow.com/a/22892356
has body: You can take a look ad java UUID generator, it should be safe to generate unique numbers If you need to retrieve values after generation I think using db solution is the best candidate so you can save them to db
upvote count: 1
has comment: http://stackoverflow.com/comment/34934314
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34934257
answers question: http://stackoverflow.com/q/22892290

http://stackoverflow.com/q/22851513
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34860692
has answer: http://stackoverflow.com/a/22851539
has comment: http://stackoverflow.com/comment/34860755
has body: I want to have a text field and run whatever the user enters into it. So if the user types in, aPackage.AClass.aMethod(parms), it would run that method in the package, class and with those parameters. Is this possible? The reason I want this is so that I can debug my code and put the program into "developer mode" and be able to execute any command.
tagged with: java
has title: Java Run method entered by user
has comment: http://stackoverflow.com/comment/34860775
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22851527
has comment: http://stackoverflow.com/comment/34860695

http://stackoverflow.com/q/22904665
tagged with: java
has body: In our SpringMVC based website, we want to use the LiteDeviceDelegatingViewResolver. We already have a couple of other ViewResolvers configured and we want the LiteDeviceDelegatingViewResolver to take precedence over those. However the LiteDeviceDelegatingViewResolver does not implement the Ordered interface, hence I cannot set an order value on it. It seems Spring uses these values to chain ViewResolvers. Is there another way to make LiteDeviceDelegatingViewResolver take precedence over the other ViewResolvers we have configured? Thanks.
type: Question
has comment: http://stackoverflow.com/comment/34982048
has comment: http://stackoverflow.com/comment/34960097
has title: In SpringMVC, how can I give LiteDeviceDelegatingViewResolver an order value?
score: 0
tagged with: viewrendering
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34957695
tagged with: spring
tagged with: spring-mvc
answer count: 0

http://stackoverflow.com/q/22936972
score: 13
type: Question
has comment: http://stackoverflow.com/comment/35016691
has title: Why Comparator.comparing doesn't work with String::toLowerCase method reference?
has answer: http://stackoverflow.com/a/22938136
tagged with: comparator
answer count: 2
accepted answer: http://stackoverflow.com/a/22938136
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/22945870
tagged with: java-8
has answer: http://stackoverflow.com/a/22937378
has body: I am trying to sort an array of Strings by reverse order (ignoring case), without modifying it, and just printing it. So I am using Java8 stream. But I can't manage to do it. Here is my attempt : package experimentations.chapter02; import java.util.Arrays; import java.util.Comparator; import java.util.stream.Collectors; public class StringStream { public static void main(String[] args) { sortStrings(); } public static void sortStrings(){ String[] stringsArray = "The quick brown fox has a dirty ladder".split("\\s+"); System.out.println( Arrays.stream(stringsArray) .sorted(Comparator.comparing(String::toLowerCase).reversed()) .collect(Collectors.toList()) ); } } The problem here is that String::toLowerCase is not accepted in the static method Comparator.comparing. Meanwhile, I managed to sort the array, but modifying it: public static void sortStrings(){ String[] stringsArray = "The quick brown fox has a dirty ladder".split("\\s+"); System.out.println( Arrays.stream(stringsArray) .map(String::toLowerCase) .sorted(Comparator.reverseOrder()) .collect(Collectors.toList()) ); } So, what is the simpliest workaround?
upvote count: 13
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35014901
tagged with: java-stream
linked to: http://stackoverflow.com/q/21751830
tagged with: method-reference
tagged with: java
possible better answer: http://stackoverflow.com/a/22937378

http://stackoverflow.com/comment/34893014
comment on: http://stackoverflow.com/q/22869598
score: 0
type: Comment
type: QuestionComment
has text: it seems to be only for "given " points, i want it to generate itself at random points in the picture

http://stackoverflow.com/q/22816770
upvote count: 3
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22816849
has comment: http://stackoverflow.com/comment/34797878
tagged with: java
linked to: http://stackoverflow.com/q/2540548
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34799966
answer count: 2
linked to: http://stackoverflow.com/q/3061654
favorite count: 0
has body: I'm using Eclipse compiler for java. But how do I check the version number of the compiler?
has title: How do I check which version of Eclipse Compiler am I using?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22817154
has comment: http://stackoverflow.com/comment/34797847
score: 2

javafx
tags question: http://stackoverflow.com/q/22865719
tags question: http://stackoverflow.com/q/22818263
tags question: http://stackoverflow.com/q/22858125
tags question: http://stackoverflow.com/q/22835299
tags question: http://stackoverflow.com/q/22895186
tags question: http://stackoverflow.com/q/22909973
tags question: http://stackoverflow.com/q/22852031
type: Tag
tags question: http://stackoverflow.com/q/22927055
tags question: http://stackoverflow.com/q/22944219
tags question: http://stackoverflow.com/q/22942301
tags question: http://stackoverflow.com/q/22877830
tags question: http://stackoverflow.com/q/22829071
tags question: http://stackoverflow.com/q/22884312
tags question: http://stackoverflow.com/q/22899956
tag name: javafx
tags question: http://stackoverflow.com/q/22950342
tags question: http://stackoverflow.com/q/22953490
tags question: http://stackoverflow.com/q/22935474
tags question: http://stackoverflow.com/q/22812488
tags question: http://stackoverflow.com/q/22889544
tags question: http://stackoverflow.com/q/22844042
tags question: http://stackoverflow.com/q/22958000
tags question: http://stackoverflow.com/q/22961616
tags question: http://stackoverflow.com/q/22834516
tags question: http://stackoverflow.com/q/22916711
tags question: http://stackoverflow.com/q/22902279
tags question: http://stackoverflow.com/q/22870229
tags question: http://stackoverflow.com/q/22848829
tags question: http://stackoverflow.com/q/22840661
tags question: http://stackoverflow.com/q/22910611
tags question: http://stackoverflow.com/q/22892018
tags question: http://stackoverflow.com/q/22902568
tags question: http://stackoverflow.com/q/22946789
tags question: http://stackoverflow.com/q/22910399
tags question: http://stackoverflow.com/q/22872484
tags question: http://stackoverflow.com/q/22914976

http://stackoverflow.com/comment/34998803
type: AnswerComment
has text: Maybe he referred to make them `private` somewhere else.
type: Comment
comment on: http://stackoverflow.com/a/22927750
score: 0

http://stackoverflow.com/q/22965246
tagged with: excel
type: Question
has body: Need help on, I have an Excel file TN FN MN LN Type MR Test1 t1 Test1 abc MR Test2 t2 abc MR t3 Test3 abc MR Test4 t4 Test4 abc My requirements are: read rows from java program check for invalid rows(if either 2nd or 4th column is null/empty then it will be invalid rows and store this row in list1 ) check for valid rows(if neither 2nd or 4th column is not null/empty then it will be valid rows and store this rows in list2) 1) FileInputStream file = new FileInputStream("c:\\test.xls"); //Get the workbook instance for XLS file XSSFWorkbook workbook = new XSSFWorkbook(file); //Get first sheet from the workbook XSSFSheet sheet = workbook.getSheetAt(0); //Iterate through each rows from first sheet Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while(rowIterator.hasNext()) { Row row = rowIterator.next(); //For each row, iterate through each columns Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while(cellIterator.hasNext()) { Cell cell = cellIterator.next(); switch(cell.getCellType()) { case Cell.CELL_TYPE_BOOLEAN: System.out.print(cell.getBooleanCellValue() + "\t\t"); break; case Cell.CELL_TYPE_NUMERIC: System.out.print(cell.getNumericCellValue() + "\t\t"); break; case Cell.CELL_TYPE_STRING: System.out.print(cell.getStringCellValue() + "\t\t"); break; } } System.out.println(""); } file.close(); FileOutputStream out = new FileOutputStream(new File("C:\\Users\\IBM_ADMIN\\Desktop\\test.xls")); workbook.write(out); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } 2) I am stuck here, how can I get the valid and invalid rows? Appreciate your help
tagged with: java
linked to: http://stackoverflow.com/q/15764417
has answer: http://stackoverflow.com/a/22969661
answer count: 1
score: 0
type: UnansweredQuestion
tagged with: file
has title: Read xlsRead from java
has comment: http://stackoverflow.com/comment/35065226

http://stackoverflow.com/comment/128599638
score: 0
has text: std::nullopt is missing _maiden.
type: AnswerComment
comment on: http://stackoverflow.com/a/72793343
type: Comment

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/22839206
tags question: http://stackoverflow.com/q/22862704
tags question: http://stackoverflow.com/q/22886205
type: Tag
tags question: http://stackoverflow.com/q/22946079
tags question: http://stackoverflow.com/q/22830958

http://stackoverflow.com/q/22955312
downvote count: 0
has title: java.lang.StackOverflowError exception arises in some android devices
has comment: http://stackoverflow.com/comment/35048163
favorite count: 0
possible better answer: http://stackoverflow.com/a/22955526
tagged with: android
has answer: http://stackoverflow.com/a/22955526
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22955878
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35047770
type: Question
has body: 1181-1181/com.national.nhl E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.national.nhl, PID: 1181 java.lang.StackOverflowError at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5712) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayoutDirection(ViewGroup.java:5714) at android.view.ViewGroup.resetResolvedLayo…
has comment: http://stackoverflow.com/comment/35048488
has comment: http://stackoverflow.com/comment/35047497
accepted answer: http://stackoverflow.com/a/22955878
has comment: http://stackoverflow.com/comment/35047584
answer count: 2
has comment: http://stackoverflow.com/comment/35047649

http://stackoverflow.com/q/22951719
linked to: http://stackoverflow.com/q/9457900
type: Question
has body: My question is similar to this one (How to get JScrollPanes within a JScrollPane to follow parent&#39;s resizing), but that question wasn't clear and the answer there didn't help me.. I have this SSCCE (using MigLayout): public static final int pref_height = 500; public static void main(String[] args) { JPanel innerPanel = new JPanel(new MigLayout()); innerPanel.setBorder(new LineBorder(Color.YELLOW, 5)); for(int i = 0; i &lt; 15; i++) { JTextArea textArea = new JTextArea(); textArea.setColumns(20); textArea.setRows(5); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); JScrollPane jsp = new JScrollPane(textArea); innerPanel.add(new JLabel("Notes" + i)); innerPanel.add(jsp, "span, grow"); } JScrollPane jsp = new JScrollPane(innerPanel) { @Override public Dimension getPreferredSize() { setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); Dimension dim = new Dimension(super.getPreferredSize().width + getVerticalScrollBar().getSize().width, pref_height); setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); return dim; } }; jsp.setBorder(new LineBorder(Color.green, 5)); JPanel outerPanel = new JPanel(); outerPanel.setBorder(new LineBorder(Color.RED, 5)); outerPanel.add(jsp); JFrame frame = new JFrame(); JDesktopPane jdp = new JDesktopPane(); frame.add(jdp); jdp.setPreferredSize(new Dimension(800, 600)); frame.pack(); JInternalFrame jif = new JInternalFrame("Title", true, true, true, true); jif.pack(); jif.add(outerPanel); jdp.add(jif); jif.pack(); jif.setVisible(true); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } I want the JScrollPane to resize whenever the parent JPanel is resized. Basically, I want the green border to line up with the red border. Right now, the green border stays the same size no matter the red border (unless you resize too small).
has answer: http://stackoverflow.com/a/22952373
possible better answer: http://stackoverflow.com/a/40639858
tagged with: jpanel
has answer: http://stackoverflow.com/a/40639858
answer count: 2
tagged with: jscrollpane
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22952373
has comment: http://stackoverflow.com/comment/35046394
tagged with: swing
type: AnsweredQuestion
tagged with: miglayout
has title: How to get a JScrollPane to resize with its parent JPanel
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/22810214
has answer: http://stackoverflow.com/a/22828561
downvote count: 0
has comment: http://stackoverflow.com/comment/34787240
tagged with: javascript
accepted answer: http://stackoverflow.com/a/22811219
tagged with: struts2-json-plugin
favorite count: 0
has body: I have the following code: xwork-conversion.properties java.math.BigDecimal=demo.BigDecimalConverter BigDecimalConverter.java package demo; import java.math.BigDecimal; import java.util.Map; import org.apache.struts2.util.StrutsTypeConverter; public class BigDecimalConverter extends StrutsTypeConverter{ @Override public Object convertFromString(Map context, String[] values, Class clazz) { System.out.println("BigDecimal : Converting from String : " + values[0]); return new BigDecimal(values[0]); } @Override public String convertToString(Map context, Object value) { String str = ((BigDecimal)value).toPlainString(); System.out.println("BigDecimal : Converted to String : " + str); return str; } } TheAction.java package demo; //imports... public class TheAction extends ActionSupport { private BigDecimal bigField; //with getter and setter public String execute() { return SUCCESS; } } struts.xml &lt;package name="demo" extends="json-default"&gt; &lt;action name="processBig" class="demo.TheAction"&gt; &lt;result type="json"/&gt; &lt;/action&gt; &lt;/package&gt; Observation When request is submitted with some big decimal say "12345678901234567890.123456789123456789", method convertFromString is executed and value is converted to string and prints BigDecimal : Converting from String : 12345678901234567890.123456789123456789 But when response is parsed, method convertToString is not executed as it does not log expected line on standard output. Struts2 internally converts BigDecimal to String and following response is returned. {"bigField":12345678901234567890.123456789123456789} When response is received in JavaScript, it becomes 12345678901234567000, a big loss of value. Questions: Why BigDecimalConverter.convertToString is not being called? Is there any other way to achieve this (without defining corresponding String field and/or String getter)?
upvote count: 6
type: AnsweredQuestion
score: 6
type: Question
has answer: http://stackoverflow.com/a/22811219
has title: Struts2 BigDecimal Converter is not converting to String
tagged with: java
tagged with: bigdecimal
tagged with: struts2
possible better answer: http://stackoverflow.com/a/22828561
answer count: 2

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/22841218

http://stackoverflow.com/comment/34976655
comment on: http://stackoverflow.com/a/22915991
has text: Wow, this may be it! I will check.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22815010
has answer: http://stackoverflow.com/a/22823001
score: 0
has comment: http://stackoverflow.com/comment/34802601
tagged with: sql
answer count: 1
has body: I have @OneToMany mapping in a pojo, and I need to group the resulting list by a column. I have a mapping like the following; @OneToMany(fetch = FetchType.EAGER) @JoinColumn(name = "X", referencedColumnName = "X", insertable = false, updatable = false) @NotFound(action = NotFoundAction.IGNORE) @Fetch(FetchMode.SELECT) public Set&lt;MyType&gt; getSiblings() { return siblings; } I need to add GROUP BY clause to this mapping, is this possible?
tagged with: hibernate-mapping
accepted answer: http://stackoverflow.com/a/22823001
has comment: http://stackoverflow.com/comment/34796311
has title: Hibernate mapping with group by clause?
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
tagged with: group-by

http://stackoverflow.com/comment/35066597
score: 0
type: Comment
type: QuestionComment
has text: @ Luiggi Mendoza I added JavaScript tag to my post, but I don t know why it s not posted ...
comment on: http://stackoverflow.com/q/22965738

http://stackoverflow.com/comment/39578564
has text: @F.Böller If you don't chain, you *need* to store the resulting `IntStream` into itself, if you do not store it, everything is lost.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22918393

http://stackoverflow.com/comment/34926730
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22888078
has text: One definite problem here is that you are declaring a set of `new ContentValues();` and then trying to get the value `Contacts.PHONE` when it is clear that nothing has been added at that point. It's possible that that could be your error.

http://stackoverflow.com/a/22937553
answers question: http://stackoverflow.com/q/22936187
type: Answer
has comment: http://stackoverflow.com/comment/47410078
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/47392859
has body: You can use VisualizationViewer#addPreRenderPaintable to register a Paintable in your VisualizationViewer. This paintable will be invoked before anything else is painted (i.e. before the vertices or the edges are painted). In this paintable, you can compute the bounding box of the vertices that you want to group, and simply paint this as a rectangle. import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; import java.util.Arrays; import java.util.List; import javax.swing.JFrame; import edu.uci.ics.jung.algorithms.layout.FRLayout; import edu.uci.ics.jung.algorithms.layout.Layout; import edu.uci.ics.jung.graph.DirectedSparseGraph; import edu.uci.ics.jung.graph.Graph; import edu.uci.ics.jung.visualization.Layer; import edu.uci.ics.jung.visualization.VisualizationViewer; import edu.uci.ics.jung.visualization.control.AbstractModalGraphMouse; import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; public class JUNGVertexStuffTest { public static void main(String[] args) { JFrame jf = new JFrame(); final Graph&lt;String, String&gt; g = getGraph(); final VisualizationViewer&lt;String, String&gt; vv = new VisualizationViewer&lt;String, String&gt;( new FRLayout&lt;String, String&gt;(g)); final AbstractModalGraphMouse graphMouse = new DefaultModalGraphMouse&lt;String,String&gt;(); vv.setGraphMouse(graphMouse); List&lt;String&gt; verticesInBox = Arrays.asList("v0", "v1"); addVertexGroupPainter(vv, verticesInBox); jf.getContentPane().add(vv); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.pack(); jf.setVisible(true); } private static &lt;V&gt; void addVertexGroupPainter( final VisualizationViewer&lt;V, ?&gt; vv, final Iterable&lt;V&gt; verticesInBox) { vv.addPreRenderPaintable(new VisualizationViewer.Paintable() { @Override public boolean useTransform() { return true; } @Overr…

http://stackoverflow.com/q/22968344
tagged with: bluetooth
has comment: http://stackoverflow.com/comment/35073225
score: 0
has comment: http://stackoverflow.com/comment/35251111
has comment: http://stackoverflow.com/comment/35156876
has comment: http://stackoverflow.com/comment/35073912
linked to: http://stackoverflow.com/q/21858528
tagged with: cordova
answer count: 0
type: UnansweredQuestion
has body: I'm using a cordova plugin to read data from the bluetooth stack (serial) of a BlueTherm probe. I receive the data, but then I can not make sense of it. The JAVA native code is sending me a byte[] with the probe sent packet, which has several different data types in it, including ASCII encoded strings. The ints are little-endian. My problem is how to parse this in JavaScript. I've tried almost everything and it seems nothing cut's it. I even may consider altering the JAVA native code to make it send only the reading, if I manage to parse the array there... Any help would be greatly appreciated!
has comment: http://stackoverflow.com/comment/35287840
has comment: http://stackoverflow.com/comment/35074217
tagged with: java
type: Question
has title: Parse heterogeneous byte array in javascript
tagged with: arrays
tagged with: javascript
has comment: http://stackoverflow.com/comment/35228306
has comment: http://stackoverflow.com/comment/35178134

http://stackoverflow.com/comment/34871429
has text: public void characters(char[] ch, int start, int length) { String value = new String(ch, start, length); if (flag) { if (rootname.equalsIgnoreCase("text")) { data.addElement(value); info.setDistance(value); this gives me the blank statement... sorry I am new at this :/
comment on: http://stackoverflow.com/a/22855871
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22826394
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22822891
type: Answer
has comment: http://stackoverflow.com/comment/34840824
score: 2
has comment: http://stackoverflow.com/comment/66977866
has comment: http://stackoverflow.com/comment/67044158
has body: It turns out after much debugging that the problem is in the aspect that is using the EntityManagerFactory. Given that the aspect is instantiated outside the Spring context, when the context is refreshed, the aspect's references are not updated. Consequently, the aspect is holding a reference to an EMF that is indeed closed - the original EMF from the first unit test. Now I just have to figure out how to get Spring to update/refresh the references when the context is updated.
answers question: http://stackoverflow.com/q/22822891
type: AcceptedAnswer

http://stackoverflow.com/q/22822777
has body: Need help in below code,I am using JFrame as popup to show notification, so when any new notification pops up, it should slowly pop away and then disappear in 20 secs if there is no mouse event. SwingUtilities.invokeLater(new Runnable(){ public void run(){ new Timer(5000,new ActionListner(){ public void actionPerformed(ActionEvent e){ alpha+=increment; if(alpha&gt;=225){ alpha=225; increment=-increment; } if(alpha&lt;=0){ alpha=0; increment=-increment; } frame.setForeground(new color(0,0,0,alpha)); } }).start(); } });
answer count: 1
favorite count: 0
upvote count: 2
tagged with: jframe
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: fadeout
tagged with: swing
downvote count: 1
type: Question
has title: Making JFrame fade away within 20 Sec if there is no mouse event
has answer: http://stackoverflow.com/a/22822846

http://stackoverflow.com/comment/34850693
has text: You said "queue can have multiple consumers". But a queue can have max one consumer(producers can be multiple). Is n't it?So how multiple producers will process the message from single queue? Thats why i was thinking of Topic instead of queue?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22845423

http://stackoverflow.com/q/22832746
answer count: 3
upvote count: 7
tagged with: keyboard-shortcuts
linked to: http://stackoverflow.com/q/22741215
tagged with: keystroke
favorite count: 0
has comment: http://stackoverflow.com/comment/34827215
has title: How to define a shortcut for special keys in Java Swing, e.g. german umlaut key Ä?
has answer: http://stackoverflow.com/a/22832860
tagged with: swing
has comment: http://stackoverflow.com/comment/34826695
linked to: http://stackoverflow.com/q/22807892
tagged with: key-bindings
type: AnsweredQuestion
downvote count: 0
score: 7
tagged with: java
has body: How do I define a keyboard shortcut for top level special keys like german umlaut key Ä? I found a way to map unicode letters that are used for default american layout keys, see here. But the key event for the german umlaut key Ä is: java.awt.event.KeyEvent[KEY_PRESSED,keyCode=0,keyText=Unknown keyCode: 0x0,keyChar='ä',keyLocation=KEY_LOCATION_STANDARD,rawCode=222,primaryLevelUnicode=228,scancode=40] on frame0 The idea is to register a keyboard action: import java.awt.Dimension; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; public class KeyStrokeForGermanUmlaut { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new JFrame(); frame.setPreferredSize(new Dimension(600, 400)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); final JLabel label = new JLabel("Text shall change with shortcut"); panel.add(label); panel.registerKeyboardAction(new AbstractAction() { @Override public void actionPerformed(ActionEvent event) { label.setText("It is working!!!"); } }, KeyStroke.getKeyStroke("control typed Ä"), JComponent.WHEN_IN_FOCUSED_WINDOW); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); } }); } }
accepted answer: http://stackoverflow.com/a/22835592
type: Question
has answer: http://stackoverflow.com/a/22833107
possible better answer: http://stackoverflow.com/a/22833107
has comment: http://stackoverflow.com/comment/34827843
has answer: http://stackoverflow.com/a/22835592
has comment: http://stackoverflow.com/comment/34827010
linked to: http://stackoverflow.com/q/22814845

http://stackoverflow.com/a/22919864
score: 0
has body: You need to assign that number to your array like: int index = -1; if(i%2 == 0){ num[++index] = i; System.out.println("even number " +num[index]); }
type: Answer
has comment: http://stackoverflow.com/comment/34984034
answers question: http://stackoverflow.com/q/22919844
has comment: http://stackoverflow.com/comment/34983840

http://stackoverflow.com/comment/34916428
type: AnswerComment
has text: Thanks for your solution. can you point out why was my program not doing this thing.
type: Comment
comment on: http://stackoverflow.com/a/22881978
score: 0

http://stackoverflow.com/q/22877837
score: 0
answer count: 1
has body: I'm trying to create a table that's going to be like this: | xxxxxxxxx | | x | x | x | .... and i've written this code to do it, but instead it goes all wrong and doesn't come out anything like i would... Label label = new Label("ORTHO", style); label.setWrap(true); label.setWidth(100); Label label1 = new Label("A", style); label1.setWrap(true); label1.setWidth(100); Label label2 = new Label("A", style); label2.setWrap(true); label2.setWidth(100); table.row(); table.add(new Label(label.getText(), style)).width(Gdx.graphics.getWidth()-100); table.row(); table.add(new Label(label1.getText(), style)).width(50).align(Align.left); table.add(new Label(label2.getText(), style)).width(50).align(Align.left); table.debug(); stage.addActor(table); any ideas?
tagged with: libgdx
has title: Cannot create proper tables with libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/34919096
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22878939
tagged with: android
type: Question

http://stackoverflow.com/a/22935107
has comment: http://stackoverflow.com/comment/35011343
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35011358
answers question: http://stackoverflow.com/q/22935073
upvote count: 1
has body: You have to get it with: String[] finalshares=(String[]) request.getSession().getAttribute("fileshares"); This ("fileshares") is the id you've set for the session attribute.

http://stackoverflow.com/q/22879188
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/40480
downvote count: 1
type: Question
has title: JAVA regarding a particular method
possible better answer: http://stackoverflow.com/a/22879225
tagged with: java
score: -1
answer count: 2
has answer: http://stackoverflow.com/a/22879212
accepted answer: http://stackoverflow.com/a/22879212
favorite count: 0
duplicate of: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/22879225
has body: I just got back my Java test paper and there is one question that has been bugging me. There was a question: What is the output of the following program? public class Swap { public static void swap(int[] a){ int temp = a[1]; a[1] = a[0]; a[0] = temp; } public static void main(String[] args){ int[] x = {5,3}; swap(x); System.out.println("x[0]:" + x[0] + " x[1]:" + x[1]); } } The thought that first came to my mind was that this was a trick question. Since the swap method return type was void, I thought that it had no effect on the int[] x array. My answer was x[0]:5 x[1]:3. I was almost certain that I got the correct answer and when I saw that I had been marked wrong, I got confused. I went to try out the actual code on NetBeans and realized that the values in the array actually got swapped! I then went on to test if this was the case for String. I typed in a similar but different code: public class Switch { public static void switch(String s){ s = "GOODBYE"; } public static void main(String[] args){ String x = "HELLO"; switch(x); System.out.println(x); } } The output still printed HELLO instead of GOODBYE. Now my question is why does the method not change the String but it changes the values inside an array?

http://stackoverflow.com/q/22846026
has comment: http://stackoverflow.com/comment/34852092
has answer: http://stackoverflow.com/a/22849421
answer count: 3
has answer: http://stackoverflow.com/a/22847112
has title: how to query an ontology file with jena on eclipse
downvote count: 0
possible better answer: http://stackoverflow.com/a/22849421
has answer: http://stackoverflow.com/a/22855818
has comment: http://stackoverflow.com/comment/34851888
favorite count: 0
has comment: http://stackoverflow.com/comment/34852159
score: 5
tagged with: sparql
type: AnsweredQuestion
has body: I tried to use the following java code in order to soot an ontology and return the instance of the class lion but when I tried to run the file, I'm getting an error on line 16. So I'm waiting for your help please! import com.hp.hpl.jena.rdf.model.*; import com.hp.hpl.jena.util.FileManager; import com.hp.hpl.jena.vocabulary.RDF; import com.hp.hpl.jena.sparql.util.IndentedWriter; import com.hp.hpl.jena.query.*; public class Jungle1 { public static final String jungle_file = "jungle.n3"; public static final String NL = System.getProperty("line.separator") ; public static void main( String[] args ) { // create the simplest model there is // Model m = ModelFactory.createDefaultModel(); // use the file manager to read an RDF document into the model FileManager.get().readModel( m, jungle_file ); log.debug( "We have loaded a model with no. statements = " + m.size() ); String jungle ="http://www.lirmm.fr/jungle#"; String prolog1 = "PREFIX jungle: &lt;"+jungle+"&gt;" ; String prolog2 = "PREFIX rdf: &lt;"+RDF.getURI()+"&gt;" ; // Query string. String queryString = prolog1 + NL + prolog2 + NL + "SELECT ?individu WHERE {?individu rdf:type jungle:Lion }" ; Query query = QueryFactory.create(queryString) ; // Print with line numbers query.serialize(new IndentedWriter(System.out,true)) ; System.out.println() ; // Create a single execution of this query, apply to a model // which is wrapped up as a Dataset QueryExecution qexec = QueryExecutionFactory.create(query, m) ; // Or QueryExecutionFactory.create(queryString, model) ; System.out.println("Les Lions : ") ; try { // Assumption: it’s a SELECT query. ResultSet rs = qexec.execSelect() ; // The order of results is undefined. for ( ; rs.hasNext() ; ) { QuerySolution rb = rs.nextSolution() ; // Get title - variable names do not include the ’?’ RDFNode y = rb.get("individu"); System.out.print("uri : "+y+"--- "); Resource z = (Resource) rb.getResource("individu"); System.out.println("plus simplement "+z.getLocalName()); } } finally { // …
accepted answer: http://stackoverflow.com/a/22847112
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34852024
tagged with: jena
upvote count: 5
tagged with: ontology

deserialization
tags question: http://stackoverflow.com/q/22850205
type: Tag
tags question: http://stackoverflow.com/q/22827860
tags question: http://stackoverflow.com/q/22859722
tag name: deserialization
tags question: http://stackoverflow.com/q/22884209
tags question: http://stackoverflow.com/q/22948881

http://stackoverflow.com/q/22826953
tagged with: sorting
favorite count: 0
possible better answer: http://stackoverflow.com/a/22827003
has title: How To create Array Of 100 With Integers From 1-1000?
answer count: 4
accepted answer: http://stackoverflow.com/a/22826977
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22827003
score: 1
has answer: http://stackoverflow.com/a/28633782
tagged with: java
has body: I know how to create an array of 100 with integers from 1-100 which will be just: int [] array = new int[100]; // Sorted Array of 100 for (int a = 0; a &lt; array.length; a++) { array[a] = a + 1; } But my question is how to create an array of 100 with some sorted integers from 1-1000, inclusive. Any help will be appreciated!
has answer: http://stackoverflow.com/a/22826977
has answer: http://stackoverflow.com/a/22827172
type: Question
upvote count: 2
tagged with: arrays
downvote count: 1

http://stackoverflow.com/a/22856168
downvote count: 2
has body: Why not doing it straight forward? public static void main(String[] args) { String str = "abcdef"; for (int idx = 0; idx &lt; str.length(); idx++) { System.out.printf("Expected %d, found %d\n", idx, indexOf(str.charAt(idx), str, 0)); } System.out.printf("Expected -1, found %d\n", indexOf(str.charAt(0), null, 0)); } public static int indexOf(char ch, String str, int index) { if (str == null || index &gt;= str.length()) return -1; return str.charAt(index) == ch ? index : indexOf(ch, str, ++index); } OUTPUT: Expected 0, found 0 Expected 1, found 1 Expected 2, found 2 Expected 3, found 3 Expected 4, found 4 Expected 5, found 5 Expected -1, found -1
upvote count: 0
has comment: http://stackoverflow.com/comment/80822588
type: Answer
score: -2
answers question: http://stackoverflow.com/q/22856074

http://stackoverflow.com/q/22928173
has comment: http://stackoverflow.com/comment/35000683
has title: To calculate age from DOB and inner join of two tables and then draw Graph
has comment: http://stackoverflow.com/comment/35000058
tagged with: java
has comment: http://stackoverflow.com/comment/34999438
tagged with: mysql
has comment: http://stackoverflow.com/comment/34999304
has body: I have two tables TABLE1 and TABLE2 and through inner join of these two tables I will get the DOB( DD/MM/YYYY format). Now I have to calculate the age using this DOB and then draw a graph based based on this age(using java). I have no idea how to do it. NOTE: I tried to look for this but I couldn't find a suitable solution for it. UPDATE: I know that I can use PrimeFaces easily to draw graph but I for that I need age.I am having problem in getting age. UPDATE Code to get DOB Select TABLE1.dob from TABLE1 INNER JOIN TBALE2 on TABLE1.id = TABLE2.id
downvote count: 1
linked to: http://stackoverflow.com/q/1572110
type: Question
has comment: http://stackoverflow.com/comment/35001076
upvote count: 0
score: -1
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/35000473
favorite count: 0
has comment: http://stackoverflow.com/comment/34999498
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22928410
has comment: http://stackoverflow.com/comment/34999606

http://stackoverflow.com/q/22919337
has answer: http://stackoverflow.com/a/22919521
has comment: http://stackoverflow.com/comment/34982783
has body: The problem is the same as described here But since no solution found there, trying to reopen the topic here? In short, I'm using Apache POI 3.8. I have a *.xlsm file with Macros in it. I am trying to open this file while the application is deployed, but getting the error inside "XSSFWorkbook" constructor which says that "ZIP entry size is too large". The strange part is that I am able to perform that operation locally in my IDEA without any problems. Would appreciate if someone would share the ideas of what is happening, if any had such issue in the past.
tagged with: http://stackoverflow.com/tag/zip
tagged with: apache-poi
upvote count: 5
downvote count: 0
type: UnansweredQuestion
tagged with: excel
has answer: http://stackoverflow.com/a/22943780
has comment: http://stackoverflow.com/comment/34982978
tagged with: java
has title: Why am I getting exception "IOException: ZIP entry size is too large" when trying to open an Excel file using Apache POI?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34999229
score: 5
has comment: http://stackoverflow.com/comment/34993488
tagged with: apache
has comment: http://stackoverflow.com/comment/34983076
favorite count: 0

http://stackoverflow.com/comment/34886477
score: 0
type: QuestionComment
type: Comment
has text: @Gray All the reinitialization is done the Reset button is clicked. The run method just has to do the same thing that it did the first time the Thread started
comment on: http://stackoverflow.com/q/22865783

http://stackoverflow.com/comment/35027826
comment on: http://stackoverflow.com/q/22944057
score: 0
has text: The compiler is not throwing this exception. The runtime is throwing it. The type `O` is correctly resolving to `CodominantOrganism` at compile time, so there must be some other non type safe shenanigans going on at runtime.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35024474
type: Comment
has text: GCJ development seems to be dead. No GUI (awt/swing support) and no updates since 2009
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22942181

http://stackoverflow.com/comment/34885897
comment on: http://stackoverflow.com/q/22865783
score: 0
type: Comment
type: QuestionComment
has text: And please name your thread variables more meaningful than `go` and `newThread`!

http://stackoverflow.com/comment/34922365
comment on: http://stackoverflow.com/q/22885176
score: 0
type: Comment
type: QuestionComment
has text: @BackSlash that will not work

http://stackoverflow.com/comment/34978728
has text: What I see however when running my flow is that the execution of the main flow continues until the end, after the catch (which happens in a flow ref)
comment on: http://stackoverflow.com/q/22901601
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35032586
type: AnswerComment
score: 0
has text: @Harald: Are the tasks given in advance? if so, submit them all (which is a non blocking operation), and then proceed with looping on take(). This is the classic scenario...
type: Comment
comment on: http://stackoverflow.com/a/22946332

http://stackoverflow.com/a/22937878
downvote count: 0
score: 1
has body: Although there is no way around parsing for the proper treatment of your XML data, there is definitely a way around building an in-memory representation of the entire document. Java offers SAX parsing, which is event-based. You can implement an event handler for XML events, ignoring everything on the way to the content that you need, and stopping after retrieving the part that you are looking for. Here is a tutorial from Oracle showing how to use SAX APIs to retrieve counts of individual tags without building a document in memory. Since most XPath processors work with SAX as well, you could potentially feed events to an XPath processor, and look for the desired tag in that way, too. However, this may be an overkill for a situation when you need to fetch a single element.
answers question: http://stackoverflow.com/q/22937716
upvote count: 1
type: Answer

http://stackoverflow.com/comment/35039837
comment on: http://stackoverflow.com/a/22950396
type: AnswerComment
type: Comment
has text: @foodnliquor please see my edit. Hopefully that will help in the future when designing your programming solutions.
score: 0

http://stackoverflow.com/comment/34994263
has text: What about that problem would be any different with ASCII or Unicode?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22925241

http://stackoverflow.com/a/22962539
score: 0
has body: For the desired class structure I think there is no way to achieve exactly what you want, because T is declared as extends Searchable, which can be Searchable or AbstractSearchable, and the proper method will be found based on this information, i.e. the behavior you described and do not want. In order to avoid this problem, you might want to refactor your classes to avoid inheritance of AbstractSearchable and instead delegate matches() calls to some implementation provided to domain object, or maybe in the service.
type: Answer
answers question: http://stackoverflow.com/q/22962383

http://stackoverflow.com/a/26283350
has body: This error means that you have multiple implementations of SLF4J in your classpath. Look for what the errors are specifically saying. i.e : SLf4J: Found binding in..... (This will print all the jar files where it found instances of StaticLoggerBinder.class). Eliminate all such jars from your classpath, except the jar whose StaticLoggerBinder.class implementation you need.
answers question: http://stackoverflow.com/q/22896243
score: 5
has comment: http://stackoverflow.com/comment/92440044
type: Answer
upvote count: 5
downvote count: 0

http://stackoverflow.com/comment/34886376
comment on: http://stackoverflow.com/q/22865976
score: 0
has text: Not sure if I understand your question, are you saying that the current code isn't making the starting button colour blue?
type: Comment
type: QuestionComment

treeview
tags question: http://stackoverflow.com/q/22909973
type: Tag
tags question: http://stackoverflow.com/q/22929908
tag name: treeview

http://stackoverflow.com/comment/34878117
comment on: http://stackoverflow.com/q/22861546
score: 0
type: Comment
type: QuestionComment
has text: Before going further on your project think about what you can offer that Splunk and other alternatives don't offer yet, and then if you still feel that you have something, then go ahead

http://stackoverflow.com/q/22811131
has comment: http://stackoverflow.com/comment/34787448
has answer: http://stackoverflow.com/a/22811259
downvote count: 0
has answer: http://stackoverflow.com/a/22811245
has comment: http://stackoverflow.com/comment/34787280
has body: I'm trying to use an integer stored in a fikle in the values folder but something isn't woring right. Here's the xml: <?xml version="1.0" encoding="utf-8"?> 5 And here is the main activity: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.d("testLog", R.integer.numb+""); } But when I run it the output is: 04-02 14:08:30.044: D/test(14839): 2131099648 Why do I get get 5 instead?
favorite count: 0
accepted answer: http://stackoverflow.com/a/22811176
possible better answer: http://stackoverflow.com/a/22811245
tagged with: android
answer count: 4
type: AnsweredQuestion
has title: How to use an integer resource in Android?
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22811342
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22811176

http://stackoverflow.com/comment/35278782
score: 0
type: Comment
type: QuestionComment
has text: RobotProvider.getDefaultProvider.getRobots() appears strikethrough when you use it in API Sphero 2.0, so it doesn't work.But I'm trying anyways ;)
comment on: http://stackoverflow.com/q/22908639

http://stackoverflow.com/a/24071369
downvote count: 0
answers question: http://stackoverflow.com/q/22914838
score: 1
accepted answer of: http://stackoverflow.com/q/22914838
has body: <?xml version="1.0" encoding="UTF-8"?> <property name="enterMessage" value="Entering $[targetClassName].$[methodName]($[argumentTypes] $[arguments])" /> <property name="exitMessage" value="Leaving $[methodName](): $[returnValue]" /> <aop:config> <aop:advisor advice-ref="customizableTraceInterceptor" pointcut="execution(* fr.my.package.dao..*.*(..))" /> </aop:config> This help me to get trace on each calls of all methods of all classes in fr.my.package.dao package. Thanks to @m-deinum
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/22812329
has answer: http://stackoverflow.com/a/22812453
accepted answer: http://stackoverflow.com/a/22812453
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/34789430
linked to: http://stackoverflow.com/q/271526
has answer: http://stackoverflow.com/a/22812457
has body: I have a situation where I have to copy values from one object to another. For each field the copy statement is wrapped with the following snipped of boilerplate code: if (a.getC() != null) { b.setC(a.getC()); } I had a look at Guava Precondition.checkNotNull(...) but it still throws NPE which I'm trying to evade. How can I do that in a more natural way?
has answer: http://stackoverflow.com/a/22812552
type: Question
type: AnsweredQuestion
has title: how to handle nulls gracefully in Java
has comment: http://stackoverflow.com/comment/34789421
possible better answer: http://stackoverflow.com/a/22812457
tagged with: java
duplicate of: http://stackoverflow.com/q/271526
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/18152765

http://stackoverflow.com/comment/84264364
has text: Does this mean we can click on the JLabel and it will trigger the action of the JRadioButton? Or will clicking on the JLabel do nothing.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22831004

keystroke
type: Tag
tags question: http://stackoverflow.com/q/22832746
tag name: keystroke
tags question: http://stackoverflow.com/q/22883670

http://stackoverflow.com/comment/34800095
type: Comment
comment on: http://stackoverflow.com/a/22815270
type: AnswerComment
has text: Yeah, I forgot about the unfriendly nature of `String`. :)
score: 0

http://stackoverflow.com/a/22812744
has comment: http://stackoverflow.com/comment/34790475
has comment: http://stackoverflow.com/comment/34790220
has comment: http://stackoverflow.com/comment/34808176
downvote count: 0
answers question: http://stackoverflow.com/q/22812706
upvote count: 2
has body: Try this: update=":mainForm:datatable"
type: Answer
has comment: http://stackoverflow.com/comment/34792658
has comment: http://stackoverflow.com/comment/34807869
score: 2

http://stackoverflow.com/a/22820239
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34868875
type: Answer
has comment: http://stackoverflow.com/comment/34863884
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22819845
accepted answer of: http://stackoverflow.com/q/22819845
has body: String cannot be resolved as type This would indicate that you imported a project that expected an Android SDK version that you do not have installed. Go to Project > Properties > Android. In the checklist of Android SDK versions, check one of them, as if I am correct, none are presently checked.

http://stackoverflow.com/q/22960234
score: 0
answer count: 2
has title: Heroku performance measure
tagged with: server-side
has answer: http://stackoverflow.com/a/22960862
has body: I have Java EE application running on heroku. I need measure load of server CPU. app was runing on my virtual server, I used command top. Can I measure load of CPU on heroku server? I need measure server CPU load when I send a lot of requests by JMeter from my desktop.
accepted answer: http://stackoverflow.com/a/22960862
type: AnsweredQuestion
tagged with: heroku
has answer: http://stackoverflow.com/a/22960510
tagged with: performance
tagged with: java
possible better answer: http://stackoverflow.com/a/22960510
type: Question

http://stackoverflow.com/a/22826389
has comment: http://stackoverflow.com/comment/34815322
score: 0
answers question: http://stackoverflow.com/q/22826303
has body: for(int i =10;i&gt;0;i--){ for(int j=i;j&gt;0;j--) System.out.print('*'); System.out.print('\n');//exit main loop }
type: Answer

http://stackoverflow.com/q/22920225
possible better answer: http://stackoverflow.com/a/42651400
tagged with: ejb-3.0
accepted answer: http://stackoverflow.com/a/22925281
has title: where do we provide the JNDI name in EJB 3.0?
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/1008198
type: Question
upvote count: 4
tagged with: jakarta-ee
answer count: 2
has body: I am going through the example doc for EJB on below URL http://docs.oracle.com/cd/E11035_01/wls100/ejb30/examples.html#wp1200600 As far as I know in EJB 2.0 we give JNDI name in deployment descriptor in ejb-jar.xml or weblogic-ejb-jar.xml file but in EJB 3.0, I can not find such descriptor where it contains JNDI name. Can you please suggest where do we provide the JNDI &amp; EJB names so that client can invoke the EJB?
tagged with: jndi
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/22925281
has answer: http://stackoverflow.com/a/42651400
linked to: http://stackoverflow.com/q/14872141
favorite count: 0

http://stackoverflow.com/comment/35048006
score: 0
comment on: http://stackoverflow.com/q/22955479
type: Comment
type: QuestionComment
has text: first tell that what is your applet code ...

http://stackoverflow.com/a/22849947
answers question: http://stackoverflow.com/q/22849827
has comment: http://stackoverflow.com/comment/34893351
upvote count: 3
type: Answer
score: 3
downvote count: 0
has body: Using \Q and \E will actually change the behavior of your regex: as you wrote it, it's going to match LITERALLY that sequence: (.+?)\\nyo(?:(?!cut me:|\\nyo).)*cut me: That is, it's LITERALLY trying to find a parenthesis, followed by a litteral dot, followed a literal +, and so on... To clarify a little: final Pattern PATTERN = Pattern.compile("^\\Q(.+?)\\nyo(?:(?!cut me:|\\nyo).)*cut me:\\E", Pattern.DOTALL); final Matcher m = PATTERN.matcher("(.+?)\\nyo(?:(?!cut me:|\\nyo).)*cut me:"); System.out.println(m.match()); // true

http://stackoverflow.com/a/22967690
accepted answer of: http://stackoverflow.com/q/22967460
score: 1
answers question: http://stackoverflow.com/q/22967460
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: I think it would be helpful to see more code. I noticed that src is not declared in the code snippet. Is src used previously? If it is used previously, it is possible that the buffer for src is not empty. For instance, .nextInt() will leave the enter character in the buffer because it is not an integer. If the enter character is still in the buffer .nextLine() will read it as an empty line. You could just try calling src.nextLine() before .println() and discard the input. That will clear the buffer. Edit: Alright so this is the problem: input=src.nextInt(); You are entering two things, the number and the eol character. The eol character is left in the buffer by .nextInt(), so the next time you call .nextLine() it reads the buffer, sees the eol character, and assumes you just inputted an empty line. Therefore print = "" here: String print=src.nextLine(); I would use two scanners, one for ints, and one for strings. Or just clear the buffer before you call .nextLine().

http://stackoverflow.com/comment/34923978
score: 0
comment on: http://stackoverflow.com/q/22849557
type: QuestionComment
type: Comment
has text: @pokeairguy, `Do you do anything unsure whether its right or not?` - yes I try things and then learn from my mistakes. If you do it wrong, then someone will make a comment. In the same way you didn't post a SSCCE/MCVE with your question so multiple people have made comments. Or you can actually try to read/answer questions other people post in the forums to see how other people ask questions and what kind of information they include with a question. Generally people think "learning by example" applies to writing code, but it can also apply to using a forum or anything else.

http://stackoverflow.com/a/22977814
has body: From the horse's mouth (Oracle Javadoc) complete() Completes the asynchronous operation that was started on the request that was used to initialze this AsyncContext, closing the response that was used to initialize this AsyncContext. Any listeners of type AsyncListener that were registered with the ServletRequest for which this AsyncContext was created will be invoked at their onComplete method. dispatch(String path) Dispatches the request and response objects of this AsyncContext to the given path. ... Control over the request and response is delegated to the dispatch target, and the response will be closed when the dispatch target has completed execution, unless ServletRequest#startAsync() or ServletRequest#startAsync(ServletRequest, ServletResponse) are called. Q/A what's the difference between dispatch and complete? Calling complete tells container to fire onComplete listeners and stop the asynchronous mode, dispatch basically tells container to call complete and then forward the request (internally) to the specified path. The path can be a JSP, a synchronous servlet or even another asynchronous servlet that will trigger a new round of async processing. When I called dispatch inside run the response reached the client, does that mean we can push the response asynchronously like this? On the contrary dispatch closes the asynchrnonous mode and forwards the request to another servlet or JSP. To push data to the client you have to write to Response object associated with the AsyncContext. if I call dispatch first and complete next what is the behaviour of the thread ? Undefined, which is a nice way of saying it depends on how the container is implemented. Maybe it will throw an error, maybe onComplete handlers will be fired twice, maybe call to complete will do nothing, maybe there will be a race condition between your thread and the container in calling handlers and manipulating internal structures of AsyncContext implementation etc. If I call any method after comp…
has comment: http://stackoverflow.com/comment/92677095
upvote count: 18
has comment: http://stackoverflow.com/comment/35163241
downvote count: 0
score: 18
has comment: http://stackoverflow.com/comment/35154180
has comment: http://stackoverflow.com/comment/35222103
type: Answer
has comment: http://stackoverflow.com/comment/92676647
has comment: http://stackoverflow.com/comment/35219920
answers question: http://stackoverflow.com/q/22867311
has comment: http://stackoverflow.com/comment/92338511
has comment: http://stackoverflow.com/comment/49082540
has comment: http://stackoverflow.com/comment/35247466
has comment: http://stackoverflow.com/comment/35202052

http://stackoverflow.com/comment/34898614
type: QuestionComment
has text: YOu are right they are not strictly DAOs ..
comment on: http://stackoverflow.com/q/22872362
score: 0
type: Comment

http://stackoverflow.com/q/22834816
has title: Spring MVC request mapping not working
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
has body: I want to create simple hello world application with one controller. Plain spring without any classes works, but when I add a controller, change xml files (following step-by-step tutorials), and try to open localhost/project/hello.html, it throws me 404 error. package com.beingjavaguys.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller public class HomeController { @RequestMapping("/hello") public ModelAndView test() { String message = "Welcome to Spring 4.0 !"; return new ModelAndView("hello", "message", message); } } web.xml: <?xml version="1.0" encoding="UTF-8"?> contextConfigLocation /WEB-INF/applicationContext.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet 2 dispatcher *.htm 30 redirect.jsp dispatcher-servlet.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> <context:component-scan base-package="com.beingjavaguys.controller" /> indexController </beans> I tried changing @RequestMapping into ("/hello.htm"), adding request type, adding @RequestMapping info the whole class, but nothing works. What's wrong?
score: 9
has comment: http://stackoverflow.com/comment/34830420
has comment: http://stackoverflow.com/comment/34830153
has comment: http://stackoverflow.com/comment/34830095
downvote count: 1
has comment: http://stackoverflow.com/comment/34830217
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
upvote count: 10
type: Question
has answer: http://stackoverflow.com/a/22836171
favorite count: 0
accepted answer: http://stackoverflow.com/a/22836171
has comment: http://stackoverflow.com/comment/34830148
has comment: http://stackoverflow.com/comment/34830259
has comment: http://stackoverflow.com/comment/34830337

http://stackoverflow.com/q/22900900
tagged with: java
has comment: http://stackoverflow.com/comment/35270316
accepted answer: http://stackoverflow.com/a/22974907
possible better answer: http://stackoverflow.com/a/22903403
type: Question
has title: Java Serialization to transfer data between any language
downvote count: 0
has answer: http://stackoverflow.com/a/22974907
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22903403
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/35202043
has answer: http://stackoverflow.com/a/23073793
linked to: http://stackoverflow.com/q/1714624
has body: Question: Instead of writing my own serialization algorithm; would it be possible to just use the built in Java serialization, like I have done below, while still having it work across multiple languages? Explanation: How I imagine it working, would be as follows: I start up a process, that will be be a language-specific program - written in that language. So I'd have a CppExecutor.exe file, for example. I would write data to a stream to this program. The program would then do what it needs to do, then return a result. To do this, I would need to serialize the data in some way. The first thing that came to mind was the basic Java Serialization with the use of an ObjectInputStream and ObjectOutputStream. Most of what I have read has only stated that the Java serialization is Java-to-Java applications. None of the data will ever need to be stored in a file. The method of transferring these packets would be through a java.lang.Process, which I have set up already. The data will be composed of the following: String - Mostly containing information that is displayed to the user. Integer - most likely 32-bit. Won't need to deal with times. Float- just to handle all floating-point values. Character - to ensure proper types are used. Array - Composed of any of the elements in this list. The best way I have worked out how to do this is as follows: I would start with a 4-byte magic number - just to ensure we are working with the correct data. Following, I would have an integer specifying how many elements there are. After that, for each of the elements I would have: a single byte, signifying the data type (of the above), following by any crucial information, e.x: length for the String and Array. Then, the data that follows. Side-notes: I would also like to point out that a lot of these calculations will be taking place, where every millisecond could matter. Due to this, a text-based format (such as JSON) may produce far larger operation times. Considering that non of the packe…
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/34901993
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22874208
has text: It would be more complete if you removed the count variable on your answer I think.

http://stackoverflow.com/q/22964829
has comment: http://stackoverflow.com/comment/35067594
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/22988732
has comment: http://stackoverflow.com/comment/35080548
has title: EclipseLink cache size default... is that Per Entity or Total?
tagged with: caching
has body: Eclipselink offers this config parameter: eclipselink.cache.size.default. It also offers an entity cache size: eclipselink.cache.size.Employee (if you had an entity called Employee. So If I set: eclipselink.cache.size.default=500, does that mean 500 total slots for all entities? Or 500 slots per each type of Entity? Thanks!
tagged with: eclipselink
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22988732

http://stackoverflow.com/q/22968285
has body: How do I include only a single file in sonar build.xml? I know how to exclude selected files for Sonar, but I want to now how to include selected files.
type: Question
has answer: http://stackoverflow.com/a/22972818
has title: How to include only a single file in sonar build.xml
tagged with: sonarqube
answer count: 1
type: UnansweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/a/22871701
downvote count: 0
answers question: http://stackoverflow.com/q/22870488
type: Answer
has comment: http://stackoverflow.com/comment/34898805
score: 14
has body: Or, JsonFactory.setCodec(mapper).
upvote count: 14
has comment: http://stackoverflow.com/comment/34955279

http://stackoverflow.com/a/22966424
answers question: http://stackoverflow.com/q/22965635
score: 1
has comment: http://stackoverflow.com/comment/35068047
has comment: http://stackoverflow.com/comment/35068111
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35067767
has body: Why implement if there is allready JCA APIs? http://docs.oracle.com/javase/7/docs/technotes/guides/security/crypto/CryptoSpec.html It covers Java Security standards, has plenty of implemented algorithms. See also some examples: http://www.flexiprovider.de/examples/ExampleRSA.html Single Asymmetric Key RSA java example Encryption / Decryption
has comment: http://stackoverflow.com/comment/35068260
has comment: http://stackoverflow.com/comment/35068389
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22965635

http://stackoverflow.com/q/22835715
tagged with: java
has body: I'm trying to use a cross parameter constraint validator targeted on method parameters. The problem is the validation is not triggered for the method parameters instead it is triggered for the method return value. I'm using Spring's LocalValidatorFactoryBean. The JSR-303 provider is hibernate-validator 4.2.0.Final. Spring version is 3.2.0. Spring configuration excerpt : &lt;!-- JSR 303 validation --&gt; &lt;bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /&gt; &lt;bean class="org.springframework.validation.beanvalidation.MethodValidationPostProcessor"&gt; &lt;property name="validator" ref="validator"/&gt; &lt;bean&gt; Custom Constraint Validator: @SupportedValidationTarget( ValidationTarget.PARAMETERS ) public class InstanceValidator implements ConstraintValidator&lt;InstanceCheck, Object[]&gt; { @Override public void initialize(InstanceCheck constraintAnnotation) {} @Override public boolean isValid(Object[] value, ConstraintValidatorContext context) { ... } } Annotation: @Target( { METHOD, ANNOTATION_TYPE, CONSTRUCTOR } ) @Retention(RUNTIME) @Constraint(validatedBy = InstanceValidator.class) @Documented public @interface InstanceCheck { String message() default "{constraint.instance.not.allowed}"; public abstract Class&lt;?&gt;[] groups() default {}; public abstract Class&lt;? extends Payload&gt;[] payload() default {}; } SomeService: @Validated public interface SomeService { ... @InstanceCheck public String addContent(String content) throws SomeException; ... } SomeServiceImpl : @Service public class SomeServiceImpl implements SomeService { ... public String addContent(String content) throws SomeException { // do something } ... } : UPDATE : I have tried adding the "validationAppliesTo" method for the annotation type (see below) @Target( { METHOD, ANNOTATION_TYPE, CONSTRUCTOR } ) @Retention(RUNTIME) @Constraint(validatedBy = InstanceValidator.class) @Documented public @interface InstanceCheck { String message() d…
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22848997
accepted answer: http://stackoverflow.com/a/22848997
upvote count: 2
answer count: 2
favorite count: 0
tagged with: hibernate-validator
tagged with: spring
possible better answer: http://stackoverflow.com/a/41242505
has title: Spring 3.2 using cross parameter constraint
score: 2
tagged with: constraints
downvote count: 0
has answer: http://stackoverflow.com/a/41242505

http://stackoverflow.com/q/22872348
has comment: http://stackoverflow.com/comment/34898746
has comment: http://stackoverflow.com/comment/34898194
has comment: http://stackoverflow.com/comment/34898752
upvote count: 1
has comment: http://stackoverflow.com/comment/34898431
tagged with: methods
has answer: http://stackoverflow.com/a/22874391
has comment: http://stackoverflow.com/comment/34898502
has comment: http://stackoverflow.com/comment/34898371
type: Question
has comment: http://stackoverflow.com/comment/34898292
has comment: http://stackoverflow.com/comment/34898113
has comment: http://stackoverflow.com/comment/34898636
has body: How do I force a programmer that use my class to implement a specific named property with a value, in the same way we can force programmer to implementt a interface or abstract method. //DAO dao = new DAO(); //instansiate a transfer object Transfer trans = new Transfer(); //must set and name the propety "id" with a value to work trans.setProperty("id", "23"); //Transfer test = dao.getDataByID("23"); //System.out.println(test.getProperty("id"));
has comment: http://stackoverflow.com/comment/34898919
has comment: http://stackoverflow.com/comment/34898449
has comment: http://stackoverflow.com/comment/34898538
has comment: http://stackoverflow.com/comment/34898373
answer count: 3
has title: Java how to force a programmer that use a object to specify a specific property name with a value?
downvote count: 0
has comment: http://stackoverflow.com/comment/34898559
favorite count: 0
has answer: http://stackoverflow.com/a/22872714
has comment: http://stackoverflow.com/comment/34898496
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34898301
has answer: http://stackoverflow.com/a/22872413
has comment: http://stackoverflow.com/comment/34898826
has comment: http://stackoverflow.com/comment/34898401
score: 1
tagged with: java

http://stackoverflow.com/comment/63907820
comment on: http://stackoverflow.com/a/38223304
type: Comment
score: 0
has text: A better approach would be to use the getter method of the class instead of directly accessing the field.
type: AnswerComment

http://stackoverflow.com/a/22819192
has comment: http://stackoverflow.com/comment/34803644
has body: Java generics erase generic type information on compile. You won't be able to get this information at runtime.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22819156
type: Answer
accepted answer of: http://stackoverflow.com/q/22819156
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34860195
has comment: http://stackoverflow.com/comment/34802481

http://stackoverflow.com/comment/34858876
score: 1
comment on: http://stackoverflow.com/a/22850326
has text: @JasonC I did misread aliteralmind's comment - but that means he's wrong then. This is straight from the [Gang of Four's book - Elements of reusable object-oriented software](http://paginas.fe.up.pt/~aaguiar/as/gof/hires/pat4afso.htm). The class adapter uses multiple inheritance, and object adapter can be implemented just fine because it uses composition.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22904047
tagged with: java
has body: Is possible use JTree in Eclipse plugin development instead of standard JFace tree? I'm developing it in Kepler, wan't work with custom icons etc. like in JTree.
has comment: http://stackoverflow.com/comment/34958221
score: 0
answer count: 1
tagged with: eclipse-plugin
accepted answer: http://stackoverflow.com/a/22905698
tagged with: jface
has comment: http://stackoverflow.com/comment/34957196
type: AnsweredQuestion
tagged with: swing
type: Question
has title: Is possible use JTree in Eclipse plugin development instead of standard JFace tree?
has answer: http://stackoverflow.com/a/22905698
tagged with: jtree

http://stackoverflow.com/a/22891098
has body: Use AJAX to invoke the Servlet, then use the success handler to invoke your JS function. You can use jQuery to easily do this: $("#button-id").click(function() { $.ajax({ url: "/url?topic="+$('#topic').val()+'&amp;Nopages='+$('#Nopages').val()+'&amp;link='+$('#link').val()+'&amp;range='+$('#range').val(), }) .done(function( data ) { // Invoke your function here validate(); }); }); See https://api.jquery.com/jQuery.ajax/ for more details. Server-side, you can use http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getParameter(java.lang.String) to get the query string parameters and process them.
accepted answer of: http://stackoverflow.com/q/22891062
answers question: http://stackoverflow.com/q/22891062
type: AcceptedAnswer
type: Answer
score: 0

http://stackoverflow.com/comment/34941737
score: 0
comment on: http://stackoverflow.com/q/22896566
type: QuestionComment
type: Comment
has text: Is it all the code you run? The object creation comes from a different class or stay in the class as it is?

http://stackoverflow.com/comment/34859705
comment on: http://stackoverflow.com/a/22826019
score: 0
has text: I dont understand where these two lines have to go: Ghetto ghetto = new Ghetto(); //Do stuff with the ghetto. ghetto = new Ghetto(); Ok so I put them in another class, what happened is that the whole thing wont run, I dont know if im putting it between the wrong codes or not. I need to know exactly where the first line go and what should be in the middle and then where the second line should go.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34893959
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22869928
has text: Thanks, I could use a static string however, that wont change the text within the textview in mainactivity. I need to be able to change the text form onreceive().

http://stackoverflow.com/comment/34942619
comment on: http://stackoverflow.com/a/22896915
type: Comment
score: 0
type: AnswerComment
has text: Well the the thing is I have defined all the buttons in the fragment_main.xml because I cannot add anything to the main_activity.xml. The problem exists in the main class and especially in this method add = (Button) findViewById (R.id.bAdd);

http://stackoverflow.com/comment/34953417
type: QuestionComment
has text: are you going to have a different hash map for each row of data?
comment on: http://stackoverflow.com/q/22902835
score: 0
type: Comment

http://stackoverflow.com/q/22848180
has answer: http://stackoverflow.com/a/22848579
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/docx
type: UnansweredQuestion
tagged with: apache-poi
tagged with: java
has body: While trying to read a .docx file I am get the following exception : org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF) at org.apache.poi.poifs.storage.HeaderBlock.&lt;init&gt;(HeaderBlock.java:131) at org.apache.poi.poifs.storage.HeaderBlock.&lt;init&gt;(HeaderBlock.java:104) at org.apache.poi.poifs.filesystem.POIFSFileSystem.&lt;init&gt;(POIFSFileSystem.java:128) at org.apache.poi.hwpf.HWPFDocumentCore.verifyAndBuildPOIFS(HWPFDocumentCore.java:106) at org.apache.poi.hwpf.extractor.WordExtractor.&lt;init&gt;(WordExtractor.java:53) at org.suhail.gui.Main.parseDocxFile(Main.java:245) at org.suhail.gui.Main.jButton1ActionPerformed(Main.java:166) at org.suhail.gui.Main.access$000(Main.java:21) at org.suhail.gui.Main$1.actionPerformed(Main.java:70) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3260) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Containe…
type: Question
has title: Why am I getting an exception as I try to parse .docx file?

http://stackoverflow.com/q/22825444
has answer: http://stackoverflow.com/a/22825749
has answer: http://stackoverflow.com/a/22825687
has comment: http://stackoverflow.com/comment/34816692
favorite count: 0
has comment: http://stackoverflow.com/comment/34813627
has comment: http://stackoverflow.com/comment/34813612
has answer: http://stackoverflow.com/a/22825503
type: UnansweredQuestion
score: -3
upvote count: 0
has comment: http://stackoverflow.com/comment/34814074
has comment: http://stackoverflow.com/comment/34814456
has comment: http://stackoverflow.com/comment/34813620
has comment: http://stackoverflow.com/comment/34813709
tagged with: java
has comment: http://stackoverflow.com/comment/34813585
has comment: http://stackoverflow.com/comment/34813733
has body: I feel like I am pretty close, but my return value keeps printing out the first value in the array.. public static double mx(int[] nums, int track) maxNow = nums[0]; if (count &lt; [lengthofarray] - 1 &amp;&amp; nums[track] != 0) { if (numbers[track] &gt; maxval) maxval = numbers[track]; System.out.println(maxval); return maxval = mx(nums, track+1); } else return maxval; }
has comment: http://stackoverflow.com/comment/34813654
has title: Recursive function finding max value
has answer: http://stackoverflow.com/a/22825711
type: Question
has comment: http://stackoverflow.com/comment/34814917
tagged with: recursion
has comment: http://stackoverflow.com/comment/34813646
has comment: http://stackoverflow.com/comment/34813591
has comment: http://stackoverflow.com/comment/34814266
answer count: 6
has answer: http://stackoverflow.com/a/22825533
has comment: http://stackoverflow.com/comment/34813580
has answer: http://stackoverflow.com/a/22825522
downvote count: 3

http://stackoverflow.com/q/22937814
tagged with: hadoop
answer count: 1
tagged with: sqoop
score: 0
has title: Apache Sqoop startup configuration error: org.apache.hadoop.mapred.YarnClientProtocolProvider not a subtype
type: UnansweredQuestion
has body: While starting apache sqoop getting following error, can anybody give idea to solve? Version using are Hadoop 2.2,Sqoop 1.99.3. Hadoop started before running sqoop. These are running. SecondaryNameNode, DataNode, NodeManager,NameNode, ResourceManager, Jps, JobHistoryServer, java.util.ServiceConfigurationError: org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider: Provider org.apache.hadoop.mapred.YarnClientProtocolProvider not a subtype at java.util.ServiceLoader.fail(ServiceLoader.java:214) at java.util.ServiceLoader.access$300(ServiceLoader.java:164) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:352) at java.util.ServiceLoader$1.next(ServiceLoader.java:428) at org.apache.hadoop.mapreduce.Cluster.initialize(Cluster.java:89) at org.apache.hadoop.mapreduce.Cluster.&lt;init&gt;(Cluster.java:82) at org.apache.hadoop.mapreduce.Cluster.&lt;init&gt;(Cluster.java:75) at org.apache.hadoop.mapred.JobClient.init(JobClient.java:470) at org.apache.hadoop.mapred.JobClient.&lt;init&gt;(JobClient.java:449) at org.apache.sqoop.submission.mapreduce.MapreduceSubmissionEngine.initialize(MapreduceSubmissionEngine.java:113) at org.apache.sqoop.framework.JobManager.initialize(JobManager.java:215) at org.apache.sqoop.core.SqoopServer.initialize(SqoopServer.java:53) at org.apache.sqoop.server.ServerInitializer.contextInitialized(ServerInitializer.java:36) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504) at org.…
has answer: http://stackoverflow.com/a/22943943
tagged with: java
type: Question

http://stackoverflow.com/q/22923454
has title: Java Date Validation Issue
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34991818
tagged with: java
has comment: http://stackoverflow.com/comment/34990926
tagged with: date
tagged with: validation
has comment: http://stackoverflow.com/comment/34991645
answer count: 1
linked to: http://stackoverflow.com/q/3108561
score: 0
has answer: http://stackoverflow.com/a/22923811
accepted answer: http://stackoverflow.com/a/22923811
has body: Here is the validation code for Date of format MM/dd/yyyy. SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); formatter.setLenient(false); Calendar cal = Calendar.getInstance(); Date myDate = formatter.parse("01/02/2014888"); cal.setTime(myDate); When the date string is 01/02/2014888, it passes the validation. How can I make the validation correctly?
has comment: http://stackoverflow.com/comment/34992197

http://stackoverflow.com/comment/34923739
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22885156
has text: remove `map.put("", "");`. If user doesn't enter any values in ID and password still it will say correct information.

http://stackoverflow.com/comment/35038765
has text: In this case, a catch statement would certainly be useful in your try block.
comment on: http://stackoverflow.com/q/22949086
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22906123
type: Answer
has body: There is a chrome app called Advanced REST client. You can pass the data in form of json to your controller using this chrome app. For eg. json data is id:1, name:"xyz" whereas the controller can have @RequestBody Person form. The Person class would be a POJO having id and name as instance variables. The Spring would automatically map the json data to the form. I think this is the easiest and simplest way of checking your spring controller. Check the extension Advanced REST client here
answers question: http://stackoverflow.com/q/22902372
score: 0

http://stackoverflow.com/a/22847538
type: Answer
has body: All that is happening is the executor service is only creating as many threads as it needs. NTHREADS is effectively the maximum number of threads it'll create. There is no point creating ten threads up front if it only has 3 tasks to complete, the other 7 will just be hanging around consuming resources. If you submit more than NTHREADS number of tasks then it will process that number concurrently and the rest will wait on a queue until a thread becomes free. This isn't any different from creating a fixed set of your own threads, except the thread management and scheduling is handled for you. The executor service also restarts threads if they are killed by rogue exceptions in your task which you'd otherwise have to code for. See: The Javadoc on Executorservice.newFixedThreadPool
has comment: http://stackoverflow.com/comment/34856599
has comment: http://stackoverflow.com/comment/34853298
score: 0
answers question: http://stackoverflow.com/q/22847309

http://stackoverflow.com/q/22928522
type: UnansweredQuestion
tagged with: linkageerror
has body: Help me how to solve this one? i'm doing Netsuite integration with java,i added required jar files to my project. After adding jars deployed in jboss 6.1.0.After adding this jar org.apache.sling.commons.log-2.0.6.jar getting following exception. This my stack trace. java.lang.LinkageError: loader constraint violation: when resolving method "com.sun.net.ssl.SSLContext.getSocketFactory()Ljavax/net/ssl/SSLSocketFactory;" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/apache/axis/components/net/SunJSSESocketFactory, and the class loader (instance of &lt;bootloader&gt;) for resolved class, com/sun/net/ssl/SSLContext, have different Class objects for the type javax/net/ssl/SSLSocketFactory used in the signature org.apache.axis.components.net.SunJSSESocketFactory.initFactory(SunJSSESocketFactory.java:83) org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:79) org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191) org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404) org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138) org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) org.apache.axis.client.Call.invokeEngine(Call.java:2784) org.apache.axis.client.Call.invoke(Call.java:2767) org.apache.axis.client.Call.invoke(Call.java:2443) org.apache.axis.client.Call.invoke(Call.java:2366) org.apache.axis.client.Call.invoke(Call.java:1812)
has title: LinkageError: loader constraint violation:
linked to: http://stackoverflow.com/q/3761249
has answer: http://stackoverflow.com/a/23085937
tagged with: java
has comment: http://stackoverflow.com/comment/35018417
type: Question
has comment: http://stackoverflow.com/comment/35000936
tagged with: sslsocketfactory
tagged with: jboss6.x
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
tagged with: classloader

http://stackoverflow.com/q/22848336
tagged with: java
has title: Https Ajax Call Cross Domain on Session Timeout
type: Question
tagged with: nginx
has body: My web application is doing re-writes to HTTPS from HTTP on every page. The application is Spring 3, with a jquery front end. The re-writes are handled by nginx, which I have no experience in, or access to. The problem is on session timeout when a user does an AJAX call, the page is on HTTPS the ajax call goes the correct HTTPS url spring security filter sees the session is invalid and does a redirect to the session invalidated handler url, but uses HTTP. This in turn caused a cross domain error for the front end. I've talked with the sys-admin about this but he couldn't think of any solutions. Any help or suggestions would be appreciated!
score: 0
accepted answer: http://stackoverflow.com/a/22990345
answer count: 1
tagged with: jquery
tagged with: tomcat
has answer: http://stackoverflow.com/a/22990345
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/comment/34841576
comment on: http://stackoverflow.com/a/22841148
type: Comment
has text: This won't work. You will get jsp compilation exception.
type: AnswerComment
score: 1

http://stackoverflow.com/q/22826997
tagged with: comparison
answer count: 2
downvote count: 0
tagged with: string
favorite count: 0
type: UnansweredQuestion
has body: System.out.println( "Great! Now select the type of measurement this is so we can convert!"); System.out.println( "G = Gallons" ); System.out.println( "I = Inches" ); System.out.println( "P = Pound" ); System.out.println( "M = Mile" ); String userType = input.nextLine(); I enter a number, and then when I should be entering the measurement type (as shown above) it automatically skips to the if statement that is after this. Nothing I've tried has worked. Can anyone help?
has title: I'm trying to compare a string but when I have the user input a string it doesn't let them
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34816298
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22827002
has answer: http://stackoverflow.com/a/22827054
linked to: http://stackoverflow.com/q/20181887
has comment: http://stackoverflow.com/comment/34816278

http://stackoverflow.com/comment/35013547
has text: Right, a custom Repository implementation for this use case is rather not the intended usage. A temporary repository seems to be a better approach.
score: 0
comment on: http://stackoverflow.com/q/22931658
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22823794
upvote count: 1
tagged with: swing
type: Question
has title: How do you close JOptionPane after a radiobutton has been selected?
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22826001
has body: I am new to programming and just started last week, so all the java mumbojumbo is quite confusing to me. I was able to create a option pane for my BMI program that asks which unit system(metric/imperial) with radiobuttons and this determines which calculation to perform when finding the BMI. this all works fine except the first optionpane doesn't close when an option is selected, how do i make it close when an option is seleceted. I want the jpane with radiobuttons to close in the do statement. package javaapplication21; import java.text.DecimalFormat; import javax.swing.*; import java.*; public class JavaApplication21 { public static void main(String[] args) { JPanel jPanel = new JPanel(); ButtonGroup group = new ButtonGroup(); JRadioButton metricButton = new JRadioButton("Metric"); metricButton.setActionCommand("Metric"); JRadioButton imperialButton = new JRadioButton("Imperial"); imperialButton.setActionCommand("Imperial"); group.add(metricButton); group.add(imperialButton); jPanel.add(metricButton); jPanel.add(imperialButton); JOptionPane.showOptionDialog(null, "Please select prefered units", "BMI Calculator", JOptionPane.DEFAULT_OPTION,JOptionPane.QUESTION_MESSAGE, null, new Object[] { metricButton, imperialButton}, null); DecimalFormat oneDigit = new DecimalFormat("#,##0.0"); double bodyMassIndex, weight, height; String unitsWeight = "-1", unitsHeight = "-1"; do{ if (metricButton.isSelected()){ unitsWeight = " in kg."; unitsHeight = " in meters"; } else if (imperialButton.isSelected()){ unitsWeight = " in lbs"; unitsHeight = " in inches"; } } while ("-1".equals(unitsWeight)); String weightInput = JOptionPane.showInputDialog("Please enter your weight" + unitsWeight); String heightInput = JOptionPane.showInputDialog("Please enter your height" + unitsHeight); if (metricButton.isSelected()){ height = Double.parseDouble(heightInput); weight = Double.parseDouble(weightInput); bodyMassIndex = weight / (height * height); System.out.println("Your Body Mass Index(BMI) i…
tagged with: jradiobutton
accepted answer: http://stackoverflow.com/a/22826001
tagged with: joptionpane
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/18105598

http://stackoverflow.com/comment/34797457
comment on: http://stackoverflow.com/q/22816531
score: 1
has text: To print a ", you need to type \ before it. Exemple: System.out.println("\"" + employename + "\"");
type: QuestionComment
type: Comment

event-handling
tag name: event-handling
type: Tag
tags question: http://stackoverflow.com/q/22860772

http://stackoverflow.com/comment/34948727
type: Comment
has text: Have a look at [jewelsea](http://stackoverflow.com/users/1155209/jewelsea)'s [first and only question](http://stackoverflow.com/questions/10575410/where-does-javafx-scene-image-imageflower-png-look-for-flower-png) :-)
score: 0
comment on: http://stackoverflow.com/q/22899956
type: QuestionComment

http://stackoverflow.com/a/22875851
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22864046
has body: Thanks everyone...all of you have answered me in some way or the other. Initially I was assuming only 3 entries in the input but turns out it could vary :) for now i'll stick with the simple straight assignments to 3 variables until I figure out another way! Thanks.
downvote count: 0

http://stackoverflow.com/q/22898051
type: UnansweredQuestion
upvote count: 1
tagged with: coldfusion
has answer: http://stackoverflow.com/a/22898294
score: 1
tagged with: java
type: Question
tagged with: jsoup
downvote count: 0
answer count: 1
favorite count: 0
has title: Issue with JavaLoader while loading jsoup
has body: I am trying to load jsoup using JavaLoader but I am getting an initiation error: &lt;cfscript&gt; // An Array with absolute file paths of the referred jar files. paths = expandPath("jars/jsoup-1.7.3.jar"); //Creating a java loader object by passing in the array containing the file paths - loaderObj =createObject("component","javaloader.JavaLoader").init([expandPath('jars/jsoup-1.7.3.jar')]); //So now, we can simply create a instance of an object from the 'bmw' and 'pulsar' class. writedump(loaderObj); abort; jsoup = loaderObj.create("org.jsoup.Jsoup"); &lt;/cfscript&gt; Object Instantiation Exception. Class not found: org.jsoup.Jsoup

http://stackoverflow.com/a/22868902
score: 3
upvote count: 3
downvote count: 0
has body: I always use SOAPUI to test my web service call before wrapping a program around it. http://www.soapui.org/ In your case the wsdl is here http://www.webservicex.net/globalweather.asmx?WSDL make sure your xml soap works there... whats your xml file before it's sent? Should be something like this &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;web:GetCitiesByCountry&gt; &lt;web:CountryName&gt;Africa&lt;/web:CountryName&gt; &lt;/web:GetCitiesByCountry&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt;
type: Answer
answers question: http://stackoverflow.com/q/22868791

http://stackoverflow.com/q/22816487
accepted answer: http://stackoverflow.com/a/22816509
has answer: http://stackoverflow.com/a/22816502
has title: using and operator for Eclipse Java coding
answer count: 3
has body: I'm having trouble getting my and operator working in eclipse. I have used it before but can't figure out why it is not working this time. It tells me that: "The operator &amp;&amp; is undefined for the argument type(s) boolean, int" can someone please help me? Here is the code: public boolean setScore1(int score1) { if (score1 &gt;= -1 &amp;&amp; &lt;= 100) { // this line has error this.score1 = score1; return true; } else return false; }
score: 0
has answer: http://stackoverflow.com/a/22816509
possible better answer: http://stackoverflow.com/a/22816505
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22816505
tagged with: java
type: Question

http://stackoverflow.com/q/22885530
has body: I need a way to methodize objects based on priority. private void placebyPriority(int amount){ List&lt;ChestContainer&gt; high = getChestsByPriorty(ChestPriority.HIGH); List&lt;ChestContainer&gt; medium = getChestsByPriorty(ChestPriority.MEDIUM); List&lt;ChestContainer&gt; low = getChestsByPriorty(ChestPriority.LOW); //here methodizing based on priority } So for example the amount = 20. The amount of elements of high is 5, the amount of elements of medium is 14 and the amount of elements of low is 10. Now I want to methodize the amount variabele spread over the lists (based on priority: high -> medium -> low). So all the elements of high will be .place(); then we got 20 - 5 = 15 left. Then all of the medium list element will be place(); and we got 15 - 14 = 1 left. The last one will be picked from the low list. I've no idea how to do this in an efficient way. I just need those objects based on priority from the list and use them like this: chestContainer.place();.
has comment: http://stackoverflow.com/comment/34922175
score: 0
has comment: http://stackoverflow.com/comment/34922132
has comment: http://stackoverflow.com/comment/34922140
has comment: http://stackoverflow.com/comment/37078932
has comment: http://stackoverflow.com/comment/34922278
has title: Get instances from list based on priority
tagged with: list
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34922396

http://stackoverflow.com/comment/34930307
type: Comment
type: QuestionComment
score: 1
has text: if you want to put the first value also in the URL it also needs to be encoded.
comment on: http://stackoverflow.com/q/22889942

http://stackoverflow.com/comment/139023366
has text: I have added path for jdk 17 but when i check it shows 22.0.2 java version, can anyone help me to set up java version to 17 and remove latest version.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22842806
type: Comment

http://stackoverflow.com/a/22830481
answers question: http://stackoverflow.com/q/22830362
has body: In your getView you have to use the inflated view to retrieve the row items. For every findViewById inside getView change from findViewById to view.findViewById. For instance TextView addressName = (TextView) findViewById(R.id.addressNameTextView); addressName.setText(address.getAddressName()); to TextView addressName = (TextView) view.findViewById(R.id.addressNameTextView); addressName.setText(address.getAddressName());
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/34815956
type: AnswerComment
has text: @LuiggiMendoza thanks for your indication.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22826783

http://stackoverflow.com/a/22917093
score: 1
has body: It isn't possible to execute a task before build files have been evaluated, at least not without complications such as one build executing another build using a GradleBuild task. You are likely better off checking the generated project in to source control, or finding a solution that doesn't involve generating build scripts.
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22834671
downvote count: 0
answers question: http://stackoverflow.com/q/22834671

http://stackoverflow.com/comment/35053222
comment on: http://stackoverflow.com/a/22952338
score: 0
type: Comment
has text: I had tried using custom invoker. But I'm getting null pointer error for factory object. Not sure how to pass instance of factory. Added my CustomInvoker
type: AnswerComment

http://stackoverflow.com/comment/34814088
has text: @thobens No you can't, try it. The subclass must call a constructor of the super class which, if it's `final` must set the value.
comment on: http://stackoverflow.com/q/22825409
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34797238
type: AnswerComment
type: Comment
has text: The loop is repeating the operation. (You might have misread the code?)
comment on: http://stackoverflow.com/a/22815568
score: 0

http://stackoverflow.com/a/22826860
upvote count: 1
answers question: http://stackoverflow.com/q/22826782
score: 1
downvote count: 0
has body: I'm guessing the last appender is only being written to because you only have one appender defined. So when you change the file that the appender writes to, you're effectively changing the configuration for your only appender. What I would do is create a new appender programmatically (instead of using log4j.xml/.properties) and set the file it writes to there. http://howtodoinjava.com/2013/04/08/how-to-programmatically-configure-appenders-in-log4j/
type: Answer

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/22942567
type: Tag

http://stackoverflow.com/a/22904509
type: Answer
accepted answer of: http://stackoverflow.com/q/22896896
has comment: http://stackoverflow.com/comment/34969414
has comment: http://stackoverflow.com/comment/34964692
score: 0
has body: You are calling close on your find object, which is a DBCursor. As mentioned in the API Documentation this will close only the cursor, not the underlying connection. To close the connections you should call close on the Mongo/MongoClient object, which either inherits or has a close function that will as per the API close all connections to the MongoDB server instance.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35958246
has comment: http://stackoverflow.com/comment/34966428
has comment: http://stackoverflow.com/comment/34966179
answers question: http://stackoverflow.com/q/22896896

http://stackoverflow.com/comment/34856814
has text: Ironically, your link ([*seems to have a version](https://web.archive.org/web/%2a/http://www.oracle.com/technetwork/java/codeconv-138413.html)*) is dead... great job finding the stuff, though ;)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22849429
type: Comment

http://stackoverflow.com/q/22939515
tagged with: eclipse
linked to: http://stackoverflow.com/q/18122336
has answer: http://stackoverflow.com/a/22939667
downvote count: 0
answer count: 1
favorite count: 0
has title: eclipse contain unncessary Factory class while generating the war file
type: UnansweredQuestion
upvote count: 3
tagged with: java
type: Question
score: 3
has body: I am facing new issue, since the issue is not there till yesterday now when i compiling the project, I am getting unncessary files such as servicestub$Factory.class, servicestub.class actually there is only one java file as servicestub.java file. There are no problems in the problem tab of eclipse. Earlier today i faced a problem of the .class files missing in the war file. This issue is resolve by using this link Cannot change version of project facet Dynamic Web Module to 3.0? but the new problem now i am getting unnecessay .class in one package and this is not there in other package. can anyone help me in sought out this problem

http://stackoverflow.com/comment/34885408
type: Comment
type: QuestionComment
has text: What you want to change it _to_? Just a color, or a background design? Also are you using Nimbus look and feel (the default for GUI Builder)?
score: 0
comment on: http://stackoverflow.com/q/22864633

http://stackoverflow.com/q/22836819
has title: activity A should be closed after ActivityB but sometimes stays
has body: It's a bit weird but maybe someone has an idea. Activity A opens Activity B. In Activity B i press a button and it should be closed returning to Activity A and then close it as well. However, sometimes (1 to 7 times maybe) Activity B closes but Activity A remains. Activity A public void Foo() { if (bIsVerifyClicked) { Intent intent = new Intent(ActivityA.this, ActivityB.class); startActivityForResult(intent, 1000); } else { setResult(RESULT_OK); finish(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(Logger.TAG, "=============requestCode: " + requestCode + " resultCode: " + resultCode); if (resultCode == RESULT_OK) { setResult(RESULT_OK); finish(); } super.onActivityResult(requestCode, resultCode, data); } Activity B mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(Logger.TAG, "ActivityB ==== finish()"); setResult(RESULT_OK); finish(); } }); i thought maybe there is a memory leak in Activity B and thus the onResult get lost or something, but it's java and i don't see anything strange. do you have any lead what should i look for? or how can i better debug this?
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/34833660
score: 0
tagged with: android-intent
answer count: 1
has comment: http://stackoverflow.com/comment/34833353
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34833711
has comment: http://stackoverflow.com/comment/34836190
has comment: http://stackoverflow.com/comment/34833574
has answer: http://stackoverflow.com/a/22836910

http://stackoverflow.com/comment/34843722
type: QuestionComment
comment on: http://stackoverflow.com/q/22842434
has text: @AnubianNoob OP wants that that this `getNext` method returns `ADVANCED` when is called from `ROOKIE`, returns `EXPERT` when called from `ADVANCED`, and on and on (in case of more values), and in the end it should return `null` if it's at the maximum level.
score: 0
type: Comment

http://stackoverflow.com/q/22911113
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/34967613
has body: I have created rigid bodies placed upon each other in a structural way. I want to know if a body is touched by the user or not for all bodies even in rotation , free falling etc.. Thanks in advance
has comment: http://stackoverflow.com/comment/34974047
has comment: http://stackoverflow.com/comment/34972721
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34972572
tagged with: android
has comment: http://stackoverflow.com/comment/34969978
answer count: 0
has comment: http://stackoverflow.com/comment/34972975
has comment: http://stackoverflow.com/comment/34973274
tagged with: box2d
has comment: http://stackoverflow.com/comment/34970065
has title: Input in Box2D Bodies
type: Question
tagged with: game-physics
has comment: http://stackoverflow.com/comment/34973652
tagged with: libgdx

http://stackoverflow.com/a/22927368
type: Answer
has comment: http://stackoverflow.com/comment/35039863
score: 1
upvote count: 2
downvote count: 1
has body: Take a look at the api here. http://supercsv.sourceforge.net/apidocs/index.html I'm not familiar SuperCsv please don't beat me up too bad if I'm wrong... Can't you just set CsvPreference to EXCEL
answers question: http://stackoverflow.com/q/22927124
has comment: http://stackoverflow.com/comment/35013057

http://stackoverflow.com/a/22900243
answers question: http://stackoverflow.com/q/22900149
score: 0
type: Answer
has body: // Assuming you have two Byte[], arrA and arrB for (int i = 0; i &lt; arrA.length; i++) if (arrA[i] != arrB[i]) return i;

http://stackoverflow.com/comment/34919245
has text: See also [*Initial Threads*](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22883986

http://stackoverflow.com/a/22866324
has comment: http://stackoverflow.com/comment/64294046
answers question: http://stackoverflow.com/q/22866219
type: Answer
upvote count: 4
downvote count: 0
has body: I recently had to do this too. I found that the Java default image rescale operations were not suitable for downsizing image and left a low quality finish. In the end I started to use the java-image-scaling library. Its very good and easy to use and provides a very good finish. A sample usage would be: ResampleOp resampleOp = new ResampleOp (100,200); BufferedImage destImage= resampleOp.filter(sourceImage, null);
score: 4

http://stackoverflow.com/comment/35029665
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22945062
has text: Less efficient, but you could return the hashcode for the sorted array.

http://stackoverflow.com/comment/35017044
comment on: http://stackoverflow.com/q/22934822
type: Comment
type: QuestionComment
has text: You said android version is crashing when you switch to screen 2. Do you have an error log for that?
score: 0

http://stackoverflow.com/q/22965661
answer count: 3
has body: Iterator itr=al.iterator(); how does this line eactly work? does it just store the arraylist al in iterator? Can anyone pls give me a detailed explanation. Thanks in advance.
has answer: http://stackoverflow.com/a/22965755
favorite count: 0
has title: Exact meaning of the sentence.."Iterator itr=al.iterator(); "
type: UnansweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35065960
has answer: http://stackoverflow.com/a/22965723
has answer: http://stackoverflow.com/a/35429962
tagged with: collections
has comment: http://stackoverflow.com/comment/35066409
type: Question
score: -2
has comment: http://stackoverflow.com/comment/35068708
has comment: http://stackoverflow.com/comment/35065934
tagged with: iterator
downvote count: 2

http://stackoverflow.com/a/22913349
has body: Because you declared a constructor with different parameters, the default (empty) constructor is gone. The default constructor is only available when you have not defined another constructor. You can create an empty constructor like this: public funktionen_haupt(){ } public funktionen_haupt(Context mContext,Activity mActivity){ this.mContext = mContext; this.mActivity=mActivity; } If you want to create the object with the parameters then you should not use the newInstance() method but just call the constuctor.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22913193
answers question: http://stackoverflow.com/q/22913193

http://stackoverflow.com/comment/34940672
has text: What's your project structure?
type: Comment
comment on: http://stackoverflow.com/a/22886066
score: 0
type: AnswerComment

http://stackoverflow.com/q/22905914
upvote count: 1
has answer: http://stackoverflow.com/a/22928159
type: Question
has body: Main.Java : Main Class which creating the object of Test which of generic type Test.Java: Its Generic class which is creating object of Wrapper class of generic type Wrapper.java: Its a Generic Class of Type We are passing String,Long as type for creating Test.java object . And passing long as a type for creating the object of Wrapper class. Main.Java: public class MainClass { Test&lt;String,Long&gt; test; MainClass() { test = new Test&lt;String,Long&gt;(){}; } public static void main(String[] arr) { MainClass m = new MainClass(); } } Test.Java public class Test&lt;T,U&gt; { Wrapper&lt;U&gt; mywrapper; Test() { Type type = this.getClass().getGenericSuperclass(); System.out.println("TYPE: " + type.toString()); Type type1 = ((ParameterizedType)this.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; System.out.println("TYPE1: " + type1.getClass().getName()); Type[] types = ((ParameterizedType)type).getActualTypeArguments(); for (int i = 0; i &lt; types.length; i++) { System.out.println("TYPES[" + i + "]: " + types[i].toString()); } mywrapper = new Wrapper&lt;U&gt;(){}; } } Wrapper.Java public class Wrapper&lt;U&gt; { Wrapper() { Type type = this.getClass().getGenericSuperclass(); System.out.println("TYPE: " + type.toString()); Type type1 = ((ParameterizedType)this.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; System.out.println("TYPE1: " + type1.getClass().getName()); Type[] types = ((ParameterizedType)type).getActualTypeArguments(); for (int i = 0; i &lt; types.length; i++) { System.out.println("TYPES[" + i + "]: " + types[i].toString()); } } } And after executing the program we are getting output as TYPE: Test TYPE1: java.lang.Class TYPES[0]: class java.lang.String TYPES[1]: class java.lang.Long TYPE: Wrapper *TYPE1: sun.reflect.generics.reflectiveObjects.TypeVariableImpl TYPES[0]: U* So from the output you can see for the Wrapper class we are getting Type as U instead of Long as you can see in Test.Java.
has answer: http://stackoverflow.com/a/22953665
downvote count: 0
has answer: http://stackoverflow.com/a/22918554
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/22928592
answer count: 4
type: AnsweredQuestion
has title: Java: Passing generic type to an another generic type class
score: 1
accepted answer: http://stackoverflow.com/a/22918554
tagged with: java
possible better answer: http://stackoverflow.com/a/22928159

http://stackoverflow.com/comment/34989755
type: QuestionComment
comment on: http://stackoverflow.com/q/22922751
has text: What do you mean "I don't know which type they are"? What is the type of the variable you are using to refer to each?
score: 0
type: Comment

http://stackoverflow.com/q/22825389
possible better answer: http://stackoverflow.com/a/22825507
tagged with: sql
has answer: http://stackoverflow.com/a/22825507
has body: I have three tables: Books, Members and loanRecords. The Books table has bookname,bookid, etc.. The Members table has memberid,membername etc.. The Loan records hold who has loaned what as in: bookid,memberid,loandate etc... What I am trying to do is write a join which can list all the member with a specific book title out on loan and i may be getting a little confused. I know i have to SELECT * from member"+ "JOIN member_loans_book on member_loans_book.Member_id=member.id " + " AND member_loans_book.Book_id=... but when i get this far i get flabbergasted. Any help would be appreciated. Thanks
has answer: http://stackoverflow.com/a/22825476
type: AnsweredQuestion
has title: Achieving a double join in sql
tagged with: join
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22825476
score: 0
answer count: 2

http://stackoverflow.com/q/22899821
tagged with: android
has comment: http://stackoverflow.com/comment/34947979
accepted answer: http://stackoverflow.com/a/22899935
has body: How to parse a json array without object tags? How can I get files? { "id": "476", //IDобращения"status": "2", //Статус: 0=&gt;'Нарассмотрении', 1=&gt;'Вработе', 2=&gt;'Выполнено', 3=&gt;'Отклонено'"latitude": "56.007831", //геокоординаты, заданныеприподачеобращения"longitude": "35.970359", "message": "dfghdfgh", //текстобращения"published_at": "2014-01-30 18:13:29", //датаподачиобращения"comments": [ { "id": 133, "message": "aaa", //тексткомментария(админ/пользователь)"isadmin": "0", //ответданадминистратором(isadmin=1)"curr_status": "1"//статусобращениянамоментответа }, { "id": 134, "message": "112", "isadmin": "1", "curr_status": "1" }, { "id": 136, "message": "", "isadmin": "1", "curr_status": "2" }, { "id": 137, "message": "123", "isadmin": "1", "curr_status": "2" } ], "files": [ “”, ””……””//image(base64encoded) ] } JSONObject result = new JSONObject(s); id = result.getInt("id"); status = result.getInt("status"); latitude = result.getDouble("latitude"); longitude = result.getDouble("longitude"); message = result.getString("message"); dateOfPublish = result.getString("published_at"); JSONArray jsonArray = result.getJSONArray("files"); for (int j = 0; j &lt; jsonArray.length(); j++) { //Here i want to get files }
has answer: http://stackoverflow.com/a/22900036
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34947935
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/9605913
possible better answer: http://stackoverflow.com/a/22900036
upvote count: 1
has comment: http://stackoverflow.com/comment/34947910
has comment: http://stackoverflow.com/comment/34947849
has title: How to parse JSON object without tag
type: Question
score: -3
has comment: http://stackoverflow.com/comment/34947880
has answer: http://stackoverflow.com/a/22899935
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/34947921
has comment: http://stackoverflow.com/comment/34947839
favorite count: 0
has comment: http://stackoverflow.com/comment/34947861

http://stackoverflow.com/comment/34937355
has text: the buttons already exist,i need to get list of buttons in my frame
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22894007

http://stackoverflow.com/comment/35067692
type: AnswerComment
comment on: http://stackoverflow.com/a/22966310
type: Comment
has text: please mention it in your question so that i can update it in the answer.
score: 0

http://stackoverflow.com/q/22843425
possible better answer: http://stackoverflow.com/a/22843615
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22843638
has answer: http://stackoverflow.com/a/22843615
has answer: http://stackoverflow.com/a/22843638
has comment: http://stackoverflow.com/comment/34845545
has body: I am trying to add users to a model. I want to add all the users that are in MembersArray but not in membersAvailableArray. membersAvailableArray = all members in the class. MembersArray = all members Im trying to get all members that are in MembersArray but not membersAvailableArray DefaultListModel&lt;String&gt; model2 = new DefaultListModel&lt;&gt;(); for(Member allMems: MembersArray) { for(Member mems: membersAvailableArray) { if(!allMems.getUsername().equals(mems.getUsername())) { model2.addElement(allMems.getFirstName() + " " + allMems.getLastName()); } } } availableMembersJList.setModel(model2);
type: AnsweredQuestion
has title: Java get elements that are not in an arraylist
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34845484
tagged with: arraylist

http://stackoverflow.com/comment/34920378
score: 2
has text: I highly recommend you study the Javadoc and source code for `java.util.Random`. There's wealth of information there that should allow you to handle this easily. If `max` and `min` are `int`s, then `max-min` _has_ to fit in a `long`, and all you really want to do is generate 64 random bits and then use the technique from `nextInt()` applied to generate a `long` value.
comment on: http://stackoverflow.com/q/22884083
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22885423
has title: Can't seem to add a panel to a frame, from another class
score: 0
has comment: http://stackoverflow.com/comment/34921891
answer count: 1
has body: I've been struggling with this for a while. See my code below. I'm trying to add the HighscorePaneel to the Mainframe. I've made both highscorePaneel, and mainFrame. But the line mainFrame.add(highscorePaneel); gives an error in eclipse "mainFrame cannot be resolved" and I don't know why. Can you tell me what I'm doing wrong? package lunarlockout; public class LunarLockoutApp { public static void main(String[] args) { Mainframe mainFrame = new Mainframe(); } } second class ( removed some code that is not needed to post) package lunarlockout; public class Mainframe extends JFrame { public Mainframe(){ setSize(1200, 800); setTitle("Lunar Lockout!"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); HoofdmenuPaneel hoofdmenuPaneel = new HoofdmenuPaneel(); add(hoofdmenuPaneel); setVisible(true); } } a third class public class HighscorePaneel extends JPanel implements ActionListener { public HighscorePaneel(){ setLayout(null); setSize(330, 528); setLocation(461, 137); setBackground( new Color(255, 255, 255, 25) ); setVisible(true); } and my last class, the one with the error: package lunarlockout; public class HighscoreInzien { Mainframe mainFrame; public HighscoreInzien(Mainframe mainFrame) { this.mainFrame = mainFrame; } public void run() { HighscorePaneel highscorePaneel = new HighscorePaneel(); mainFrame.add(highscorePaneel); throw new UnsupportedOperationException(); } } HoofdmenuPaneel class public class HoofdmenuPaneel extends JPanel implements ActionListener { private JButton selecteerLevelButton; private JButton spelHervattenButton; private JButton highscoresButton; private JButton afsluitenButton; public HoofdmenuPaneel(Mainframe mainFrame){ this.mainFrame = mainFrame; setLayout(null); setSize(330, 528); setLocation(461, 137); setBackground( new Color(255, 255, 255, 25) ); public void actionPerformed(ActionEvent e) { if (e.getSource() == selecteerLevelButton) { System.out.println("selecteerLevelButton"); } else if(e.getSource() == spelHervattenButton) { System.ou…
has answer: http://stackoverflow.com/a/22885675
has comment: http://stackoverflow.com/comment/34921927
has comment: http://stackoverflow.com/comment/34921958
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22885675
has comment: http://stackoverflow.com/comment/34922042
type: Question
has comment: http://stackoverflow.com/comment/34921936
tagged with: java

http://stackoverflow.com/comment/34856884
comment on: http://stackoverflow.com/a/22849156
score: 0
type: AnswerComment
type: Comment
has text: It's a cryptographic hash function.

http://stackoverflow.com/a/22889598
score: 1
answers question: http://stackoverflow.com/q/22880719
downvote count: 0
has body: int i=ps.executeUpdate("update tablename set col1='sss' where col2='hhh'"); //i is 1 if any one row is updated that is if any one row matches the condition //i is 0 otherwise if(i==1) { response.sendRedirect("page1.jsp"); } else { response.sendRedirect("page2.jsp"); }
upvote count: 1
type: Answer

http://stackoverflow.com/q/22813318
tagged with: java
has comment: http://stackoverflow.com/comment/34791999
type: AnsweredQuestion
tagged with: c#
has title: Should I return a collection when the reference to the collection is not changed?
tagged with: oop
has answer: http://stackoverflow.com/a/22818959
has comment: http://stackoverflow.com/comment/34791936
accepted answer: http://stackoverflow.com/a/22818959
has body: I got a method which accepts a collection as below public IList&lt;CountryDto&gt; ApplyDefaults(IList&lt;CountryDto&gt; dtos) { //Iterates the collection //Validates the items in collection //If items are invalid //Removes items e.g dtos.Remove(currentCountryDto) return dtos;//Do I need to do this? } My question is since, the reference to the collection is not changed, should I return the collection again from the method? For: By returning the collection back, I make it explicit in the signature and user is aware that the items in the collection could be different from the original source. Sort of it avoid ambiguity. Against: Since the validation doesnt change the reference of the collection, it doesn't make sense technically to return it. What is the best approach in this case? Note: I am not sure if this question is opinion based. I think probably I missing something here on design side.
type: Question
has answer: http://stackoverflow.com/a/22813410
upvote count: 2
has answer: http://stackoverflow.com/a/22813501
has comment: http://stackoverflow.com/comment/34792107
has answer: http://stackoverflow.com/a/22814015
answer count: 7
has answer: http://stackoverflow.com/a/22813520
favorite count: 0
has comment: http://stackoverflow.com/comment/34792214
possible better answer: http://stackoverflow.com/a/22813520
has answer: http://stackoverflow.com/a/22814228
has answer: http://stackoverflow.com/a/22813655
tagged with: c++
score: 2
downvote count: 0

http://stackoverflow.com/a/22967921
upvote count: 1
answers question: http://stackoverflow.com/q/22948376
score: 1
downvote count: 0
type: Answer
has body: This is less likely a serialization issue and more likely a classloader issue. If the class was truly loaded by both portlet web applications by a single, common class loader then instances can be shared via DynaCache. If however two different classloaders are used to load the same .class from the same .jar (on disk) and the two applications share a single instance (e.g. via DynaCache distributed map) you will encounter a ClassCastException - even though, as you've seen, myInstance.getClass().getName() yields the same string. To confirm this you can enable a service and use the WebSphere classloader viewer. This will let you, per module, troubleshoot your "two classloaders, one class" issue. There is a companion doc on the InfoCenter doc which walks you through the troubleshooting process. The classloader viewer will show you which .jar and which classloader was used to load the com.test.UserBean in each module. For example, you may have accidentally packaged the jar in WEB-INF/lib of one and not the other and have parent-last classloading enabled.

http://stackoverflow.com/comment/35051703
comment on: http://stackoverflow.com/a/22956972
type: Comment
has text: I agree with you, with different Runnable t1, t2 and t3 treat _tmp as a EXLUSIVE resource. If i make it "static" then again its become SHARED among all of them. My question is why "volatile" is not working at that place...to make it SHARED resource like as "static"
type: AnswerComment
score: 0

http://stackoverflow.com/a/22835700
score: 1
has body: use getSupportFragmentManager() instead of getFragmentManager. fragmentManager.addOnBackStackChangedListener(new OnBackStackChangedListener() { public void onBackStackChanged() { if(getSupportFragmentManager().getBackStackEntryCount() == 0) finish(); } });
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22835482
downvote count: 0
has comment: http://stackoverflow.com/comment/34835446

http://stackoverflow.com/a/22895041
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22894963
score: 1
has body: Replace for(int i=1; i&lt;=myNumber; i=i++) with for (int i = 1; i &lt;= myNumber;i++) to stop infinite loop.

http://stackoverflow.com/q/22930811
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22931034
downvote count: 0
accepted answer: http://stackoverflow.com/a/22931034
tagged with: java
type: Question
score: 4
has body: I'm trying to install Maven integration plugin in Eclipse Helios. But I am getting error like Cannot complete the install because one or more required items could not be found. Software being installed: m2e - Maven Integration for Eclipse 1.4.1.20140328-1905 (org.eclipse.m2e.feature.feature.group 1.4.1.20140328-1905) Missing requirement: async-http-client 1.6.5.20140328-1501 (com.ning.async-http-client 1.6.5.20140328-1501) requires 'package org.slf4j 1.6.2' but it could not be found Cannot satisfy dependency: From: m2e - Maven Integration for Eclipse 1.4.1.20140328-1905 (org.eclipse.m2e.feature.feature.group 1.4.1.20140328-1905) To: com.ning.async-http-client [1.6.5.20140328-1501]
tagged with: eclipse
has title: installing maven with eclipse
answer count: 1
favorite count: 0
tagged with: maven
upvote count: 4

http://stackoverflow.com/a/22828905
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22817198
score: 2
has body: I'd recommend to read the tutorial at the GWT official site. The StockWatcher example teaches how to write an application, and discusses the different ways to retrieve information from the server. It works in either GAE or any other servlet container, it has even an example about how to create the web service in a php and consume it. The left index of the tutorial is not correctly sorted because the gwtproject.org site documentation is produced automatically, but clicking on the next step link in each page you go to the next one. [EDITED] Index of the GWT project is now correctly sorted after my changes
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22817198
type: Answer

http://stackoverflow.com/q/22863814
favorite count: 0
has comment: http://stackoverflow.com/comment/34882374
accepted answer: http://stackoverflow.com/a/22863939
tagged with: sql-server-2012
has answer: http://stackoverflow.com/a/22864170
has comment: http://stackoverflow.com/comment/34882541
possible better answer: http://stackoverflow.com/a/22864170
downvote count: 1
has title: Hibernate query.list getting cast exception
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34882081
has comment: http://stackoverflow.com/comment/34882105
tagged with: java
tagged with: hibernate
score: -1
type: Question
has body: I am trying to connect to sql server 2012. by hibernate. sql query: SELECT top 3 P.,v. FROM TBLPOMASTER P join tblVendorMaster v on v.vendorid=p.VendorId where v.VendorCode=10001 and p.ApprovedStatus='Y' I tried to translate HQL query as List&lt;TblPomaster&gt; poMasterList = new ArrayList&lt;TblPomaster&gt;(); String sqlQuery = "from TblVendorMaster as v, TblPomaster as p where v.vendorId=p.vendorId and v.vendorCode=:vendorLoginId and p.approvedStatus='Y'"; Query query = HibernateUtil.getSession().createQuery(sqlQuery) .setParameter("vendorLoginId", vendorLoginId); query.setMaxResults(3); poMasterList=query.list(); return poMasterList; in the above code query is executing fine. But query.list() throwing RuntimeException as java.lang.String cannot be cast to java.lang.Long What is the solution for the above error
has answer: http://stackoverflow.com/a/22863939
answer count: 2
upvote count: 0

http://stackoverflow.com/q/22820514
type: Question
has answer: http://stackoverflow.com/a/22820633
has comment: http://stackoverflow.com/comment/34805516
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34805678
type: UnansweredQuestion
tagged with: android
has body: setAudioSource(MediaRecorder.AudioSource.VOICE_CALL); setAudioSource(MediaRecorder.AudioSource.VOICE_DOWNLINK); setAudioSource(MediaRecorder.AudioSource.VOICE_UPLINK); I am new to android and i am trying to save/record call voice.Any one of the above not recording any kind of voice.i google it every where but no success.After searching i found that phone recording depends on the the android phone.Because the media server(Audio Flinger) provided with android os is not capable of doing so. http://forum.dailymobile.net/index.php?topic=60929.0;wap2 https://gitorious.org/android-eeepc/base/source/08defa03546578b8c71a26668de8ff8feed727fd:libs/audioflinger/AudioFlinger.cpp http://www.chilkatsoft.com/chilkatAndroid.asp Any one who know the solution please answer.
tagged with: call
tagged with: java
upvote count: 1
tagged with: record
has title: Android Call Recording
downvote count: 1

http://stackoverflow.com/comment/34837827
has text: Didn't think of that. 0 is the smallest value.
type: AnswerComment
comment on: http://stackoverflow.com/a/22839328
score: 0
type: Comment

gridview
tags question: http://stackoverflow.com/q/22897890
tag name: gridview
tags question: http://stackoverflow.com/q/22907869
tags question: http://stackoverflow.com/q/22881955
type: Tag
tags question: http://stackoverflow.com/q/22830917
tags question: http://stackoverflow.com/q/22928496
tags question: http://stackoverflow.com/q/22816526

http://stackoverflow.com/comment/34980061
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22917539
score: 0
has text: Most likely cause is that your property in the PropertyValueFactory doesn't correctly match the getXXX method. But since you're typing the question independently of your actual code, it's pretty much impossible to help.

http://stackoverflow.com/q/22849811
tagged with: ssl
type: Question
has title: what is the contents in the keystore repository
has answer: http://stackoverflow.com/a/22852594
tagged with: ssl-certificate
score: 0
tagged with: linux
answer count: 1
tagged with: ca
has body: This is new concept to me and i understand a little bit after some googling; I have a cacerts file available on my server at work and is being used by my java application. I can use keytool untility to read the contents of this file, I understand that keystore is a repository of certificates and hold keys and certificates and encrypt them all with a password. In other words, a keystore is just like a hashtable which has an alias that identifies a certificate and then the certificate itself. Now, the question that I have is: where is the actual .pem cert file that was used to get the keystore loaded ? and is keystore holding the cert meta data or the link to the actual .pem file. The reason i ask this is to import a certificate the command used is: keytool -importcert -v -noprompt -trustcacerts -alias verisigndemocert -file verisign-demo-root-cert.pem -keystore cacerts where we tell the file name in "-file" attribute, so is the content getting loaded into keystore or the file location details ? again when I see the list of certs in my keystore i can use a -list and when I do -v the entire cert is visible which makes me to think that the cert meta data is getting stored into the keystore file. if anyone can explain in detail or point to link that would be helpful
accepted answer: http://stackoverflow.com/a/22852594
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/34783455
comment on: http://stackoverflow.com/q/22808853
score: 0
has text: When "sum of the digits % 3" is zero, then the number is a factor of 3. Since 6+3+3+6 = 18 % 3 is 0, then the number is factor of 3 → The condition will be never met.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22857857
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22856767
has body: This is a good question, because it points out one of the most significant differences between Java and C++, and one of the biggest hurdles for programmers making the transition from one of those languages to the other. In C++, you can create an object simply by declaring a variable. That is, if you declare a variable of an object type (and not a reference variable), then when execution reaches the variable declaration, an object is created; and when the variable goes out of scope, the object is destroyed. Java doesn't work this way - variables exist independently from the objects that they reference. If you declare a variable of object type and don't specify an object for it to refer to, then it will either be null initially (if it's a member of a class) or the compiler will force you to initialise it before you use it (if it's a local variable). But the point is, the variable can be in scope even when there's no object. Also, an object can be created even when there's no variable to refer to it. Such objects are typically short lived, since if there's no reference anywhere to an object, the garbage collector will have its wicked way with the object. If you come from a C++ background and you're making the transition to Java, it is worthwhile spending a lot of time understanding this distinction. A lot of elementary bugs come about because people don't understand it fully.
upvote count: 1

http://stackoverflow.com/q/22860245
score: -5
linked to: http://stackoverflow.com/q/14644442
downvote count: 5
has title: whats the difference between these statements
possible better answer: http://stackoverflow.com/a/22860318
has body: Fragment fr1 =new FragmentABC(); and Intent in = new Intent(); where Fragment and Intent are build class while FragmentABC is user defined class. Its pretty basic but still cant figure out the reasonable difference to justify on instantiating. Want to know what's the difference between two statements, please be descriptive in the answers you provide.
type: Question
has answer: http://stackoverflow.com/a/22860318
has answer: http://stackoverflow.com/a/22860360
tagged with: java
has comment: http://stackoverflow.com/comment/34875566
accepted answer: http://stackoverflow.com/a/22860545
has comment: http://stackoverflow.com/comment/34875706
answer count: 3
has answer: http://stackoverflow.com/a/22860545
favorite count: 0
tagged with: android
linked to: http://stackoverflow.com/q/18100417
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/34908824
comment on: http://stackoverflow.com/a/22878157
score: 1
type: AnswerComment
has text: If the rest of your adapter is set up properly, those two methods should be enough to refresh the list and keep you at the same position in the list. You shouldn't have to do anything more.
type: Comment

http://stackoverflow.com/comment/34981922
type: Comment
type: QuestionComment
has text: It's not possible, cause `ProductionApplicationConfiguration` sets in `true` only when application is running on production server
score: 0
comment on: http://stackoverflow.com/q/22916118

http://stackoverflow.com/a/22907611
answers question: http://stackoverflow.com/q/22892223
has comment: http://stackoverflow.com/comment/70367956
has comment: http://stackoverflow.com/comment/70379593
type: Answer
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/70445119
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/70501089
accepted answer of: http://stackoverflow.com/q/22892223
has body: The solution is a single line: ResteasyProviderFactory.getContextData(HttpServletRequest.class) I don't know if injecting this in a field is possible. Method level injection does not work either as I'm using Java clients with the same interface definition. Adding context parameters to a method would screw up this scheme. Anyway, it works great for me.
has comment: http://stackoverflow.com/comment/70367936
downvote count: 0

jackson
tags question: http://stackoverflow.com/q/22929382
tags question: http://stackoverflow.com/q/22873521
tags question: http://stackoverflow.com/q/22870488
tags question: http://stackoverflow.com/q/22917324
tags question: http://stackoverflow.com/q/22875642
tags question: http://stackoverflow.com/q/22895289
tags question: http://stackoverflow.com/q/22853509
tags question: http://stackoverflow.com/q/22871845
tags question: http://stackoverflow.com/q/22903258
tags question: http://stackoverflow.com/q/22869403
tags question: http://stackoverflow.com/q/22959493
tags question: http://stackoverflow.com/q/22872783
type: Tag
tags question: http://stackoverflow.com/q/22904111
tags question: http://stackoverflow.com/q/22944076
tags question: http://stackoverflow.com/q/22830165
tags question: http://stackoverflow.com/q/22819511
tags question: http://stackoverflow.com/q/22851462
tags question: http://stackoverflow.com/q/22829510
tag name: jackson
tags question: http://stackoverflow.com/q/22956739
tags question: http://stackoverflow.com/q/22916600
tags question: http://stackoverflow.com/q/22845648
tags question: http://stackoverflow.com/q/22869772
tags question: http://stackoverflow.com/q/22837389
tags question: http://stackoverflow.com/q/22849897

http://stackoverflow.com/comment/35047703
comment on: http://stackoverflow.com/q/22954830
type: QuestionComment
type: Comment
score: 0
has text: Tell us the build path of your project. How did you put the external library into that build path? Build path is accessible via right-click on project -> Build Path -> Configure Build Path. There click on the tab Libraries.

http://stackoverflow.com/a/22890546
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22890528
downvote count: 0
has comment: http://stackoverflow.com/comment/34931783
has body: Remove all the whitespace with a replaceAll() before your code. text.replaceAll("\\s+","");

http://stackoverflow.com/a/22958468
has body: Please check Oracle Docs to see how to use model, renderer and editor in Java table.
type: Answer
answers question: http://stackoverflow.com/q/22957717
score: 0

http://stackoverflow.com/comment/34901709
type: AnswerComment
has text: If you only save datastore data you could get by using datastore namespaces. Problem is it doesnt apply to other things like blobstore.
type: Comment
comment on: http://stackoverflow.com/a/22872746
score: 0

http://stackoverflow.com/q/22904987
has comment: http://stackoverflow.com/comment/34957027
has comment: http://stackoverflow.com/comment/34957115
tagged with: java
linked to: http://stackoverflow.com/q/6964011
has comment: http://stackoverflow.com/comment/34957782
type: Question
has comment: http://stackoverflow.com/comment/34957981
has title: Display Freezes, Force Close or Wait, and GC_MALLOC and GC_Concurrent are Triggered
has comment: http://stackoverflow.com/comment/34957261
answer count: 1
has comment: http://stackoverflow.com/comment/34957919
has comment: http://stackoverflow.com/comment/34957943
tagged with: numberformatexception
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/34958084
tagged with: android
has answer: http://stackoverflow.com/a/22905046
has body: I am trying to use the Thread to process the data in real time to store 8000 strings in a multi-dimensional array. The logic for storing the array has been tested with a string 8000 numbers, that was successful. There are two variations for this code the catch (NumberFormatException e) and the catch(NullPointerException e). The logcat for both is listed below. Then it crashes. How do I fix this? Changing transfer = readMessage; and setting the null to zero did prevent the errors. However, my UI still gets frozen and I get the Force Close or Wait option. Furthermore, GC_MALLOC and GC_Concurrent are appearing in the error log now. public double [][]stored = new double[8000][1]; public static HjorthClass finalValue; public String transfer; class Task implements Runnable { @Override public void run() { try{ Thread.sleep(2000); } catch(InterruptedException e) { } for(int a = 0; a&lt;8000; a++) { try { double[] convert = new double[1]; for(int z=0; z &lt;1;z++) { convert[z]= Double.parseDouble(transfer); } for(int j=0; j&lt;1;j++) { stored[a][j]= convert[j]; } } catch(NumberFormatException e) { } } finalValue = new HjorthClass(stored); }} private final Handler mHandler = new Handler() { @Override public void handleMessage(final Message msg) { switch (msg.what) { case MESSAGE_READ: byte[] readBuf = (byte[]) msg.obj; String readMessage = new String(readBuf,0,msg.arg1); String transfer = readMessage; mConversationArrayAdapter.add("Voltage: "+ transfer); new Thread(new Task()).start(); break; logcat with catch(NumberFormatException e) 04-07 06:04:01.712: E/AndroidRuntime(24162): FATAL EXCEPTION: Thread-14 04-07 06:04:01.712: E/AndroidRuntime(24162): java.lang.NullPointerException 04-07 06:04:01.712: E/AndroidRuntime(24162): at org.apache.harmony.luni.util.FloatingPointParser.parseDouble(FloatingPointParser.java:263) 04-07 06:04:01.712: E/AndroidRuntime(24162): at java.lang.Double.parseDouble(Double.java:318) 04-07 06:04:01.712: E/AndroidRuntime(24162): at com.example.android.…
score: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34957850
has comment: http://stackoverflow.com/comment/34957155
has comment: http://stackoverflow.com/comment/34957077
has comment: http://stackoverflow.com/comment/34957361

http://stackoverflow.com/comment/34957569
type: AnswerComment
score: 0
type: Comment
has text: it is a different question actually, I can look today
comment on: http://stackoverflow.com/a/22905046

http://stackoverflow.com/comment/34976893
type: Comment
score: 0
type: AnswerComment
has text: Some configurations are included in resources (like the Spring application-context files), but many either need to be changed frequently (hard to do when it is inside the jar/war) or apply to multiple binaries (violates the [DRY](http://en.wikipedia.org/wiki/Don%27t_repeat_yourself) principle. Also, the JBoss configuration files don't lend themselves to being in resources at all.
comment on: http://stackoverflow.com/a/22914829

http://stackoverflow.com/q/22927818
type: AnsweredQuestion
tagged with: graphics2d
has comment: http://stackoverflow.com/comment/34999087
accepted answer: http://stackoverflow.com/a/22928302
tagged with: java-2d
type: Question
score: 0
answer count: 2
tagged with: swing
has body: I am currently working on a simple top down shooter. The object is a ball that slides around the screen, and I am trying to make a sort of wet-dragging affect. I am using Java Swing and just the default Graphics2d lib inside. This is what I have: and this is my goal: I need to know how I can make a curved line that has the ability to change alpha at the trailing end. I have searched online but I can only find non-dynamic solutions. (The tail needs to update as the player moves across the screen.)
tagged with: java
has comment: http://stackoverflow.com/comment/34998933
linked to: http://stackoverflow.com/q/7229226
possible better answer: http://stackoverflow.com/a/22928201
has answer: http://stackoverflow.com/a/22928201
tagged with: awt
has answer: http://stackoverflow.com/a/22928302
has title: Create a Trailing line of blood behind a player

http://stackoverflow.com/comment/34829679
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22834650
has text: See the Pattern class.
score: 0

http://stackoverflow.com/q/22887254
has comment: http://stackoverflow.com/comment/34925488
tagged with: timer
type: Question
has title: timer scheduled cant find out how to stop it before it happens
tagged with: swing
has body: Well i cant seem to get the scheduled timer to stop/cancel :( if anyone knows how please help me :D /*Here follows the code */ private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) { Timer timer = new Timer(); if (jToggleButton1.isSelected()) { jToggleButton1.setText("STOP"); jToggleButton1.setBackground(Color.red); System.out.println("is called"); timer.schedule(new TimerTask() { @Override public void run() { // Your database code here System.out.println("scheduled time reached"); } }, times * 1000); } else { jToggleButton1.setText("START"); jToggleButton1.setBackground(Color.green); set = false; System.out.println("i called it"); timer.cancel(); //?????this doesnt seem to work :( } }
answer count: 1
tagged with: java
tagged with: timertask
upvote count: 1
has answer: http://stackoverflow.com/a/22887478
has comment: http://stackoverflow.com/comment/34925353
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22887478
has comment: http://stackoverflow.com/comment/34925325

http://stackoverflow.com/a/22867020
has body: Are the numbers always the same length? If so, use String.subString. If not use String.indexOf("csfo_add") to find the locations of the "csfo_add" parts and then find the relative locations of the required information.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22866906
score: 1
downvote count: 0

http://stackoverflow.com/comment/35023563
comment on: http://stackoverflow.com/a/22941039
has text: Thanks Mark for your information. I will add the same as Idea. Thanks
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34847365
score: 0
type: Comment
type: QuestionComment
has text: Obviously `mylocation` is `null`. You haven't provided anywhere near enough information for us to guess why it isn't getting set. Are you sure `onLocationChanged` has happened?
comment on: http://stackoverflow.com/q/22844368

http://stackoverflow.com/q/22840770
tagged with: string
duplicate of: http://stackoverflow.com/q/3422673
linked to: http://stackoverflow.com/q/7552660
has comment: http://stackoverflow.com/comment/34840574
favorite count: 0
has answer: http://stackoverflow.com/a/22841941
linked to: http://stackoverflow.com/q/2605032
has answer: http://stackoverflow.com/a/22841286
has answer: http://stackoverflow.com/a/22840902
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34840364
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34840388
tagged with: java
has body: I am new to Java so this may be a simple question. I have made a calculator where the user clicks buttons and it enters the text into a JTextField. I have used the .getText() method and saved it into a String. Using System.out.println() I have seen that the String is "8*7*7-8/4", obviously if I could just execute this and get the answer 390 then this would be far easier than splitting it up and making it more complicated than it seems. Thanks Matt
has title: Turning string into float Java
type: Question
linked to: http://stackoverflow.com/q/3422673
has comment: http://stackoverflow.com/comment/34840971
answer count: 3
tagged with: arrays

http://stackoverflow.com/comment/34952786
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22896241
has text: Refer to tutorials.jenkov.com/java-multithreaded-servers/index.html on how to create a server in Java (applicable to Android as well as long as you know which Java classes are available on Android)

http://stackoverflow.com/q/22953222
type: Question
has answer: http://stackoverflow.com/a/22953266
has body: I’m preparing for OCPJP7 exam on these days. I got two questions and accepting answers. First one is relevant to java and other one is about exam achievements. import java.nio.file.*; class Test13{ public static void main(String arfd[]){ Path a = Paths.get("D:\\OCPJP7\\programs\\..\\NIO2\\SRC\\.\\Subpath.java"); a=a.normalize(); System.out.println(a); } } According to the above code segment, I was expected the output as “D:\OCPJP7\programs\NIO2\SRC\Subpath.java” But it is not. It provides “D:\OCPJP7\NIO2\SRC\Subpath.java” As I know normalize() removes any redundant elements from the given path including single dot and double dot. Then why it removes \programs\ element? In order to be an Oracle Certified Professional, Java 7 Programmer, we have to sit for two exams; OCA -JP (Oracle Certified Associate, Java 7 programmer). Java SE 7 programmer. As I know we can achieve both exams in any order. So I’m intended to do first Java SE 7 programmer and then OCA. My question is what will offer by the Oracle, after passing both exams. Are they offering two certificates for both exams? or one certificate for both? And anything else?
tagged with: ocpjp
upvote count: 1
answer count: 1
favorite count: 0
tagged with: interface
tagged with: path
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/22953266
score: 1
tagged with: java
has title: Java Path interface and OCPJP7 Exam

http://stackoverflow.com/q/22838413
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22838502
tagged with: arrays
has comment: http://stackoverflow.com/comment/34836198
score: 0
has comment: http://stackoverflow.com/comment/34836392
has body: I'm trying to fill a two dimensional array with data from text file. Here's the text file: Newfoundland and Labrador 545.3 540.9 537.9 533.8 531.6 Prince Edward Island 136.9 137.8 138.3 138.9 139.9 Nova Scotia 936.1 941.2 942.3 942.9 944.8 New Brunswick 753.3 755.5 755.6 756 756.7 Quebec 7323.6 7351.2 7381.8 7417.7 7455.2 Ontario 11387.4 11527.9 11697.6 11894.9 12068.3 Manitoba 1137.9 1142.5 1146.4 1149.1 1150.8 Saskatchewan 1024.9 1025.6 1022 1017.1 1011.8 Alberta 2906.8 2959.6 3009.9 3059.1 3113.6 British Columbia 3997.1 4028.3 4060.1 4101.6 4141.3 Yukon 31.5 31.1 30.6 30.2 29.9 Northwest Territories 41.1 41 40.8 41.2 41.4 Nunavut 26.4 26.9 27.5 28.1 28.7 Here is my code: double year[] [] = new year [13] [5]; BufferedReader x = new BufferedReader (new FileReader ("populationByProvnices.txt")); i'm trying to fill the year array with the numbers from the text file above, thank u :D
has title: How to fill 2D array from text file data
answer count: 1
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/22838502
tagged with: double
type: AnsweredQuestion

http://stackoverflow.com/a/22890042
has comment: http://stackoverflow.com/comment/34930301
score: 5
answers question: http://stackoverflow.com/q/22890024
has comment: http://stackoverflow.com/comment/34936639
has body: I am not sure I completely buy that argument, but here is one possible reasoning. To an object-oriented purist, everything should be an object, and all state should be encapsulated by objects. Any static member of a class is by definition state which exists outside of an object, because you can use it and manipulate it without instantiating an object. Thus, the lack of static class members makes for a more pure object-oriented language.
type: Answer
has comment: http://stackoverflow.com/comment/34930374
upvote count: 5
has comment: http://stackoverflow.com/comment/34930147
has comment: http://stackoverflow.com/comment/34930139
has comment: http://stackoverflow.com/comment/34930417
has comment: http://stackoverflow.com/comment/34930194
downvote count: 0
has comment: http://stackoverflow.com/comment/34930710
has comment: http://stackoverflow.com/comment/34930615

http://stackoverflow.com/q/22954428
has title: Which java server to run a jar application?
score: 0
has comment: http://stackoverflow.com/comment/35046053
has comment: http://stackoverflow.com/comment/35046192
answer count: 1
has comment: http://stackoverflow.com/comment/35046952
tagged with: jar
has comment: http://stackoverflow.com/comment/35047013
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23032334
tagged with: jenkins
has body: I made a java program which runs unit test on my website. I need the unit test to keep running during the day while I watch the log. For this, I search a java platform on which I can run my soft. Openshift will be the best because it's easy to install and maintain. However I will often modify this soft and if the java project could be built whenever I made a commit it will be the best. That's why I think to Jenkins, but I don't know if it is a good way to run a jar from a jenkins server whereas it is made to do build. I tried JBoss and tomcat by wrapping my programs into an Enterprise Application Client but I can not run and check the log of the program from a web interface. Currently my project is a Java Application, using MySQL, hibernate, maven and git. What would be the best option for you ? Thanks. Florian C.
tagged with: java
type: Question

http://stackoverflow.com/comment/35066548
comment on: http://stackoverflow.com/q/22965524
type: QuestionComment
has text: changed it to indicate what I meant, "same instant of time". Midnight at GMT and 4.30 am in the timezone which is 4.30 hours ahead of GMT are the same instant of time, or at least this is my understanding...
type: Comment
score: 0

http://stackoverflow.com/comment/35059752
comment on: http://stackoverflow.com/a/22961990
type: AnswerComment
score: 0
type: Comment
has text: @user3514879 can you please show more code prior to the call of `fyllListe`?

http://stackoverflow.com/comment/34882138
has text: I meant something like this: textView.setText("This is a test");
comment on: http://stackoverflow.com/a/22862982
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22848034
has body: For instance interfaces are widely used in polymorphism. So if you have multiple classes implementing interface, you could keep them in the same way: class One implements Link {..} class Two implements Link {..} public static void main(String[] arg) { Vector&lt;Link&gt; links; Link link1 = new One(); Link link2 = new Two(); links.add(link1); links.add(link2); for (Link l : links) { l.mySampleMethod(); } }
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22847942
score: 1
downvote count: 0

http://stackoverflow.com/q/22926666
type: UnansweredQuestion
tagged with: sockets
tagged with: client
tagged with: java
type: Question
has body: My task is to display three options to the user 1)connect to server 2)post data 3)disconnect. I am having trouble in sending the file to the server. "The file needs to be sent from client to server". I am new to socket programming and however I try the connection is being reset while I try to send the file to server. server import java.net.*; import java.util.Scanner; import java.io.*; public class Server extends Thread { private ServerSocket serverSocket; public Server(int port) throws IOException { serverSocket = new ServerSocket(port); } public void run() { boolean flag = true; while (flag) { try { System.out.println("Waiting for client on port " + serverSocket.getLocalPort() + "..."); Socket server = serverSocket.accept(); Scanner reader = new Scanner(server.getInputStream()); File file = new File("compile.txt"); BufferedWriter fileWriter = new BufferedWriter(new FileWriter( file)); while (reader.hasNextLine()) { String str = reader.next(); fileWriter.write(str); System.out.println("" + str); } } catch (Exception e) { e.printStackTrace(); break; } } } public static void main(String[] args) { int port = 4444; try { Thread t = new Server(port); t.start(); } catch (IOException e) { e.printStackTrace(); } } } client import java.net.*; import java.util.Scanner; import java.io.*; public class Client { public static void main(String[] args) { Socket client = null; boolean flag = true; while (flag) { System.out .println("Please enter your choice\n1.Connect to Server\n2.Post Data\n3.Disconnect from Server"); Scanner userChoice = new Scanner(System.in); int choice = userChoice.nextInt(); String serverName = "localhost"; int port = 4444; if (choice == 1) { try { System.out.println("Connecting to " + serverName + " on port " + port); client = new Socket(serverName, port); System.out.println("Just connected to " + client.getRemoteSocketAddress()); } catch (IOException e) { e.printStackTrace(); } } else if (choice == 2) { System.out.println("enter path of file to be compiled"…
has title: Client server programming in java with options to user
has answer: http://stackoverflow.com/a/22942036
score: 0
answer count: 1

http://stackoverflow.com/comment/34942836
comment on: http://stackoverflow.com/q/22897102
type: Comment
type: QuestionComment
has text: @HunterMcMillen See [here](http://stackoverflow.com/questions/4158201/gwt-how-to-get-regexpattern-and-matcher-working-in-client-side).
score: 0

http://stackoverflow.com/comment/34970056
has text: file exists but still folder is empty
type: Comment
comment on: http://stackoverflow.com/a/22911192
score: 0
type: AnswerComment

http://stackoverflow.com/q/22829946
downvote count: 0
has title: Finagle using load balancing across custom Services
favorite count: 0
type: UnansweredQuestion
answer count: 0
tagged with: finagle
score: 1
tagged with: scala
has body: Unfortunately all documentation on Finagle only shows examples of using ClientBuilders to build clients. If I have a Set of Services, is it possible to add load balancing and fail-fast capabilities to it and combine them in one Service this way? I want something like this: Set&lt;Service&lt;A, B&gt;&gt; serviceSet = ...; Service&lt;A, B&gt; = Balancer.make(serviceSet); How exactly do I use finagle.loadbalancer and ServiceFactories to do this?
upvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/comment/34813859
score: 0
type: Comment
type: QuestionComment
has text: @assylias Why shouldn't it be public (if it's final)? That's my reasoning.
comment on: http://stackoverflow.com/q/22825409

http://stackoverflow.com/comment/34885403
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22839003
type: QuestionComment
has text: And how would you deserialized to an `Optional.absent()`? I'm not saying that it is not doable, but you'll have to explicit what you want. Also, another option would be to have the getter only return an `Optional`; the setter would work "normally".

http://stackoverflow.com/comment/56197581
comment on: http://stackoverflow.com/a/22811053
score: 1
has text: Will default `initialize()` method be called automatically when this interface class is put on the heap?
type: AnswerComment
type: Comment

jdialog
tags question: http://stackoverflow.com/q/22913888
type: Tag
tags question: http://stackoverflow.com/q/22899581
tags question: http://stackoverflow.com/q/22911611
tag name: jdialog
tags question: http://stackoverflow.com/q/22851542
tags question: http://stackoverflow.com/q/22863339
tags question: http://stackoverflow.com/q/22870365

http://stackoverflow.com/a/22943579
downvote count: 0
score: 3
has body: that is just because you are never referring them in your code as you referred second by following if(t) break second;
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/22943551

http://stackoverflow.com/comment/35057574
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22959166
has text: on which device are you testing your app?
type: AnswerComment

http://stackoverflow.com/comment/34921381
type: Comment
comment on: http://stackoverflow.com/q/22854130
type: QuestionComment
has text: Btw. Why don´t you use annotations for injecting the pojo into the service in C. This should work.
score: 0

http://stackoverflow.com/comment/35065544
type: Comment
has text: Thanks James! to correct me. I forgot Java pass primitives as a CallByValue but use CallByReference in case of References.So if arguments are of type reference then those are not Thread safe.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22964626

http://stackoverflow.com/comment/34849171
type: Comment
comment on: http://stackoverflow.com/a/22845414
score: 0
type: AnswerComment
has text: To be honest, I did try that but I continued to get errors. I just ran out of patience and decided to try everything.

http://stackoverflow.com/comment/34954835
score: 0
type: Comment
has text: Using regex is going to be slower than doing it manually, given the extra overhead for Regex parsing etc, and benefit of sharing char array for substring. However, I just cannot imagine how *Slow* OP is facing. It doesn't seems to me that the code can be slow even the string is with length in thousands magnitude.
comment on: http://stackoverflow.com/a/22878756
type: AnswerComment

http://stackoverflow.com/a/22881422
answers question: http://stackoverflow.com/q/22881209
has body: bin is generated when you compile your application and it is impossible to update it after when the application is running. you have to save your images in another place (sd card or internal memory) then read it from there. you can of course put this resources as private to your application. you should make a look at : The Storage Options
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22881209
type: Answer
score: 0

http://stackoverflow.com/a/22911498
downvote count: 0
upvote count: 2
has body: You Can Use "ThreadPoolExecuter".. this is a good example: https://code.google.com/p/shelves/source/browse/trunk/Shelves/src/org/curiouscreature/android/shelves/util/UserTask.java
type: Answer
answers question: http://stackoverflow.com/q/22911395
score: 2

http://stackoverflow.com/comment/35063691
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22962932
has text: Did you try a simple test where the client and server are on the same machine?
type: Comment

http://stackoverflow.com/comment/34853170
score: 0
comment on: http://stackoverflow.com/q/22846076
type: Comment
type: QuestionComment
has text: Just get rid of it and block in the read method. At the moment you're just smoking the CPU and incidentally draining the battery, whenever available() is zero, which is most of the time in any platform.

http://stackoverflow.com/a/22905360
upvote count: 1
has body: First, I would start by extracting the content in the &lt;body&gt; section of the String. Afterwards, it depends on your liking, but you could remove every HTML-tag, for example, but beware that any formatting (line breaks!) code is gone and you get only a big chunk of text.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34957939
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22866881
answers question: http://stackoverflow.com/q/22866881
score: 1
has comment: http://stackoverflow.com/comment/34958088

rmi
tags question: http://stackoverflow.com/q/22937415
tags question: http://stackoverflow.com/q/22964545
tags question: http://stackoverflow.com/q/22941593
tags question: http://stackoverflow.com/q/22948482
tag name: rmi
type: Tag
tags question: http://stackoverflow.com/q/22882489
tags question: http://stackoverflow.com/q/22921264

http://stackoverflow.com/a/22811057
upvote count: 1
has body: You need to add the default constructor to the class you want to serialize.
has comment: http://stackoverflow.com/comment/34787216
has comment: http://stackoverflow.com/comment/34787371
downvote count: 0
answers question: http://stackoverflow.com/q/22810921
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/34787162

http://stackoverflow.com/comment/34926876
type: AnswerComment
score: 0
type: Comment
has text: Thanks for the answer, but then how to replace "cash,carry" with cash+carry. I appreciate your help, and it is escaping to the next line, because of comma.
comment on: http://stackoverflow.com/a/22888138

http://stackoverflow.com/comment/34946518
comment on: http://stackoverflow.com/a/22899043
type: AnswerComment
score: 0
type: Comment
has text: Well, i believe that in single threaded scenario, where there is only one thread running, it will be running until the program ends. Another example might be that of Android applications, where there is a main/master thread (which menages the GUI and should not be used for time consuming processes), it will be on running state all the time to handle UI interactions.

http://stackoverflow.com/q/22928631
has answer: http://stackoverflow.com/a/22928824
score: 0
has body: i log the messages in the log file using filehandler in xml format. log messages are stored successfully in the log file. but the log messages are still displaying in the netbeans command prompt. how to stop displaying those log messages?
has title: how to stop printing the log details in command prompt in netbeans?
tagged with: netbeans
type: UnansweredQuestion
tagged with: logging
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22928919

http://stackoverflow.com/a/22825066
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/34813656
has comment: http://stackoverflow.com/comment/34816639
upvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22825018
answers question: http://stackoverflow.com/q/22825018
type: Answer
has comment: http://stackoverflow.com/comment/34813133
has body: Use students[i] = input.next(); Just checked it, and it works now. nextLine() advances your scanner past the current line and returns the input that was skipped -- so you were pretty much skipping a line. The first time it enters the loop, you lose an i value, that is i is now 1, yet your scanner does not record user input. The second time around, when i is 1, it takes input, and so forth. New code: public static void main(String[] args) { Scanner input = new Scanner(System.in); int numOfStu; String[] students; double[] scores; System.out.println("Enter the number of students being recorded: "); numOfStu = input.nextInt(); students = new String[numOfStu]; scores = new double[numOfStu]; System.out.println("Enter students' names: "); for (int i = 0; i &lt; students.length; i++) { students[i] = input.next(); } for (int i = 0; i &lt; students.length; i++) { System.out.print("Enter score for " + students[i] + ": "); scores[i] = input.nextDouble(); } }

http://stackoverflow.com/a/22878330
upvote count: 6
has comment: http://stackoverflow.com/comment/34912321
accepted answer of: http://stackoverflow.com/q/22878062
has body: I'm not a GWT developer, but I suspect this is calling Panel.add(Widget) which documents these steps (emphasis mine): There are several important things that must take place in the correct order to properly add or insert a Widget to a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered. Validate: Perform any sanity checks to ensure the Panel can accept a new Widget. Examples: checking for a valid index on insertion; checking that the Panel is not full if there is a max capacity. Adjust for Reinsertion: Some Panels need to handle the case where the Widget is already a child of this Panel. Example: when performing a reinsert, the index might need to be adjusted to account for the Widget's removal. See ComplexPanel.adjustIndex(Widget, int). Detach Child: Remove the Widget from its existing parent, if any. Most Panels will simply call Widget.removeFromParent() on the Widget. Logical Attach: Any state variables of the Panel should be updated to reflect the addition of the new Widget. Example: the Widget is added to the Panel's WidgetCollection at the appropriate index. Physical Attach: The Widget's Element must be physically attached to the Panel's Element, either directly or indirectly. Adopt: Call adopt(Widget) to finalize the add as the very last step. In other words, when you add something to one panel, it's removed from whatever panel it's currently part of, if any. To be honest, it's not clear what effect you expected anyway - you've still only got two objects... what would it mean for a single widget to be in a panel multiple times? If you want multiple widgets, create multiple objects.
answers question: http://stackoverflow.com/q/22878062
score: 6
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34817453
score: 2
has text: Immutable objects can actually make things much easier for a garbage collector, because an immutable reference that's been copied and traced can't be mutated to point to something in from-space. I doubt Java implementations take advantage of this, but functional language implementations (Haskell, ML, etc.) certainly do.
type: Comment
comment on: http://stackoverflow.com/a/22827605
type: AnswerComment

http://stackoverflow.com/q/22859064
tagged with: user-interface
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
tagged with: text
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22859319
type: Question
has title: (Java) How to read/write Text in/out of a Textfield/Textarea/Textlabel/... of another Programm
has body: I was trying to make a easy Bot (Java) for the Skypechat or something like this. I want it to read the text which was sent to me at least and calculate by a clever progress a good answer. This answer should be written back of course. And here comes my problem. I have no idea, how to read the Text (if it is easier to do, read the whole one, but just the last message would be better) of the unknown Textarea/Textfield/whatever and write mine back into the Textbox of my Client. Also, it would be nice to know, how to make my Bot "pressing the sendbutton". I´ve seen such a Bot, already. The Progress which is creating the answer exists already, so you dont have to care for this one.
accepted answer: http://stackoverflow.com/a/22859319

http://stackoverflow.com/q/22884538
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22884683
has answer: http://stackoverflow.com/a/22884816
has body: I am working on an application that uses AutoCompleteTextView and switches between Activities according to the option selected. But, now my application is crashing down at startup. I can't understand why. Please help. import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Toast; import android.view.inputmethod.InputMethodManager; public class MainActivity extends Activity { String[] presidents= { "John F. Kennedy", "Lyndon B. Johnson", "Richard Nixon", "Gerald Ford", "Jimmy Carter", "Ronald Reagan", "George H. W. Bush", "Bill Clinton", "George W. Bush", "Barack Obama" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.select_dialog_item, presidents); textView.setThreshold(3); textView.setAdapter(adapter); textView.setOnItemSelectedListener((OnItemSelectedListener) this); textView.setOnItemClickListener((OnItemClickListener) this); textView.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int index, long id) { int position=0; if(position == 1){ Intent i = new Intent (MainActivity.this, SecondActivity.class); i.putExtra("KEY", presidents[index]); startActivity(i); } } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { // TODO Auto-generated method stub } }); } } Layout: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://…
answer count: 2
upvote count: 1
tagged with: autocompletetextview
has title: Application implementing AutoCompleteTextView crashing at startup
favorite count: 0
type: UnansweredQuestion
tagged with: classcastexception
tagged with: android

http://stackoverflow.com/q/22886376
has comment: http://stackoverflow.com/comment/34933469
tagged with: xuggle
type: Question
has title: OpenGL - Rendering texture, color glitch
has comment: http://stackoverflow.com/comment/34924549
has comment: http://stackoverflow.com/comment/34933321
has comment: http://stackoverflow.com/comment/34934330
tagged with: bytebuffer
tagged with: glteximage2d
upvote count: 1
has comment: http://stackoverflow.com/comment/34923724
favorite count: 0
has comment: http://stackoverflow.com/comment/34931992
type: UnansweredQuestion
has body: I'm trying render video as texture using xuggle, but i have some troubles... Here's my code: ByteBuffer last = ent.oneBuffer; if (ent.bufList.get(0) != null){ last = ent.bufList.get(0); } last.rewind(); //last.flip(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200f, 100f); GL11.glColor4f(1f, 1f, 1f, 1f); GL11.glBindTexture(GL11.GL_TEXTURE_2D, ent.texture.allocatedIndex); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 1280, 720, 0, GL11.GL_RGB, GL12.GL_UNSIGNED_BYTE_3_3_2, last); drawTexturedRect(x,y, width, height); GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); if (ent.bufList.size() &gt; 21){ ent.bufList.remove(0); } And video reader (Another thread): ... IMediaReader reader = ToolFactory.makeReader( new File("E:\\test.mp4").getAbsolutePath() ); reader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR); IMediaTool addTimeStamp = new TimeStampTool(); reader.addListener(addTimeStamp); reader.open(); while(reader.readPacket() == null){ reader.readPacket(); } ... public List&lt;ByteBuffer&gt; bufList = new ArrayList(); public class TimeStampTool extends MediaToolAdapter { public long last = 0; @Override public void onVideoPicture(IVideoPictureEvent event) { bufList.add(event.getPicture().getByteBuffer()); } } Please tell me, what am I doing wrong? I tried changing glTexImage2D format and type, but got only errors :( Result image (World render): EDIT: I have gray texture with that code: GL11.glBindTexture(GL11.GL_TEXTURE_2D, ent.texture.allocatedIndex); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FIL…
answer count: 0
downvote count: 0
tagged with: opengl
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34932656
has comment: http://stackoverflow.com/comment/34932006

http://stackoverflow.com/comment/34946188
type: Comment
score: 0
has text: `response.getBody()` will give you a string.
type: QuestionComment
comment on: http://stackoverflow.com/q/22897111

http://stackoverflow.com/q/22842673
tagged with: ide
score: 1
has comment: http://stackoverflow.com/comment/34884511
favorite count: 0
has body: (sorry I could not find a title) it's my first question here, and I trust in you guys! I recently accidentially made a Project called "Queue" in school, at the end of the lesson I uploaded it to our school's CVS. Later I found out that I used an upper case "Q" and made a new one called "queue". Today after re-installing eclipse at home I tried to check out the whole project, and couldn't because: "Could not create resource /objekte/src/queue: Problem creating folder: /objekte/src/queue. A resource exists with a different case: '/objekte/src/Queue'." How can I permanently fix this. AFAIK I cannot delete anything on the repo... :( Thanks guys!
type: Question
has title: CVS check out - Names
tagged with: repository
upvote count: 1
tagged with: cvs
tagged with: java
type: UnansweredQuestion
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34844567
has comment: http://stackoverflow.com/comment/34845601
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/34993961
score: 2
comment on: http://stackoverflow.com/q/22924469
type: Comment
type: QuestionComment
has text: `p2.setLayout(null)` that's one of your problems

http://stackoverflow.com/a/22927018
has body: Try doing: System.out.println(fooObject.tictactoe("XXXXXXOOO"); inside your main argument (public static void main(String[] args) I suspect you've confused return and System.out.println. The console will not print anything if returned. Instead, returning is what is thrown at the computer after the function is called. Try printing the result of calling the function...THAT is what is returned to the computer and is only going to be visible if you print it. There may not be any error in your code.
score: 0
answers question: http://stackoverflow.com/q/22926858
type: Answer

http://stackoverflow.com/a/22972314
downvote count: 0
score: 6
has body: Once I knew what question to ask, google answered this really quickly. I found a quick fix on this blog. BufferedImage tempCard = deck.getSubimage( x, y, width, height ); Image card = SwingFXUtils.toFXImage(tempCard, null ); Tried it out and works great!
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/22923518
answers question: http://stackoverflow.com/q/22923518
type: AcceptedAnswer

http://stackoverflow.com/comment/34933973
type: Comment
comment on: http://stackoverflow.com/q/22891329
has text: @slim : while i appreciate ur link, but my question is not a homework and also, its has a *definite* answer....not an opinion....so i think it does belong to SO! :)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34801116
has text: Thanks.How should I go about defining something like `QR[i] = new ClassA(i);` for Class1 ?
type: Comment
comment on: http://stackoverflow.com/a/22818354
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34924169
type: QuestionComment
comment on: http://stackoverflow.com/q/22886591
has text: so it actualy random and there is no pattern connected to the sleeping time?
score: 0
type: Comment

methods
tags question: http://stackoverflow.com/q/22905330
tags question: http://stackoverflow.com/q/22858392
tags question: http://stackoverflow.com/q/22826397
tag name: methods
tags question: http://stackoverflow.com/q/22823907
tags question: http://stackoverflow.com/q/22822481
tags question: http://stackoverflow.com/q/22952642
tags question: http://stackoverflow.com/q/22926354
tags question: http://stackoverflow.com/q/22836104
tags question: http://stackoverflow.com/q/22952300
tags question: http://stackoverflow.com/q/22927392
tags question: http://stackoverflow.com/q/22901412
tags question: http://stackoverflow.com/q/22888771
type: Tag
tags question: http://stackoverflow.com/q/22903565
tags question: http://stackoverflow.com/q/22965409
tags question: http://stackoverflow.com/q/22927602
tags question: http://stackoverflow.com/q/22846942
tags question: http://stackoverflow.com/q/22901789
tags question: http://stackoverflow.com/q/22913321
tags question: http://stackoverflow.com/q/22872659
tags question: http://stackoverflow.com/q/22872348
tags question: http://stackoverflow.com/q/22818613
tags question: http://stackoverflow.com/q/22903275
tags question: http://stackoverflow.com/q/22924223
tags question: http://stackoverflow.com/q/22851439
tags question: http://stackoverflow.com/q/22937679
tags question: http://stackoverflow.com/q/22926320
tags question: http://stackoverflow.com/q/22929486
tags question: http://stackoverflow.com/q/22881874
tags question: http://stackoverflow.com/q/22814470
tags question: http://stackoverflow.com/q/22918844
tags question: http://stackoverflow.com/q/22826360
tags question: http://stackoverflow.com/q/22949718
tags question: http://stackoverflow.com/q/22868200
tags question: http://stackoverflow.com/q/22852167
tags question: http://stackoverflow.com/q/22850690
tags question: http://stackoverflow.com/q/22852558
tags question: http://stackoverflow.com/q/22826331
tags question: http://stackoverflow.com/q/22890351
tags question: http://stackoverflow.com/q/22932566
tags question: http://stackoverflow.com/q/22889129
tags question: http://stackoverflow.com/q/22899934
tags question: http://stackoverflow.com/q/22928733
tags question: http://stackoverflow.com/q/22850185
tags question: http://stackoverflow.com/q/22883748
tags question: http://stackoverflow.com/q/22853543
tags question: http://stackoverflow.com/q/22882844
tags question: http://stackoverflow.com/q/22876640
tags question: http://stackoverflow.com/q/22928870
tags question: http://stackoverflow.com/q/22859830
tags question: http://stackoverflow.com/q/22832733
tags question: http://stackoverflow.com/q/22966012

http://stackoverflow.com/comment/35026209
has text: Thanks will try, Does nested split works ? It is not mentioned anywhere in documentation ?
type: AnswerComment
comment on: http://stackoverflow.com/a/22940854
score: 0
type: Comment

http://stackoverflow.com/a/23063066
has body: You can pass entire objects via intent. You just need to implement Serializable interface for the class you want to pass. Example: public class Ringtone implements Serializable { public String name; public String path; //can be integer public String file; } send via intent: Ringtone ringtoneObj = new Ringtone(); intent.putExtra("test",ringtoneObj); retrieve via intent: Ringtone ringtoneFromIntent = (Ringtone) intent.getSerializableExtra("test");
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22883315

http://stackoverflow.com/q/22888846
type: Question
has answer: http://stackoverflow.com/a/22898848
downvote count: 0
has body: Is there anyway to configure Spring to cache component-scan / autowiring information to improve startup times from one start to another? I'm investigating using GAE for a Spring app for the first time, and according to the GAE docs they recommend pretty much disabling all the practical features that Spring offers to make development faster. Ex: component-scan, autowiring, using lazy-init beans, etc. Basically everything that takes the container longer to setup. Although I understand the principal behind all these suggestions, I find that it is almost taking a step backwards in the development process. What would make it very interesting / useful is if there was a way for Spring to generate a cache file of sorts that it could reference for future startups to avoid having to do the full component scan/etc every time. Does anything like this exist?
tagged with: ioc-container
answer count: 3
tagged with: google-app-engine
favorite count: 0
has answer: http://stackoverflow.com/a/22892509
tagged with: spring
accepted answer: http://stackoverflow.com/a/22892509
type: AnsweredQuestion
score: 3
has title: Can Spring cache component-scan information / autowire to improve startup times?
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27128562
possible better answer: http://stackoverflow.com/a/22898848
tagged with: caching

http://stackoverflow.com/comment/34915279
type: Comment
comment on: http://stackoverflow.com/q/22881747
score: 0
has text: You should use Iterator
type: QuestionComment

http://stackoverflow.com/q/22953348
has body: In my android application I have to convert following json string into a map. my json array is following, [ { "WindDirection": { "id": "3", "wind_direction": "East", "is_deleted": false } }, { "WindDirection": { "id": "14", "wind_direction": "East NorthEast", "is_deleted": false } }, { "WindDirection": { "id": "15", "wind_direction": "East SouthEast", "is_deleted": false } }, { "WindDirection": { "id": "1", "wind_direction": "North", "is_deleted": false } }, { "WindDirection": { "id": "10", "wind_direction": "North NorthEast", "is_deleted": false } }, { "WindDirection": { "id": "11", "wind_direction": "North NorthWest", "is_deleted": false } }, { "WindDirection": { "id": "7", "wind_direction": "North West", "is_deleted": false } }, { "WindDirection": { "id": "6", "wind_direction": "NorthEast", "is_deleted": false } }, { "WindDirection": { "id": "4", "wind_direction": "South", "is_deleted": false } }, { "WindDirection": { "id": "12", "wind_direction": "South SouthEast", "is_deleted": false } }, { "WindDirection": { "id": "13", "wind_direction": "South SouthWest", "is_deleted": false } }, { "WindDirection": { "id": "8", "wind_direction": "SouthEast", "is_deleted": false } }, { "WindDirection": { "id": "9", "wind_direction": "SouthWest", "is_deleted": false } }, { "WindDirection": { "id": "2", "wind_direction": "West", "is_deleted": false } }, { "WindDirection": { "id": "16", "wind_direction": "West NorthWest", "is_deleted": false } }, { "WindDirection": { "id": "17", "wind_direction": "West SouthWest", "is_deleted": false } } ] i want to put the id and wind direction into a hash map. what is the easiest way of doing this.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22953839
type: UnansweredQuestion
tagged with: android
has title: converting json value key pare in to a hashmap
type: Question
has answer: http://stackoverflow.com/a/22953435

sudoku
tags question: http://stackoverflow.com/q/22852581
tags question: http://stackoverflow.com/q/22890999
tags question: http://stackoverflow.com/q/22858434
type: Tag
tag name: sudoku

http://stackoverflow.com/comment/35007237
comment on: http://stackoverflow.com/q/22932453
type: Comment
type: QuestionComment
has text: If you cannot do it with `sed` you could try a [Java parser](https://code.google.com/p/javaparser/).
score: 0

http://stackoverflow.com/q/22917478
has answer: http://stackoverflow.com/a/22943850
tagged with: libgdx
tagged with: java
type: UnansweredQuestion
has body: I've been looking through this code for over 2 days and still can't find any errors in the code as to why it crashes on Android. It works perfectly fine on desktop. Android Target: 4.0.3 Android Phone used: HTC Desire C Logcat: 04-07 16:42:35.785: E/AndroidRuntime(24197): FATAL EXCEPTION: GLThread 2955 04-07 16:42:35.785: E/AndroidRuntime(24197): java.lang.ClassCastException: com.badlogic.gdx.math.Vector2 cannot be cast to java.lang.String 04-07 16:42:35.785: E/AndroidRuntime(24197): at com.survivegameandroidtest.survive.Player.readPlayer(Player.java:191) 04-07 16:42:35.785: E/AndroidRuntime(24197): at com.survivegameandroidtest.survive.MainMenu.loadPlayer(MainMenu.java:278) 04-07 16:42:35.785: E/AndroidRuntime(24197): at com.survivegameandroidtest.survive.MainMenu.show(MainMenu.java:127) 04-07 16:42:35.785: E/AndroidRuntime(24197): at com.badlogic.gdx.Game.setScreen(Game.java:62) 04-07 16:42:35.785: E/AndroidRuntime(24197): at com.survivegameandroidtest.survive.GameHub.create(GameHub.java:12) 04-07 16:42:35.785: E/AndroidRuntime(24197): at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:334) 04-07 16:42:35.785: E/AndroidRuntime(24197): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1463) 04-07 16:42:35.785: E/AndroidRuntime(24197): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1224) Like I said, this works fine on desktop, but crashes on Android. Player class package com.survivegameandroidtest.survive; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.Serializable; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.bad…
has comment: http://stackoverflow.com/comment/35000557
type: Question
tagged with: android
has title: LIBGDX runs fine on desktop, but crashes on android
has comment: http://stackoverflow.com/comment/34981335
has comment: http://stackoverflow.com/comment/34986322
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34982729

http://stackoverflow.com/q/22879684
has title: If condition always routing towards hasError condition while submitting a form
score: 4
tagged with: foreign-key-relationship
upvote count: 4
tagged with: playframework
answer count: 1
downvote count: 0
favorite count: 0
tagged with: exception
tagged with: ebean
has answer: http://stackoverflow.com/a/22894651
type: AnsweredQuestion
tagged with: java
has body: I have created a simple form to add a shop, every shop has a manytoone relation with the member Shop.java model package models; @Entity public class Shop extends Model { @Id@SequenceGenerator(name = "shop_gen", sequenceName = "shop_id_seq", allocationSize = 1)@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "shop_gen")@Column(name = "id") public Long id; @Required public String name; @Required public String addressLine1; public String addressLine2; public String addressLine3; @Required public String city; @Required public String town; @Required public String phoneNumber; @ManyToOne@JoinColumn(name = "email", insertable = false, updatable = false, nullable = false)@Required public Member email; public static Model.Finder &lt; Long, Shop &gt; find = new Model.Finder(Long.class, Shop.class); public static Shop create(Shop shop) { shop.save(); return shop; } } Member.java model @Entity public class User extends Model { @Id @Email @OneToMany(cascade = {CascadeType.ALL}) @JoinColumn(name = "email") public String email; @Required public String password; @Required public String firstName; @Required public String lastName; } ShopController.java package controllers; public class ShopController extends Controller { static Form&lt;Shop&gt; shopForm = Form.form(Shop.class); public static Result submit() { Form&lt;Shop&gt; filledForm = shopForm.bindFromRequest(); if(filledForm.hasErrors()) { return badRequest(views.html.shop.create.render(filledForm, Member.names())); } else { Shop shop = filledForm.get(); Shop.create(shop); return redirect(routes.ProductController.blank()); } } } but when I am submitting form to add a shop It loads the same page with the entry filled means if condition is always true ,I am using postgresql and this problem didn't occured in my previous database mysql. Can anybody help me?
type: Question
accepted answer: http://stackoverflow.com/a/22894651

http://stackoverflow.com/comment/34910466
has text: Performance isn't the only consideration. You also need to consider architecture, points of failure, ... For example, *why* do you have the same data in two places? What are the risks of them getting out of sync? What are the consequences?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22879001
type: Comment

http://stackoverflow.com/comment/34873636
type: AnswerComment
score: 0
type: Comment
has text: Does not matter Abdul. Any help is greatly appreciated. Anyways, I was able to crack what I wanted to do :)
comment on: http://stackoverflow.com/a/22858793

http://stackoverflow.com/a/22900229
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22864465
has body: Right, I figured out what causes this, looking at the maven-release-manager source code. When rewriting the developerConnection value, the RewritePomsForReleasePhase class calculates the number of subdirectories we need to remove from the developerConnectionUrl to get to the root of our project, based on the local project. Now there are two problems with this approach: There is no guarantee the local depth will match the remote one. Although this may be best practice. The working dir (from where mvn is called) does not have to be in the root of the project. Both apply to my situation. I checked out the project two directories less deep than remote. To clarify: http://localhost/project/3. Implementation/02 Source code was checked out to D:\workspace\project Also, we have a project-parent dir containing our parent pom. So now it determines we are 1 deep by looking at the local structure (from work dir, i.e. project-parent, to project dir) and applies this to the developerConnection url. Then it does a substring on the original developerConnection with the result and ends up with 02 Source code in my case. So long story less long: maven-release-plugin does not work as expected when the local directory structure does not match the remote one. Now I have to checkout honoring the server path and also create a new pom, or move the parent pom to the project root to get it to work... EDIT: Moving the pom to the project base dir would probably fix the issue, leaving the developerConnection url unchanged. Will confirm this for the next release.
accepted answer of: http://stackoverflow.com/q/22864465
type: AcceptedAnswer
downvote count: 0

jbutton
tags question: http://stackoverflow.com/q/22876768
tags question: http://stackoverflow.com/q/22946355
tags question: http://stackoverflow.com/q/22925397
tags question: http://stackoverflow.com/q/22902545
tags question: http://stackoverflow.com/q/22942131
tags question: http://stackoverflow.com/q/22897541
tags question: http://stackoverflow.com/q/22945712
tags question: http://stackoverflow.com/q/22902247
tags question: http://stackoverflow.com/q/22925460
tags question: http://stackoverflow.com/q/22943928
tags question: http://stackoverflow.com/q/22903159
tags question: http://stackoverflow.com/q/22873599
tags question: http://stackoverflow.com/q/22831880
tags question: http://stackoverflow.com/q/22889227
tags question: http://stackoverflow.com/q/22904006
type: Tag
tags question: http://stackoverflow.com/q/22949888
tags question: http://stackoverflow.com/q/22867838
tags question: http://stackoverflow.com/q/22918890
tags question: http://stackoverflow.com/q/22903385
tags question: http://stackoverflow.com/q/22869921
tags question: http://stackoverflow.com/q/22929970
tags question: http://stackoverflow.com/q/22923580
tags question: http://stackoverflow.com/q/22899457
tags question: http://stackoverflow.com/q/22946961
tags question: http://stackoverflow.com/q/22961286
tags question: http://stackoverflow.com/q/22917785
tags question: http://stackoverflow.com/q/22952405
tag name: jbutton
tags question: http://stackoverflow.com/q/22865976
tags question: http://stackoverflow.com/q/22850721

http://stackoverflow.com/comment/34898620
type: Comment
score: 1
has text: There should never be a need to add a KeyListener to a text component, use a DocumentListener to monitor changes, DocumentFilter to filter content coming into the field and ActionListener to detect when the field is actioned
comment on: http://stackoverflow.com/a/22870019
type: AnswerComment

http://stackoverflow.com/q/22966012
favorite count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/35066637
has title: Could I have some guidance on introducing methods into my wages program?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22966479
upvote count: 3
score: 1
tagged with: java
has body: I am a little stuck. I have grasped the concept of methods; understanding their purpose but still unsure on how to code it. Below is part of my code I kindly need guidance on. I am trying to create a method which can hold roles and depending on which switch option is selected it will return the the amount. I have four employment roles which all have different payscales. I have commented the errors on the role method. If I can correct this and make it work then I can complete this program :) import java.util.Scanner;//allows input from the keyboard import java.text.*; class Wage_Method_2 { public static void main(String[]args) { Scanner input = new Scanner(System.in); DecimalFormat fmt = new DecimalFormat("0.00"); double normHrs = 0, overHrs = 0, bonusHrs = 0, actualHrs = 0, cash=0, overPay =0, bonusPay = 0, grossWage = 0,vat23 = 0, netWage =0; String empName,nextEMP = "y", manager, superVisor, teamLead, general; while (nextEMP.equalsIgnoreCase("y")) { System.out.print("Please enter an employee's first name: "); empName = input.next();//their name System.out.print("Please enter "+empName+"'s employment ID: "); int job = input.nextInt(); System.out.print("Please enter their total hours worked: "); actualHrs = input.nextDouble(); double basicPay = rate (5.75)*actualHrs; System.out.println("Basic Pay: "+basicPay); System.out.println("\nWould you like to log hours for another employee?"); nextEMP = input.next(); if (nextEMP.equalsIgnoreCase("n")) { System.out.println("Thank you, the hours have been successfully logged."); } }// end of whileloop }// end of class public static double rate (double cash String jobrole)// when compiling these errors appear: error: ')' expected and error: &lt;identifier&gt; expected { switch (jobrole) { case 1: cash = 5.75; case 2: cash = 5.75*1.1; case 3: cash = 5.75*1.25; case 4: cash = 5.75*1.42; break; } return (cash); } }// end of program
tagged with: methods
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22966257
has answer: http://stackoverflow.com/a/22966257
has comment: http://stackoverflow.com/comment/35066831
has answer: http://stackoverflow.com/a/22966479

http://stackoverflow.com/comment/34862093
has text: "The cast is allowed, but the message is on the method not existing in the class to which you casted fruit -- SomeClass." - I think this is not true. Please check the same. I have the method everywhere possible. I think there is some other reason for it.
comment on: http://stackoverflow.com/a/22846981
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34866162
type: Comment
comment on: http://stackoverflow.com/a/22854415
type: AnswerComment
score: 0
has text: Thank you sir.I have already created a new xml layout for abc class and that worked well . Sorry for wasting your time

http://stackoverflow.com/comment/46257312
has text: Yes, you can add methods to your custom interface with the same signature of the default methods you want to ovverride and implement them your way in the Impl class implementing the custom interface: in this way, Spring Data will use your custom implementation instead of the default one. At least this works for me for the delete method in Spring Data JPA 1.7.2.
comment on: http://stackoverflow.com/a/22867393
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/22919013
type: UnansweredQuestion
has title: InputStream to Hadoop SequenceFile
has answer: http://stackoverflow.com/a/22920916
type: Question
tagged with: java
tagged with: hadoop
score: 0
answer count: 1
tagged with: hdfs
has body: I have a generic input stream that represents a sequence file. I would like to create a SequenceFile.Reader, or a similar class, from it with out needing to write the output stream to a temp file on disk. Is there something that would like me go from an input stream to something that would allow me to read the key/value pairs from the inputstream.

http://stackoverflow.com/q/22866906
upvote count: 1
downvote count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/34887824
has comment: http://stackoverflow.com/comment/34888056
favorite count: 0
has comment: http://stackoverflow.com/comment/34888930
has comment: http://stackoverflow.com/comment/34888419
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34887750
has comment: http://stackoverflow.com/comment/34887801
has answer: http://stackoverflow.com/a/22867020
has answer: http://stackoverflow.com/a/22867349
tagged with: java
has title: Getting a part of a string in java
type: Question
has body: so, right now I have this String: String csfo = "([csfo_num = 333015303][ csfo_minimum = 4044504600][ csfo_offering = 48526][csfo_add_ind A])"; I want to be able to get just this part of the the string but I'm at a loss as to how to do this. Needed Output: String[] requiredOutput; requiredOutput[1] = 48526; // csfo_offering requiredOutput[2] = csfo_add_ind A; or requiredOutput[2] = A; // csfo_add_ind EDIT: I have used some of your suggestions and am trying out subString but it seems like its a temp fix because if the length of the original string changes then it will throw a wrench in my calls. I will try regex next because it seems to go by pattern matching and I might be able to figure something out with that. Thanks everyone for all your help. Suggestions are still appreciated!
score: 0
answer count: 2

http://stackoverflow.com/q/22826782
tagged with: java
has title: Log4j Programmatically create new file for parallel runs
answer count: 1
has body: I am at somewhat of a loss. I am trying to create a new log file each time a process runs. The process can run in parallel. When it does, I would like to create a separate log for each process and have the log write to their respective log files. I am struggling with this because whatever is the "last" appender to get created, that is where the files are writing. I don't know how to fix this problem. Enough talk, here is the log4j.properties file. log4j.rootLogger=DEBUG, CONSOLE log4j.appender.myappender.encoding=UTF-8 log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout.ConversionPattern=%-5p %x %c - %m%n # LOGFILE is set to be a File appender using a PatternLayout. log4j.appender.LOGFILE=org.apache.log4j.FileAppender log4j.appender.LOGFILE.Append=false log4j.appender.LOGFILE.Threshold=DEBUG log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout log4j.appender.LOGFILE.layout.ConversionPattern=%-5p %x %c - %m%n and the code I am using Logger rootLogger = Logger.getRootLogger(); Enumeration appenders = rootLogger.getAllAppenders(); FileAppender fa = null; while(appenders.hasMoreElements()) { Appender currAppender = (Appender) appenders.nextElement(); if(currAppender instanceof FileAppender) { fa = (FileAppender) currAppender; } } if(fa != null) { fa.setFile(logFileName); fa.activateOptions(); } else { log.info("No File Appender found"); } *Update So what I am doing is running Quartz. Quartz has a job that can be called concurrently with different params. I would like each separate job run to have its own log file even though they are all calling the same class. Any help is greatly appreciated. Thanks
score: 0
tagged with: log4j
has answer: http://stackoverflow.com/a/22826860
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/34994466
comment on: http://stackoverflow.com/a/22925163
has text: Use the same variable. Start with `noDigitWords = s;` and then `noDigitWords = noDigitWords.replace(...)`.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/34845720
type: QuestionComment
comment on: http://stackoverflow.com/q/22843536
has text: http://cs.stanford.edu/people/eroberts/jtf/javadoc/complete/acm/util/RandomGenerator.html
score: 0
type: Comment

http://stackoverflow.com/q/22962810
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35061379
has title: How to set generic parameter to Query object of Hibernate?
score: 1
has answer: http://stackoverflow.com/a/22965689
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: I have created a generic method which will take hibernate named query, a HashMap object which contain parameter name values for that named query in the following manner: The method signature is: public static &lt;T&gt; ArrayList&lt;T&gt; getData(String hibernateQueryName, HashMap&lt;?, ?&gt; queryNameValue) throws Exception; Now suppose I have a SQL and its hibernateQueryName is empData: SELECT e.emp_nm AS EMP_NAME , e.emp_address AS EMP_ADDR FROM employee e WHERE e.emp_no &gt; :empNumber AND e.name LIKE :empName Here empNumber and empName are parameter name and they are of type Integer and String respectively. Now suppose I have one more SQL and its hibernateQueryName is studentData: SELECT s.s_nm AS EMP_NAME FROM student s WHERE s.dob &gt; :studentDOB Here studentDOB is parameter name and its of type Date. studentDOB is a key that I will get from HashMap. I want to set these parameter and values to query object like: Query query = getSession().getNamedQuery(hibernateQueryName); query.setXXX(parameterName, parameterValue); Above code is written in my getData method. There are many query.setXXX methods which are based on Type for example query.setInteger() but for calling this I need to find the type of ? which I am passing in getData method. Is it possible to use query.setXXX method with unknown type ?
has answer: http://stackoverflow.com/a/22965998
has comment: http://stackoverflow.com/comment/35065581
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/a/22957387
has comment: http://stackoverflow.com/comment/35051422
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/35052467
answers question: http://stackoverflow.com/q/22957280
score: 2
downvote count: 0
has body: The reason is most likely that the desktop and web applications are using different character encodings. That is why under some encodings the value would present one character, and in others a different one.
has comment: http://stackoverflow.com/comment/35051331

collections
tags question: http://stackoverflow.com/q/22893996
tags question: http://stackoverflow.com/q/22911030
tags question: http://stackoverflow.com/q/22836589
tags question: http://stackoverflow.com/q/22822894
tags question: http://stackoverflow.com/q/22856600
tags question: http://stackoverflow.com/q/22909768
tags question: http://stackoverflow.com/q/22912066
tags question: http://stackoverflow.com/q/22926771
tags question: http://stackoverflow.com/q/22918933
tags question: http://stackoverflow.com/q/22818319
tags question: http://stackoverflow.com/q/22965661
tags question: http://stackoverflow.com/q/22843646
tags question: http://stackoverflow.com/q/22844619
tags question: http://stackoverflow.com/q/22873669
type: Tag
tags question: http://stackoverflow.com/q/22904576
tags question: http://stackoverflow.com/q/22928314
tags question: http://stackoverflow.com/q/22876963
tags question: http://stackoverflow.com/q/22962148
tags question: http://stackoverflow.com/q/22865353
tag name: collections
tags question: http://stackoverflow.com/q/22814504
tags question: http://stackoverflow.com/q/22812385
tags question: http://stackoverflow.com/q/22858680
tags question: http://stackoverflow.com/q/22878604
tags question: http://stackoverflow.com/q/22824438
tags question: http://stackoverflow.com/q/22854086
tags question: http://stackoverflow.com/q/22939639
tags question: http://stackoverflow.com/q/22932218
tags question: http://stackoverflow.com/q/22852420
tags question: http://stackoverflow.com/q/22932451
tags question: http://stackoverflow.com/q/22839264

ms-project
type: Tag
tag name: ms-project
tags question: http://stackoverflow.com/q/22920216

http://stackoverflow.com/comment/35046100
comment on: http://stackoverflow.com/q/22952685
type: Comment
type: QuestionComment
has text: @Krishna I can not see your gmail in your profile
score: 0

http://stackoverflow.com/a/22837182
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: delete() uses the passed in whereClause to construct an SQL statement like DELETE FROM &lt;tablename&gt; WHERE &lt;whereClause&gt;. In case the passed in whereClause is null, the WHERE &lt;whereClause&gt; is omitted and all rows are deleted. Your getWhereClause() constructs an expression that can be used as whereClause, comparing a column to a specified string literal value, like foo="bar". If either one is null or empty, a null whereClause is returned so all rows are matched.
type: Answer
accepted answer of: http://stackoverflow.com/q/22837052
answers question: http://stackoverflow.com/q/22837052

http://stackoverflow.com/q/22925241
type: Question
has comment: http://stackoverflow.com/comment/34995067
has title: Java Unicode Characters
upvote count: 0
has body: I'm familiar with problems with ascii. The problem is I have no experience with same problems in unicode characters. For example, how to return the word that occurs most frequently given a string array containing words? Thanks in advance! p.s.: You can always use an array which length is "256" to represent all the characters in ASCII while you can't do that when it comes to unicode. Is HashMap a must and the best way to solve the problem? I heard that there are better ways to solve it. Below is what I can think of: String str = "aa df ds df df"; // assume they are Unicode String[] words = str.split(" "); HashMap&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;(); for (String word : words){ if (map.containsKey(word)){ int f = map.get(word); map.put(word, f+1); } else{ map.put(word, 1); } } int max = 0; String maxWord = ""; for (String word : words){ int f = map.get(word); if (f &gt; max){ max = f; maxWord = word; } } System.out.println(maxWord + " " +max);
score: -1
has comment: http://stackoverflow.com/comment/34994263
has comment: http://stackoverflow.com/comment/34994986
answer count: 1
has comment: http://stackoverflow.com/comment/34994973
tagged with: unicode
favorite count: 0
has answer: http://stackoverflow.com/a/22926145
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34995248
has comment: http://stackoverflow.com/comment/34994582
has comment: http://stackoverflow.com/comment/34994923
has comment: http://stackoverflow.com/comment/34994600
has comment: http://stackoverflow.com/comment/34995773
tagged with: java
downvote count: 1

http://stackoverflow.com/a/22960725
type: Answer
answers question: http://stackoverflow.com/q/22960524
has body: Can we say that by synchronizing a block of code we are making the contained statements atomic? You are taking a very big leap there. Atomicity means that the operation if atomic will complete in one CPU cycle or equivalent to one CPU cycle whereas Synchronizing a block means only one thread can access the critical region. It may take multiple CPU cycles for processing code in the critical region(which will make it non atomic).
score: 0

http://stackoverflow.com/a/22887996
has comment: http://stackoverflow.com/comment/34926961
type: Answer
has comment: http://stackoverflow.com/comment/34927162
has comment: http://stackoverflow.com/comment/56749206
has comment: http://stackoverflow.com/comment/34926906
upvote count: 75
downvote count: 1
has comment: http://stackoverflow.com/comment/56196567
has comment: http://stackoverflow.com/comment/34926937
has body: NOTE: Please ensure the server is trustworthy before you follow these steps. If you get any other error like this: Could not GET 'https://some_server.com/some/path/some.pom'. &gt; peer not authenticated Then you need to import a certificate : open the 'https://some_server.com/some/path/some.pom' in your favorite browser export the cert using the Steps to export cert from a web site copy the cer into JDK_HOME/jre/lib/security folder open a shell and go to JDK_HOME/jre/lib/security folder then import the cer into java using the keytool -import -alias &lt;the short name of the server&gt; -file &lt;cert_file_name_you_exported.cer&gt; -keystore cacerts -storepass changeit It will prompt you to import the certificate, type yes and press enter. Then restart your eclipse and try building the project.
score: 74
has comment: http://stackoverflow.com/comment/54283154
has comment: http://stackoverflow.com/comment/42626554
accepted answer of: http://stackoverflow.com/q/22887829
has comment: http://stackoverflow.com/comment/56746230
answers question: http://stackoverflow.com/q/22887829
has comment: http://stackoverflow.com/comment/34927270
has comment: http://stackoverflow.com/comment/57373213
has comment: http://stackoverflow.com/comment/34926951
has comment: http://stackoverflow.com/comment/62394842
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34927085
has comment: http://stackoverflow.com/comment/53257281

http://stackoverflow.com/q/22897000
has comment: http://stackoverflow.com/comment/34942764
has comment: http://stackoverflow.com/comment/34942663
answer count: 0
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34984579
favorite count: 0
has body: I have a problem when I upload my sketch to website. I write a processing program which is a 3D guiding library.This is my code. //Camera Variables float x,y,z; float tx,ty,tz; float rotX,rotY; float mX, mY; float frameCounter; float xComp, zComp; float angle; //Movement Variables int moveX; int moveZ; float vY; boolean canJump; boolean moveUP,moveDOWN,moveLEFT,moveRIGHT; //check input int m =0; //Constants int ground = 0; int totalBoxes = 100; int standHeight = 100; int dragMotionConstant = 10; int pushMotionConstant = 100; int movementSpeed = 50; //Bigger number = slower float sensitivity = 15; //Bigger number = slower int stillBox = 100; //Center of POV, mouse must be stillBox away from center to move float camBuffer = 10; int cameraDistance = 1000; //distance from camera to camera target in lookmode... 8? //Options int lookMode = 8; int spotLightMode = 4; int cameraMode = 1; int moveMode = 2; void setup(){ size(800,600,P3D); noStroke(); //dwa(#EDEDE8); //Camera Initialization //default x = -28; y = height/2; y-= standHeight; z = -4830; tx = width/2; ty = height/2; tz = 0; rotX = 0; rotY = 0; xComp = tx - x; zComp = tz - z; angle = 0; //Movement Initialization moveX = 0; moveX = 0; moveUP = false; moveDOWN = false; moveLEFT = false; moveRIGHT = false; canJump = true; vY = 0; } void draw(){ if(z&lt;-5000) z=-5000; if(z&gt;9700) z=9700; //println(x,y,z ,mouseX , mouseY ,tx ,ty,tz); //update frame background(0); lights(); if(m==1) { //rotateY(0.5); fill(#EAFF0F); textSize(50); text("menu", x-100, y, z+300); // rotateY(0.5); //the point pushMatrix(); fill(#FC1919); translate(-28,300,4000); box(10, 20000, -10); popMatrix(); //the point } if(spotLightMode == 0) lights(); else if(spotLightMode == 1) spotLight(255,255,255,x,y-standHeight,z,tx,ty,tz,PI,1); else if(spotLightMode == 2) spotLight(255,255,255,x,y-standHeight-200,z,x+100,y+100,z,frameCounter/10,1); else if(spotLightMode == 3) spotLight(255,255,255,width/2,height/2-1000,0,width/2,height/2,0,PI,1); else if(spotL…
type: Question
has comment: http://stackoverflow.com/comment/34942611
upvote count: 1
has title: When processing Java mode convert to Java script mode, my 3D object doesn't show
tagged with: processing
tagged with: java
tagged with: javascript
type: UnansweredQuestion

http://stackoverflow.com/comment/35040002
type: QuestionComment
comment on: http://stackoverflow.com/q/22950063
has text: Set the url when you create the RequestDispatcher as in the example on the link I gave: RequestDispatcher dispatcher = aRequest.getRequestDispatcher(newurl); dispatcher.forward(aRequest, aResponse);
score: 0
type: Comment

http://stackoverflow.com/comment/35015557
type: QuestionComment
has text: "I could use a few if statements like I've done int he example below" - your sample code doesn't include any `if` statements.
score: 0
comment on: http://stackoverflow.com/q/22937461
type: Comment

http://stackoverflow.com/comment/35016898
score: 0
has text: It's the matter, it's no SD card in nexus tablet
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22937935

http://stackoverflow.com/q/22828922
tagged with: jodatime
upvote count: 1
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22833128
accepted answer: http://stackoverflow.com/a/22833128
favorite count: 0
tagged with: log4j
has title: Can log4j be configured to use Joda Time's timezone database?
tagged with: timezone
tagged with: logging
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am using log4j (with JDK 1.3) and it is logging times one hour behind the actual time. This is because log4j is using the JDK 1.3 timezone information for daylight saving, which is out of date. Unfortunately upgrading the JDK to get the latest timezone info is not an option for me. However, after running a test I can see that JodaTime 1.6 does have the correct timezone information. Is it possible for log4j to be configured to calculate its dates using JodaTime rather than the JDK and if so how?

http://stackoverflow.com/comment/34856705
score: 0
type: AnswerComment
type: Comment
has text: `BorderLayout.CENTER` is the default position if not specified (just saying) and (personally) I have an issue with a constructor creating a frame in this manner it reduces the re-usability of the class ... and you're still extending from `JFrame` ;)
comment on: http://stackoverflow.com/a/22849339

http://stackoverflow.com/comment/34927801
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22888759
score: 5
has text: How did using `float` fail?

http://stackoverflow.com/q/22900433
has answer: http://stackoverflow.com/a/22900573
accepted answer: http://stackoverflow.com/a/22900573
has comment: http://stackoverflow.com/comment/34949096
score: 0
answer count: 1
tagged with: geometry
has comment: http://stackoverflow.com/comment/34949133
tagged with: drawing
type: AnsweredQuestion
tagged with: java
type: Question
has body: So I have this program where I had to draw a spade, club, heart, and a diamond in uniform size. I accomplished the shapes but cannot figure out how to fill the triangles used for the spade and club. Would really appreciate any help! Only Problem: Fill triangles. public class CardSymbols { //beginning program public static void main(String[] args) { //beginning method StdDraw.setXscale(-1.5, +1.5); StdDraw.setYscale(-1.5, +1.5); //Drawing a Heart StdDraw.setPenColor(StdDraw.RED);//color for Heart &amp; Diamond double[] xh = {.6,.7,.8,.7}; double[] yh = {-.725,-.825,-.725,-.625};; StdDraw.filledPolygon(xh, yh); //diamond StdDraw.filledCircle(+.65, -.675, .1 / Math.sqrt(2)); //half circles StdDraw.filledCircle(.75, -.675, .1 / Math.sqrt(2)); //half circles //Drawing a Diamond double[] xd = {.6,.7,.8,.7}; double[] yd = {.775,.9,.775,.65}; StdDraw.filledPolygon(xd,yd); //Drawing a Spade StdDraw.setPenColor(StdDraw.BLACK); double[] xs = {-.6,-.7,-.8,-.7}; double[] ys = {-.7,-.8,-.7,-.6}; StdDraw.filledPolygon(xs,ys); //diamond StdDraw.filledCircle(-0.75, -0.75,.1 / 1.4142); //half circle StdDraw.filledCircle(-0.65, -0.75,.1 / 1.4142); //half circle StdDraw.line(-0.7,-0.8, -.75,-.85); StdDraw.line(-0.7,-0.8,-.65,-.85); //forming a triangle StdDraw.line(-0.75,-0.85,-.65,-.85); //Drawing a Club StdDraw.filledCircle(-0.75, 0.75,.1 / 1.4142); //half circle StdDraw.filledCircle(-0.65, 0.75,.1 / 1.4142); //half circle StdDraw.filledCircle(-0.7, 0.835,.1 / 1.4142); //half circle StdDraw.line(-0.7,0.7, -.75,.65); StdDraw.line(-0.75,0.65,-.65,.65); //forming a triangle StdDraw.line(-0.65,0.65,-.7,.7); } //end method } //end program
has title: Filling in Triangles in Dr.Java using standard draw

ubuntu
tags question: http://stackoverflow.com/q/22952058
tags question: http://stackoverflow.com/q/22954916
tags question: http://stackoverflow.com/q/22945044
tags question: http://stackoverflow.com/q/22905328
tags question: http://stackoverflow.com/q/22919197
tags question: http://stackoverflow.com/q/22862040
tag name: ubuntu
type: Tag
tags question: http://stackoverflow.com/q/22918851

http://stackoverflow.com/comment/34874590
type: Comment
has text: Thank you for your reply, i will try your suggestion and the one above and let you know how i get on. regards
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22849179

http://stackoverflow.com/q/22895289
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/34939676
answer count: 1
tagged with: jackson
has answer: http://stackoverflow.com/a/22895451
has comment: http://stackoverflow.com/comment/34939494
score: 0
has body: I am trying to send a POST request from my Android application and I get a MediaType conflict error or at least that's what I think. I want to send some data with the request and it should work but I think I am missing something. I am using Jackson and RestEasy as they come with the Wildfly server. Here is my error log from my server: 15:18:20,790 WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-6) Failed executing POST /posts/post: org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: domains.Post of media type: application/octet-stream at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:67) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:427) [resteasy-jaxrs-3.0.6.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:376) [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.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final] at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final] at io.undertow.servlet.ha…
tagged with: android
has comment: http://stackoverflow.com/comment/34939395
has title: Post request from Android application failing + RestEasy + Jackson
tagged with: resteasy
accepted answer: http://stackoverflow.com/a/22895451
type: AnsweredQuestion

http://stackoverflow.com/comment/34890630
type: QuestionComment
has text: Setting strategy=GenerationType.AUTO seemed to work but hibernate just ignores the generator field and creates it's own generator.
score: 0
comment on: http://stackoverflow.com/q/22866527
type: Comment

http://stackoverflow.com/comment/35014436
score: 2
has text: Because Java is not C.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22936938

postgresql
tags question: http://stackoverflow.com/q/22948915
tags question: http://stackoverflow.com/q/22868648
tags question: http://stackoverflow.com/q/22838280
tags question: http://stackoverflow.com/q/22945673
tags question: http://stackoverflow.com/q/22892277
tags question: http://stackoverflow.com/q/22937109
tag name: postgresql
tags question: http://stackoverflow.com/q/22859976
type: Tag
tags question: http://stackoverflow.com/q/22903803
tags question: http://stackoverflow.com/q/22836220
tags question: http://stackoverflow.com/q/22850236
tags question: http://stackoverflow.com/q/22925572
tags question: http://stackoverflow.com/q/22816817

http://stackoverflow.com/q/22856229
type: Question
upvote count: 4
answer count: 8
has answer: http://stackoverflow.com/a/22856399
has answer: http://stackoverflow.com/a/22856265
tagged with: inheritance
score: 4
has answer: http://stackoverflow.com/a/22856506
has answer: http://stackoverflow.com/a/22856267
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22856260
has body: I am using a Java library that has a class hierarchy: e.g. classes C1 and C2 that both extend class B Is there a way for me to add functionality (attributes, methods) to class B such that it will be available to the child classes C1 &amp; C2 without modifying the 3 files? If not, what is the right way to do this short of rewriting all 3 classes?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22856300
has comment: http://stackoverflow.com/comment/34868805
has title: Java: How do I add to a base class without modifying class file
has answer: http://stackoverflow.com/a/22856437
has answer: http://stackoverflow.com/a/22863833
tagged with: java

http://stackoverflow.com/q/22881942
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22882206
tagged with: java
has answer: http://stackoverflow.com/a/22882113
type: Question
linked to: http://stackoverflow.com/q/7182485
score: 0
answer count: 2
tagged with: contacts
has body: I currently have a basic program that runs through all the SMS and creates a Thread for each one only storing the name, number, and last text. It then creates a listview out of all these threads (like the stock sms app)... But it runs really slow; how could I make this more efficient so it doesn't take minutes each time it boots? Uri message = Uri.parse("content://sms/"); ContentResolver cr = this.getContentResolver(); Cursor c = cr.query(message, null, null, null, null); this.startManagingCursor(c); int totalSMS = c.getCount(); if (c.moveToFirst()) { for (int i = 0; i &lt; totalSMS; i++) { String[] projection = new String[] {ContactsContract.PhoneLookup.DISPLAY_NAME,ContactsContract.PhoneLookup._ID}; Uri contactUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(c.getString(c.getColumnIndexOrThrow("address")))); Cursor cursor2 = this.getContentResolver().query(contactUri, projection, null, null, null); String name = getContactName(this, c.getString(c.getColumnIndexOrThrow("address"))); String number = c.getString(c.getColumnIndexOrThrow("address")); String msg =c.getString(c.getColumnIndexOrThrow("body")); if (cursor2.moveToFirst()) { // Get values from contacts database: //contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.PhoneLookup._ID)); name = cursor2.getString(cursor2.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME)); } //entries.add(new Entry(name, msg)); int newNumber = 1; for(int d = 0; d &lt; threads.size(); d++) { Thread t = threads.get(d); if(t.number.equals(number)) newNumber = 0; } if(newNumber == 1) threads.add(new Thread(name, number, msg)); c.moveToNext(); } }
has title: SMS Listview Threads
linked to: http://stackoverflow.com/q/4667064
tagged with: sms

http://stackoverflow.com/a/22907714
answers question: http://stackoverflow.com/q/22907006
type: Answer
accepted answer of: http://stackoverflow.com/q/22907006
upvote count: 1
score: 1
has body: ptab: as it says, there is currently no support for the ptab element. Its not commonly used. You can either remove it from your docx, or we could look at adding support for it to docx4j. altChunk: these need to be preprocessed into "real" docx content for docx4j's PDF output. If the altChunk is of type XHTML, docx4j can do that. If it is a docx altChunk, the Enterprise Edition is required. There are other types of altChunks, which you should avoid if you want to convert to PDF...
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/71278665
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22911279
score: 0
has text: Thanks! Hope the loader gets improved in the releases to come.

http://stackoverflow.com/comment/34822489
has text: The icon overrides the "radio" button thingy in place of the usual circle. I tend to use a `JLabel` to hold the icon and text, depending on what you want to achieve
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22830489

http://stackoverflow.com/comment/35030805
comment on: http://stackoverflow.com/a/22945539
type: AnswerComment
has text: You haven't specified how your application is pulling the data, a language would be a good start. Is your application saving them as an individual file periodically, or is it a server sided script which makes the call whenever a user requests for it?
score: 0
type: Comment

http://stackoverflow.com/q/22957572
tagged with: java
has comment: http://stackoverflow.com/comment/35052088
tagged with: http://stackoverflow.com/tag/json
answer count: 2
downvote count: 0
has title: How to decode json object having attribute with multiple values in java?
has answer: http://stackoverflow.com/a/22957714
favorite count: 0
has body: this is my json object in javascript that i want to parse in java var param{ "attrib1":"abc", "attrib2":["x","y","z"] } I'm using jackson library. I am not able to retrieve the members of attrib2. How to do it? help
has answer: http://stackoverflow.com/a/22957883
has comment: http://stackoverflow.com/comment/35051520
has comment: http://stackoverflow.com/comment/35051496
has comment: http://stackoverflow.com/comment/35054163
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1

http://stackoverflow.com/a/22910409
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34969029
has comment: http://stackoverflow.com/comment/34970547
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34971713
downvote count: 0
has body: You should use Query endpoint with page filters. The following query gets customers 1 - 10: String query = select($(customer)).skip(0).take(10).generate(); Output - SELECT * FROM Customer STARTPOSITION 1 MAXRESULTS 10 The following query gets customers 21 - 25: String query = select($(customer)).skip(20).take(10).generate(); Ref - https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0201_ipp_java_devkit_3.0/0011_query_filters#Pagination finally QueryResult queryResult = service.executeQuery(query); Thanks
has comment: http://stackoverflow.com/comment/34972133
has comment: http://stackoverflow.com/comment/34969377
has comment: http://stackoverflow.com/comment/34966671
accepted answer of: http://stackoverflow.com/q/22909923
has comment: http://stackoverflow.com/comment/34967147
answers question: http://stackoverflow.com/q/22909923
upvote count: 2
has comment: http://stackoverflow.com/comment/34970114

http://stackoverflow.com/comment/34952163
score: 0
type: Comment
has text: Is there a way to access the strings in the while loop when an item is selected?
comment on: http://stackoverflow.com/a/22869814
type: AnswerComment

http://stackoverflow.com/a/22968016
answers question: http://stackoverflow.com/q/22967830
score: 0
type: Answer
has body: Short answer: One package per module/feature, possibly with sub-packages. Put closely related things together in the same package. Avoid circular dependencies between packages. Long answer: I agree with most of this article

http://stackoverflow.com/q/22955394
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/71118778
favorite count: 0
has answer: http://stackoverflow.com/a/22955787
has comment: http://stackoverflow.com/comment/35048799
type: UnansweredQuestion
tagged with: spring
tagged with: properties
tagged with: internationalization
has body: I have an English resource bundle messages.properties and a German resource bundle messages_de.properties. When I don't find a message in German bundle, but it's present in English bundle, REsourceBundle#getString() method returns the message from English (it's set as German bundle's parent). I want to temporarily disable this behavior when I am testing in which scenarios German messages are missing, so basically I want to throw an exception when a German message is not found, but English message is present (in my specific test environment). What's the easiest way to do this? We are using Spring and looking up messages through application context. In the image below, it shows how ResourceBundle implementation looks up in the parent map if it doesn't find it in itself (and there seems no simple way to change this behavior).
has comment: http://stackoverflow.com/comment/35058953
linked to: http://stackoverflow.com/q/18152710
tagged with: java
has comment: http://stackoverflow.com/comment/35104065
has title: Resource bundle defaults to parent message
upvote count: 1
type: Question

http://stackoverflow.com/a/22872600
answers question: http://stackoverflow.com/q/22872465
score: 0
has body: You declared an array of size 13 so the index goes from 0 to 12. I think you tried to roll 14 dice, you should put a test before : line 20:roll2 = rollDie(roll2,size); For example : if (size &gt; roll2.size()) { System.out.pritln("error : size too big"); return;}
type: Answer

http://stackoverflow.com/comment/34844596
comment on: http://stackoverflow.com/q/22842976
type: QuestionComment
has text: What line is the error coming from?
type: Comment
score: 1

http://stackoverflow.com/q/22936101
score: -1
has answer: http://stackoverflow.com/a/22936167
type: UnansweredQuestion
has title: How to use command prompt in eclipse to create Maven Project?
tagged with: vaadin7
downvote count: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22986696
type: Question
answer count: 2
upvote count: 0
has body: I am new to the Maven, Vaadin, Eclipse Kelper. I am working on project which include Maven, Vaadin. I don't know how to create maven project using command prompt. I tried using Vaadin.com website, but not found the proper steps.
favorite count: 0
tagged with: maven-2

http://stackoverflow.com/comment/34884182
comment on: http://stackoverflow.com/q/22860792
score: 0
type: Comment
type: QuestionComment
has text: Use the `cut` command available in NIX systems or use it in cygwin on windows. Maybe a 2 minute job.

http://stackoverflow.com/comment/34891326
has text: I was trying to ask if Roo would generate DB, mapping and everything else for me from my Java code modifications
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22854362

http://stackoverflow.com/a/22813670
score: 0
type: Answer
has body: import java.text.SimpleDateFormat; import java.util.Date; class sample { public static void main(String[] args) throws Exception { String source= new String("03/20/2014"); SimpleDateFormat sdfinput = new SimpleDateFormat("MM/dd/yyyy"); SimpleDateFormat sdfoutput = new SimpleDateFormat("yyyy-MM-dd"); Date inputdate=sdfinput.parse(source); String outputDate=sdfoutput.format(inputdate); System.out.println(outputDate); } }
answers question: http://stackoverflow.com/q/22813099

http://stackoverflow.com/comment/53831080
type: AnswerComment
has text: This was perfect for me, since what I needed was to pass LocalDate into SQL. However, if your Date formatter is going to do something about time zone shift before formatting the date, you might get one day too early depending on the local time zone, in which case you'll want one of the above options instead.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28564046

http://stackoverflow.com/comment/34882816
comment on: http://stackoverflow.com/q/22863341
type: QuestionComment
has text: No. If you were in charge of the server you could make a socket connection there, have the server output modified values when they come up, and just keep the connection open. But if you're not writing the server **then you're stuck with XML and polling**.
score: 0
type: Comment

http://stackoverflow.com/a/22952520
has body: To pad out a string, there's a good answer on here already How can I pad a String in Java?. Look at the 2nd answer. int minLen = 20; String s = myformat(value, length); int diff = minLen - s.length; System.out.printf("%1$" + diff + "s", s); Where String s is your formatted string using your above "[" + average + "]" stuff. The idea is that you have a minimum length string to work with so that your positioning is always the same.
answers question: http://stackoverflow.com/q/22952446
has comment: http://stackoverflow.com/comment/35046720
score: 0
has comment: http://stackoverflow.com/comment/35046858
type: Answer

http://stackoverflow.com/a/22809893
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22809624
has comment: http://stackoverflow.com/comment/34824934
type: Answer
has body: I guess working in a Java EE environment the easiest would be using web services. But if this is not the case and/or you need pushing, I would recommend using some library. For example xSocket that uses non-blocking IO sockets and can send and receive any string messages asynchronously. From there on you can use for example JAXB binders to send XML messages or any other format.
upvote count: 1
has comment: http://stackoverflow.com/comment/34974725
has comment: http://stackoverflow.com/comment/34785761
answers question: http://stackoverflow.com/q/22809624
type: AcceptedAnswer

http://stackoverflow.com/comment/35070137
comment on: http://stackoverflow.com/a/22967797
type: Comment
has text: You're right, I was mentally calculating the Base64 expansion of the hex string.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35043749
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22952614
has text: @SotiriosDelimanolis see my question update.

http://stackoverflow.com/comment/34960839
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22906688
has text: What do you mean by "supports"? On the server-side you can write any kind of REST service that can set (almost) any value as the response status code. On the client-side (almost) any http library will read the response and return a status code and response body, whatever they are. There is nothing special in the `102 Processing` value itself.
score: 0

http://stackoverflow.com/comment/35013632
comment on: http://stackoverflow.com/q/22936487
type: Comment
type: QuestionComment
has text: What do you mean by "it isn't working"? Do you get an exception? If so what exception exactly?
score: 0

http://stackoverflow.com/q/22920475
has comment: http://stackoverflow.com/comment/34986969
tagged with: http://stackoverflow.com/tag/json
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34986313
has answer: http://stackoverflow.com/a/22921432
has body: I have a Spring 3 MVC Controller who has a @ModelAttribute parameter of an object This object contains numerous properties, mostly strings/numbers. It has one java.sql.Timestamp property. I call this method via browser, passing the properties as separate query string key/value pairs. When I do not pass a key/value pair for the Timestamp everything works fine, it loads the object with all my properties. But as soon as I try to send a value for the Timestamp proeprty, I get an immediate Error 400: Bad request. I know i have to send the data string in a specific format, but I just use a JsonDeserializer so that I can parse the string using the format that I want. But when I set a breakpoint inside my JsonDeserializer, it never gets hit. Spring seems to just ignore it. What did I miss? Some code: Controller: @RequestMapping(headers = "Accept=application/json;charset=utf-8", value = "/doSomething", method = RequestMethod.GET) @ResponseBody public ReturnObject doSomething(@ModelAttribute MyObject obj, HttpServletRequest request) throws Exception { //blah blah } MyObject: public class MyObject { private Integer someNumber; private String someString; @JsonDeserialize(using=ShortDateDeserializer.class) private Timestamp someTimestamp; // getter/setters like usual.... } ShortDateDeserializer: public class ShortDateDeserializer extends JsonDeserializer&lt;Timestamp&gt; { Logger logger = Logger.getLogger(ShortDateDeserializer.class); @Override public Timestamp deserialize(JsonParser parser, DeserializationContext ctx) throws IOException, JsonProcessingException { try { String rawDate = parser.getText(); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); return new Timestamp(sdf.parse(rawDate).getTime()); } catch (Exception e) { logger.error("Failed to parse date: "+parser.getText()); throw new IOException("Failed to parse date: "+parser.getText()); } } } When I call my service only setting the number/string like so: localhost/doSomething?someNumber=1&amp;someString=xyz …
has comment: http://stackoverflow.com/comment/34985242
tagged with: spring-mvc
has title: Error 400: Bad Request involving Timestamp within JSON object
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34987037
has comment: http://stackoverflow.com/comment/34985658
accepted answer: http://stackoverflow.com/a/22921432
type: Question

http://stackoverflow.com/comment/34826094
has text: are your image is display correctly
comment on: http://stackoverflow.com/q/22832300
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34814401
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22825852
has text: I just saw you consider yourself a regex fan. can I ask you something? is there a way to talk private for a second?
score: 0

http://stackoverflow.com/a/22828765
answers question: http://stackoverflow.com/q/22825904
has comment: http://stackoverflow.com/comment/34833482
score: 0
accepted answer of: http://stackoverflow.com/q/22825904
type: AcceptedAnswer
has body: Your second imageview should use layout_toLeftOf="@+id/list_image" to prevent the overlap and about the image not fitting you should probably play around with the scaleType property
type: Answer

http://stackoverflow.com/a/22868027
has comment: http://stackoverflow.com/comment/34890504
accepted answer of: http://stackoverflow.com/q/22866985
type: Answer
has body: It appears the way screen coordinates are calculated by the Robot have changed. The following bug has been raised against the javadoc of Java 8 which may explain your problem. http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8033128 It looks like the change was made deliberately and is not a bug. To capture your second screen you may have to offset the location by the size of the first screen. Robot rbt1 = new Robot(screens[1]); BufferedImage image1 = rbt1.createScreenCapture(new Rectangle(1024,0,1024,1024));
has comment: http://stackoverflow.com/comment/48623113
has comment: http://stackoverflow.com/comment/48615950
score: 1
has comment: http://stackoverflow.com/comment/34890200
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22866985

http://stackoverflow.com/comment/34784704
score: 0
comment on: http://stackoverflow.com/q/22809340
type: QuestionComment
type: Comment
has text: @ wapnil7 Do i have to add an item listener to the jcombobox?

http://stackoverflow.com/a/22838249
score: 0
has body: From this answer by Joachim Sauer (SO User) dtd February 14, 2011: Strictly speaking such an implementation would be wrong. The reason for this is that even if an object is not of type E, it could still return true on an equals() call. The above statement appears to be referencing this answer. Your int will be boxed to an Object. Similar to what is described here. (int) === boxing ===> (Integer) ==== reference widening ===> (Object) But Netbeans is smart and detects this, notices that your Integer is incompatible with a String. Normally this would throw a ClassCastException. However, the javadoc clearly states that throwing the ClassCastException on Collections.contains(Object) is optional. So in this case, there would be no benefit to overload the contains method to allow an Element type because int, float, double, etc can be autoboxed to Object successfully. Therefore, a contains with just Object is just fine. For reasons unknown, List, HashSet, Set, and LinkedHashSet do not throw a ClassCastException if "f the type of the specified element is incompatible with this [insert type here] (optional)". Note the optional part. As you have shown, Netbeans will give you a suspicious warning when you try to pass an incompatible type. The trap here is if you try to use logic to rely on the return value of .contains(...). A developer who doesn't pay attention to his warnings could fall into the trap of assuming that contains will always work, but then it doesn't. As the developer at this blog recommends, here are four steps to avoid this pitfall in the future: Careful coding and code reviews might lead to developers or reviewers seeing that an object of an irrelevant class is being passed to the contains method. I'm typically uncomfortable leaving it with just this form of protection. Use of a modern version of NetBeans or of similar tools that flag the "suspicious" behavior can be very helpful. Unit tests combined with code coverage tests can be helpful in identifying seemi…
type: Answer
accepted answer of: http://stackoverflow.com/q/22836589
answers question: http://stackoverflow.com/q/22836589
upvote count: 1
downvote count: 1
type: AcceptedAnswer

spring
tags question: http://stackoverflow.com/q/22939629
tags question: http://stackoverflow.com/q/22839116
tags question: http://stackoverflow.com/q/22873048
tags question: http://stackoverflow.com/q/22840681
tags question: http://stackoverflow.com/q/22906178
tags question: http://stackoverflow.com/q/22848738
tags question: http://stackoverflow.com/q/22902952
tags question: http://stackoverflow.com/q/22952047
tags question: http://stackoverflow.com/q/22873376
tags question: http://stackoverflow.com/q/22923813
tags question: http://stackoverflow.com/q/22861546
tags question: http://stackoverflow.com/q/22856600
tags question: http://stackoverflow.com/q/22932165
tags question: http://stackoverflow.com/q/22838280
tags question: http://stackoverflow.com/q/22832641
tags question: http://stackoverflow.com/q/22951785
tags question: http://stackoverflow.com/q/22953397
tags question: http://stackoverflow.com/q/22826887
tags question: http://stackoverflow.com/q/22932015
tags question: http://stackoverflow.com/q/22949652
tags question: http://stackoverflow.com/q/22895368
tags question: http://stackoverflow.com/q/22862006
tags question: http://stackoverflow.com/q/22917228
tags question: http://stackoverflow.com/q/22906962
tags question: http://stackoverflow.com/q/22839664
tags question: http://stackoverflow.com/q/22941655
tags question: http://stackoverflow.com/q/22838103
tags question: http://stackoverflow.com/q/22923967
tags question: http://stackoverflow.com/q/22884096
tags question: http://stackoverflow.com/q/22910717
tags question: http://stackoverflow.com/q/22914888
tags question: http://stackoverflow.com/q/22830430
tags question: http://stackoverflow.com/q/22813685
tags question: http://stackoverflow.com/q/22839322
tags question: http://stackoverflow.com/q/22958464
tags question: http://stackoverflow.com/q/22895553
tags question: http://stackoverflow.com/q/22907690
tags question: http://stackoverflow.com/q/22876831
tags question: http://stackoverflow.com/q/22860009
tags question: http://stackoverflow.com/q/22946521
tags question: http://stackoverflow.com/q/22821402
tags question: http://stackoverflow.com/q/22924607
type: Tag
tags question: http://stackoverflow.com/q/22880749
tags question: http://stackoverflow.com/q/22822891
tags question: http://stackoverflow.com/q/22811227
tags question: http://stackoverflow.com/q/22910634
tags question: http://stackoverflow.com/q/22901043
tags question: http://stackoverflow.com/q/22956085
tags question: http://stackoverflow.com/q/22881448
tags question: http://stackoverflow.com/q/22950884
tags question: http://stackoverflow.com/q/22875803
tags question: http://stackoverflow.com/q/22955394
tags question: http://stackoverflow.com/q/22918092
tags question: http://stackoverflow.com/q/22876113
tags question: http://stackoverflow.com/q/22868268
tags question: http://stackoverflow.com/q/22919443
tags question: http://stackoverflow.com/q/22966928
tags question: http://stackoverflow.com/q/22860616
tags question: http://stackoverflow.com/q/22846044
tags question: http://stackoverflow.com/q/22922834
tags question: http://stackoverflow.com/q/22872983
tags question: http://stackoverflow.com/q/22836794
tags question: http://stackoverflow.com/q/22940304
tags question: http://stackoverflow.com/q/22853168
tags question: http://stackoverflow.com/q/22835715
tags question: http://stackoverflow.com/q/22964498
tags question: http://stackoverflow.com/q/22907671
tags question: http://stackoverflow.com/q/22914320
tags question: http://stackoverflow.com/q/22867269
tags question: http://stackoverflow.com/q/22820861
tags question: http://stackoverflow.com/q/22844409
tags question: http://stackoverflow.com/q/22936057
tags question: http://stackoverflow.com/q/22829524
tags question: http://stackoverflow.com/q/22845543
tags question: http://stackoverflow.com/q/22965178
tags question: http://stackoverflow.com/q/22955225
tags question: http://stackoverflow.com/q/22887698
tags question: http://stackoverflow.com/q/22899057
tags question: http://stackoverflow.com/q/22943674

http://stackoverflow.com/q/22968382
has comment: http://stackoverflow.com/comment/35071443
tagged with: java
has comment: http://stackoverflow.com/comment/35071479
has comment: http://stackoverflow.com/comment/35070918
has comment: http://stackoverflow.com/comment/35071018
has comment: http://stackoverflow.com/comment/35071416
has comment: http://stackoverflow.com/comment/35071219
score: 0
has body: I have a string of 0 and 1. I want to convert this string into another string by taking the 8 characters at a time and converting it to an Integer in binary and then casting this Integer to a character. Code : String s2=""; String s="10000111"; char nextChar; for(int i = 0; i &lt; s.length(); i += 8) { nextChar = (char)Integer.parseInt(s.substring(i, i+8), 2); System.out.println(nextChar); s2 += nextChar; } The code gives the right answer if I run it as a simple java file, but when I run it in a web application, it gives strange results. Why is this, and how can I get the web application to produce the same result? In desktop application : http://postimg.org/image/ww88p3ot5/ In web application : (in browser) 135, 31, 120,x 27, 192,À 242,ò 146, 128, 255,ÿ 14, 11, 107,k 159, (on output screen) http://postimg.org/image/ydn9h9nsf/
has comment: http://stackoverflow.com/comment/35071021
has comment: http://stackoverflow.com/comment/35071712
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35071683
has comment: http://stackoverflow.com/comment/35071245
has title: Converting String of 0 and 1 to another string
has comment: http://stackoverflow.com/comment/35071043
answer count: 0
has comment: http://stackoverflow.com/comment/35071406
has comment: http://stackoverflow.com/comment/35071417
type: Question
linked to: http://stackoverflow.com/q/14934953

http://stackoverflow.com/q/22909973
tagged with: treeview
has title: Duplicated Nodes in TreeView [JavaFX]
tagged with: java
tagged with: javafx
tagged with: duplicates
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34965557
has comment: http://stackoverflow.com/comment/34965708
has comment: http://stackoverflow.com/comment/34975072
has comment: http://stackoverflow.com/comment/34965790
has comment: http://stackoverflow.com/comment/34974486
has comment: http://stackoverflow.com/comment/34974125
has body: As you can see in the screenshot I've discovered a bug in the TreeView of JavaFX, i think. The TreeItems you see appear twice in the view but they don't exist twice in the "Data-Model", i've checked this. Has anyone any idea where to look for the bug. Here's some code from TreeItems i want to visualize in the Tree-View. Hope it helps. protected void addACompositum(Compositum newCompositum){ newCompositum.setParent(this); childs.put(newCompositum.toString(), newCompositum); super.getChildren().add(newCompositum); super.setExpanded(false); This is the implemented part of the Class below in which i connect the Children to it's parent. abstract class AbstrCompositum extends TreeItem{ protected Compositum parent = null; AbstrCompositum(String tag){ super(tag.replace("\n","")); } And here i connect the data-model to my tree FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Import Resource File"); File file = fileChooser.showOpenDialog(mStage); if(file != null){ Factory.getInstance().readFile(file.getPath()); locationTreeView.setRoot(Factory.getInstance().getDataModel()); } And here you can see the double appearing Objects in the tree-view. I've fixed a minor bug but the tree view still shows a mirrowed version of the Data Model, so the data model is two times available in the view and if i click on one both open. Anyone a hint where to find the bug ?
has comment: http://stackoverflow.com/comment/34974621
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22876047
accepted answer of: http://stackoverflow.com/q/22875803
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34905723
type: Answer
upvote count: 1
score: 1
has body: The root of your issue is that the bean you've annotated with the @Transactional annotation is not being picked up by the context that contains the tx:annotation-driven post processor. You have a couple options. Move the @Transactional to a bean that is loaded by the context that contains the tx:annotation-driven post processor or move the tx:annotation-driven post processor into the same context that the @Transactional bean is being loaded. The answer here is a similar situation.
has comment: http://stackoverflow.com/comment/34905393
has comment: http://stackoverflow.com/comment/34905365
answers question: http://stackoverflow.com/q/22875803
downvote count: 0

http://stackoverflow.com/comment/34928128
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22888961
score: 0
has text: What? I don't understand... `int i = Integer.MAX_VALUE;`? Or just look at the source: `@Native public static final int MAX_VALUE = 0x7fffffff;`

http://stackoverflow.com/a/22848118
has body: You could use the Omnifaces FullAjaxExceptionHandler to display whatever you want for the exception. See the following link to documentation: http://showcase.omnifaces.org/exceptionhandlers/FullAjaxExceptionHandler
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34877685
downvote count: 0
answers question: http://stackoverflow.com/q/22847853

http://stackoverflow.com/comment/34877595
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22861131
has text: I see 2 x `BorderLayout` instances, one as an 'outer' layout for other components and layouts, the other in the `PAGE_START` (top) for the label and `X` button. The text area, preferably wrapped in a `JScrollPane`, would go in the `CENTER` of the outer `BorderLayout`. The `B/E/M` buttons would go in a single row `GridLayout` in the `PAGE_END` of the outer layout. Add an `EmptyBorder` to the outer layout panel, throw in some padding in the layouts themselves, and it is done.
score: 0

http://stackoverflow.com/q/22938047
has comment: http://stackoverflow.com/comment/35016587
has comment: http://stackoverflow.com/comment/35018001
has body: Just wrote a program that displays dynamic animation. BTW, it runs but the problem is that backround keeps on flickering black and white at a rapid speed. i have googled it but didnt get an appropriate answer. Here is the code: For main method - import java.awt.*; import javax.swing.*; import javax.swing.ImageIcon; import javax.swing.JFrame; public class nam2 { public static void main(String[] args){ nam2 b= new nam2(); b.run(); } private Sprite sprite; //class to control characteristics of image private Animation a; //class to control animation private ScreenManager s; //class to control monitor screen private Image bg; //an image private static final DisplayMode modes1[] = { // List of desired DisplayModes new DisplayMode(800,600,32,0), new DisplayMode(800,600,25,0), new DisplayMode(800,600,16,0), new DisplayMode(640,480,32,0), new DisplayMode(640,480,24,0), new DisplayMode(1920,1080,16,0), }; //load images and add scenes public void loadImages(){ bg = new ImageIcon("G:\\bg2.jpg").getImage(); Image face1 = new ImageIcon("G:\\naman1.jpg").getImage(); Image face2 = new ImageIcon("G:\\3.jpg").getImage(); a = new Animation(); a.addScene(face1,500); a.addScene(face2,500); sprite = new Sprite(a); sprite.setVelocityX(0.3f); sprite.setVelocityY(0.3f); } //run method call from main method public void run(){ s = new ScreenManager(); try{ DisplayMode dm = s.findFirstCompDisplayMode(modes1); s.setFullScreen(dm); loadImages(); movieLoop(); }finally{s.restoreScren();} } public void movieLoop(){ long startingTime = System.currentTimeMillis(); long cumTime = startingTime; while(cumTime - startingTime &lt;10000){ long timePassed = System.currentTimeMillis() - cumTime ; cumTime += timePassed; update(timePassed); //draw and update screen Graphics2D g = s.getGraphics(); draw(g); g.dispose(); s.update(); try{ Thread.sleep(20); }catch(Exception e){} } } //draw method public void draw(Graphics g){ g.drawImage(bg, 0, 0, null); g.drawImage(sprite.getImage(), Math.round(sprite.getX()),Math…
has comment: http://stackoverflow.com/comment/35017150
has comment: http://stackoverflow.com/comment/35016774
type: UnansweredQuestion
tagged with: swing
answer count: 0
has comment: http://stackoverflow.com/comment/35016733
tagged with: java
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/35016650
has title: Screen flickers black & white repeatedly
score: 0
tagged with: thread-sleep
has comment: http://stackoverflow.com/comment/35018557
has comment: http://stackoverflow.com/comment/35018118

http://stackoverflow.com/comment/34819901
type: Comment
comment on: http://stackoverflow.com/a/22828845
score: 0
type: AnswerComment
has text: Am Looking for Browser plugins. or any other possible to show client system Configuration without any tools. can request the user to add browser plugins.

http://stackoverflow.com/comment/34994982
has text: Im not 100 percent sure what you mean by that...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22925397

http://stackoverflow.com/q/22939248
downvote count: 0
tagged with: tomcat
favorite count: 0
has title: Jersey Restful exception
tagged with: rest
type: Question
has comment: http://stackoverflow.com/comment/35057258
has answer: http://stackoverflow.com/a/42339691
has comment: http://stackoverflow.com/comment/35108077
has comment: http://stackoverflow.com/comment/55381339
score: 4
has comment: http://stackoverflow.com/comment/35019267
has comment: http://stackoverflow.com/comment/35061063
answer count: 1
has comment: http://stackoverflow.com/comment/35019289
tagged with: java
type: UnansweredQuestion
has body: I'm facing Jersey 2.7. This is my service: package edu.srv.rest; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Application; @Path("/algebra") public class Algebra extends Application { @GET @POST @Path("/sum") public int sum(@QueryParam("a") int a, @QueryParam("b") int b) { return a + b; } } this is my web.xml: <?xml version="1.0" encoding="UTF-8"?> RS1 org.glassfish.jersey.servlet.ServletContainer javax.ws.rs.Application edu.srv.rest.Algebra 1 RS1 /algebra/* and this is my project structure: when I try to deploy (tomcat 6, tomcat 7, tomcat 8) this service as war I got this exception: java.lang.NoClassDefFoundError: Could not initialize class org.glassfish.jersey.model.ContractProvider$Builder what am I missing?
upvote count: 4
has comment: http://stackoverflow.com/comment/35018973

mapreduce
tags question: http://stackoverflow.com/q/22810981
type: Tag
tags question: http://stackoverflow.com/q/22915311
tags question: http://stackoverflow.com/q/22942597
tag name: mapreduce
tags question: http://stackoverflow.com/q/22845376
tags question: http://stackoverflow.com/q/22955199
tags question: http://stackoverflow.com/q/22902210
tags question: http://stackoverflow.com/q/22936176
tags question: http://stackoverflow.com/q/22917190
tags question: http://stackoverflow.com/q/22873975
tags question: http://stackoverflow.com/q/22845949
tags question: http://stackoverflow.com/q/22884474
tags question: http://stackoverflow.com/q/22926077
tags question: http://stackoverflow.com/q/22830059
tags question: http://stackoverflow.com/q/22853574
tags question: http://stackoverflow.com/q/22825888
tags question: http://stackoverflow.com/q/22890303
tags question: http://stackoverflow.com/q/22836865
tags question: http://stackoverflow.com/q/22815277

http://stackoverflow.com/comment/34810147
score: 0
comment on: http://stackoverflow.com/a/22823252
has text: Ah ok it works great now that I set it to Array[i-1] in the loop. Thanks!
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34881537
score: 0
has text: This answer is not really applicable to the OP, who is [using m2e](http://stackoverflow.com/questions/22860812/eclipse-detects-wrong-maven-dependency?noredirect=1#comment34881489_22860812).
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22861059

http://stackoverflow.com/a/61249704
upvote count: 2
answers question: http://stackoverflow.com/q/22909429
type: Answer
has body: Unfortunately, the answers above didn't fully work for grayscale images, in my case. Not sure why. That's why I wrote this one (Additionally I'm using a ByteBuffer, because of the performance): import android.graphics.Bitmap; import android.util.Log; import java.io.FileOutputStream; import java.io.OutputStream; import java.nio.ByteBuffer; public class BmpFile { // Private constants private final static int BITMAPFILEHEADER_SIZE = 14; private final static int BITMAPINFOHEADER_SIZE = 40; // Private variable declaration // Bitmap file header private byte bitmapFileHeader[] = new byte[14]; private byte bfType[] = {'B', 'M'}; private int bfSize = 0; private int bfReserved1 = 0; private int bfReserved2 = 0; private int bfOffBits = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE; // Bitmap info header private byte bitmapInfoHeader[] = new byte[40]; private int biSize = BITMAPINFOHEADER_SIZE; private int biWidth = 0; private int biHeight = 0; private int biPlanes = 1; private int biBitCount = 24; private int biCompression = 0; private int biSizeImage = 0x030000; private int biXPelsPerMeter = 0x0; private int biYPelsPerMeter = 0x0; private int biClrUsed = 0; private int biClrImportant = 0; // Bitmap raw data private int pixels[]; // File section private ByteBuffer buffer = null; private OutputStream outputStream; // Default constructor public BmpFile() { } public void saveBitmap( String parFilename, Bitmap bitmap ) { try { outputStream = new FileOutputStream(parFilename); save(bitmap); outputStream.close(); } catch (Exception e) { Log.e("Exception", e.getMessage()); } } public void saveBitmap( Bitmap bitmap, OutputStream outputStream ) { this.outputStream = outputStream; save(bitmap); } /* * The saveMethod is the main method of the process. This method * will call the convertImage method to convert the memory image to * a byte array; method writeBitmapFileHeader creates and writes * the bitmap file header; writeBitmapInfoHeader creates the * information header; and writeBitmap…
score: 2
has comment: http://stackoverflow.com/comment/120328167
downvote count: 0

http://stackoverflow.com/a/22833646
downvote count: 0
type: Answer
score: 1
has body: Maybe you can write scipt with all those maven commands
answers question: http://stackoverflow.com/q/22833557
upvote count: 1

http://stackoverflow.com/q/22936487
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/35013632
linked to: http://stackoverflow.com/q/13037730
has body: i can use jdbc driver with java gui but i cant use on android.i added mysql connection jar and i use same connection informations(ip-name-pass).compiler dosnt give me error but it isnt working.is it possible to use jdbc on android? in these code i never take "bağlantı başarılı" message try {Toast.makeText(getApplicationContext(), "driverbağlantısı", Toast.LENGTH_LONG).show(); Class.forName("com.mysql.jdbc.Driver"); try { Toast.makeText(getApplicationContext(), "başlıyor", Toast.LENGTH_LONG).show(); conn = DriverManager.getConnection("jdbc:mysql://000.000.000.000/sdsa" , "root", "pass"); Toast.makeText(getApplicationContext(), "bağlantı başarılı", Toast.LENGTH_LONG).show(); } catch (SQLException e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), "bağlantı başarısız", Toast.LENGTH_LONG).show(); } try { conn.close(); } catch (SQLException e) { e.printStackTrace(); }; } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), "driver hatası"+e.getMessage(), Toast.LENGTH_LONG).show(); }
has comment: http://stackoverflow.com/comment/35013682
has comment: http://stackoverflow.com/comment/35014056
score: 0
has comment: http://stackoverflow.com/comment/35013724
tagged with: android
has comment: http://stackoverflow.com/comment/35014520
has comment: http://stackoverflow.com/comment/35013988
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22936715
has comment: http://stackoverflow.com/comment/35013670
has title: is it possible to use jdbc driver on android?
has comment: http://stackoverflow.com/comment/35013628
tagged with: java
tagged with: database
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/35013807
has comment: http://stackoverflow.com/comment/35013767

http://stackoverflow.com/comment/34965249
has text: @Lauren I will update my answer in a while. Stay tuned
type: AnswerComment
comment on: http://stackoverflow.com/a/22908522
type: Comment
score: 0

http://stackoverflow.com/comment/35050888
score: 0
comment on: http://stackoverflow.com/q/22955178
has text: @self. His way of reading the file is perfectly realistic; both the C++ `std::filebuf` and Java's `BufferedReader` should use buffering optimized for the given platform. If you can improve on it, then there's something wrong with the implementation.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22916790
upvote count: 5
has comment: http://stackoverflow.com/comment/138863024
has comment: http://stackoverflow.com/comment/35018879
has body: Following the comments of @AdrianMitev, I finally ended up writing this class which returns an instance of a Managed CDI Bean given its class name (elName) or class type: public class GetInstance { public static Object of(String elName) { BeanManager bm = getBeanManager(); Bean&lt;?&gt; bean = bm.resolve(bm.getBeans(elName)); return bm.getReference(bean, bean.getBeanClass(), bm.createCreationalContext(bean)); } @SuppressWarnings("unchecked") public static &lt;T&gt; T of(Class&lt;T&gt; clazz) { BeanManager bm = getBeanManager(); Bean&lt;?&gt; bean = bm.resolve(bm.getBeans(clazz)); return (T) bm.getReference(bean, bean.getBeanClass(), bm.createCreationalContext(bean)); } private static BeanManager getBeanManager() { try { return (BeanManager) new InitialContext().lookup("java:comp/BeanManager"); } catch (NamingException e) { e.printStackTrace(); } return null; } } So, if you have a class like this one: @Named public class FooClass { ... } You can get an a managed CDI instance using: FooClass fC = GetInstance.of(FooClass.class); or using its elName FooClass fC = (FooClass) GetInstance.of("fooClass"); or you can select the name to use: @Named(value="CustomFooClassName") public class FooClass { ... } And using: FooClass fC = (FooClass) GetInstance.of("CustomFooClassName");
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22847918
score: 5
has comment: http://stackoverflow.com/comment/35000822

http://stackoverflow.com/q/22936399
type: Question
type: AnsweredQuestion
score: 1
tagged with: gae-module
tagged with: java
has answer: http://stackoverflow.com/a/22936518
upvote count: 1
has title: Updating a Google App Engine module
answer count: 1
favorite count: 0
tagged with: google-app-engine
has body: When I try to update my Google App Engine module, I get an error saying that the name and version are already in use (which they are, I'm trying to UPDATE). I've tried updating the whole EAR as well as just the module that I want to update, but both result in the same errors: Unable to update: com.google.appengine.tools.admin.HttpIoException: Error posting to URL: https://appengine.google.com/api/appversion/create?module=stomp&amp;app_id=&lt;my_app_id&gt;&amp;version=stomp&amp; 400 Bad Request Version 'stomp' is already in use as a module name. Please use a different version. at com.google.appengine.tools.admin.AbstractServerConnection.send1(AbstractServerConnection.java:293) at com.google.appengine.tools.admin.AbstractServerConnection.send(AbstractServerConnection.java:253) at com.google.appengine.tools.admin.AbstractServerConnection.post(AbstractServerConnection.java:232) at com.google.appengine.tools.admin.AppVersionUpload.send(AppVersionUpload.java:973) at com.google.appengine.tools.admin.AppVersionUpload.beginTransaction(AppVersionUpload.java:645) at com.google.appengine.tools.admin.AppVersionUpload.doUpload(AppVersionUpload.java:147) at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:445) at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:55) at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute(AppCfg.java:1339) at com.google.appengine.tools.admin.AppCfg.executeAction(AppCfg.java:325) at com.google.appengine.tools.admin.AppCfg.&lt;init&gt;(AppCfg.java:211) at com.google.appengine.tools.admin.AppCfg.&lt;init&gt;(AppCfg.java:122) at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:118) com.google.appengine.tools.admin.AdminException: Unable to update app: Error posting to URL: https://appengine.google.com/api/appversion/create?module=stomp&amp;app_id=&lt;my_app_id&gt;&amp;version=stomp&amp; 400 Bad Request Version 'stomp' is already in use as a module name. Please use a different version. at com.…
downvote count: 0
accepted answer: http://stackoverflow.com/a/22936518

http://stackoverflow.com/a/22955498
downvote count: 0
answers question: http://stackoverflow.com/q/22955427
type: Answer
score: 1
upvote count: 1
has body: You are comparing references, because in Java arrays are objects: Since these are different objects, you will get false. If you had this: int[] f3 = { 100 }; int[][] f2 = { f3, { 2, 1 } }; System.out.println(f2[0] == f3); The output would be true because you are adding the reference f3 as an element of the array f2.

http://stackoverflow.com/comment/34949190
has text: Hi, thanks for reply one more time, it kicked me in the right way. I believe I have found an answer I was looking for: http://stackoverflow.com/a/22900490/2709026
type: Comment
comment on: http://stackoverflow.com/a/22899236
score: 0
type: AnswerComment

http://stackoverflow.com/q/22875020
has comment: http://stackoverflow.com/comment/34903641
downvote count: 1
has answer: http://stackoverflow.com/a/22875087
has comment: http://stackoverflow.com/comment/34903500
favorite count: 0
possible better answer: http://stackoverflow.com/a/22875071
has body: This is the problem I have: If part or all of the path does not already exist, the server should create additional directories as necessary in the hierarchy and then create a new file as above. Files.createDirectories(path); That's what I am currently using, but it does not create the end file. For example is the path="/hello/test.html" it will create a directory called "hello" and one called "test.html", I want the test.html to be a file. How can I do that?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22875169
accepted answer: http://stackoverflow.com/a/22875169
has answer: http://stackoverflow.com/a/22875071
linked to: http://stackoverflow.com/q/6142901
has title: How to create a Path and a File that does not Exist in Java
tagged with: java
has comment: http://stackoverflow.com/comment/34903544
type: Question
score: 5
has comment: http://stackoverflow.com/comment/34903683
upvote count: 6
tagged with: nio
answer count: 3

http://stackoverflow.com/comment/34925883
score: 0
has text: The Layouts I have used are BorderLayout, GridLayout, and the default layout. I tried pack() and revalidating the panels as suggested, but this did not solve the problem. I wonder if it might be connected with the JScrollPane? If I comment out everything which references the JScrollPane, it _seems_ to render the buttons correctly, but throws an error: (Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException) on the line: groundCanvas.getGraphics().drawImage(offscreen, 0, 0, groundCanvas); (_groundCanvas is a JPanel, and offscreen is a BufferedImage BTW)
comment on: http://stackoverflow.com/q/22885858
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34984278
comment on: http://stackoverflow.com/a/22917218
type: AnswerComment
has text: It's just a *warning* issued by Oracle's Java compiler 1.7+ whenever you compile for an old Java version but against a newer Java API, which means you could accidentally use classes or methods that won't be available at runtime, without this being detected at compile time. (You can easily check for this on CI though.) The generated class files will be correct nevertheless.
type: Comment
score: 1

http://stackoverflow.com/comment/34888227
has text: It is a design problem, as I noted in my answer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22867005
type: Comment

http://stackoverflow.com/q/22872260
has comment: http://stackoverflow.com/comment/34897928
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34897932
has title: Doing double - int in java
has comment: http://stackoverflow.com/comment/34898656
has body: For example if I do this: double decPart = 5.57 - 5; System.out.println(decPart); it returns 0.5700000000000003, instead of just 0.57. I can print it out properly using System.out.printf("%.2f", decPart), but that doesn't solve the problem (Note: the decimal part is not necessarily 2 decimal places). So for example if I try to do this: System.out.println(1.0 - decPart); it would return 0.4299999999999997 Can somebody please explain this behavior and how to fix it. Thanks in advance.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22872294
tagged with: primitive
downvote count: 1
type: Question
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/22872294

http://stackoverflow.com/a/22846017
has body: First of all: JAR files should not be copied to the src folder. As far as I can see DirectoryServer.jar is in it right now. Secondly: .sh files should be moved to the root of your project too. You could easily generate Ant buildfiles with Eclipse (Export.. > Ant buildfiles) and then use them from terminal (installing ANT is a must!). Other option would be to export a runnable JAR directly from Eclipse, then run it from terminal. I hope it helps! Feel free to ask in comment if you have any more questions!
has comment: http://stackoverflow.com/comment/34856888
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34865593
answers question: http://stackoverflow.com/q/22845619

http://stackoverflow.com/q/22879481
favorite count: 0
type: UnansweredQuestion
tagged with: video
answer count: 0
upvote count: 2
type: Question
tagged with: video-streaming
tagged with: opencv
tagged with: java
tagged with: ip-camera
has body: I have Tenvis IP camera with a username and password. I want to capture live photo or video from it in a simple java application developed in Eclipse IDE using OpenCV. I am using following code to serve my purpose. public class Hello { public static void main( String[] args ) { try { System.out.println("Welcome to OpenCV " + Core.VERSION); System.loadLibrary(Core.NATIVE_LIBRARY_NAME); Mat m = Mat.eye(3, 3, CvType.CV_8UC1); System.out.println("m = " + m.dump()); // VideoCapture cap= new VideoCapture("D:/css/pizzavideo.mp4"); VideoCapture cap = new VideoCapture("http://192.168.2.106:7777/video/livesp.asp? user=admin&amp;pwd=admin&amp;resolution=32"); if(cap.isOpened()) { System.out.println(" camera found----"+cap); Mat frame = new Mat(); while(true){ if (cap.read(frame)){ System.out.println("Frame Obtained"); System.out.println("Captured Frame Width " + frame.width() + " Height " + frame.height()); Highgui.imwrite("img1.jpg", frame); System.out.println("OK"); break; } } } else { System.out.println("Did not connect to camera"); } cap.release(); } catch(Exception e) { System.out.println("Exception---"+e.getMessage()); } } } Result :When using http://192.168.2.106:7777/video/livesp.asp? user=admin&amp;pwd=admin&amp;resolution=32 Welcome to OpenCV 2.4.8.0 m = [1, 0, 0; 0, 1, 0; 0, 0, 1] Did not connect to camera Result (I am successfully getting a frame of video as img1.jpg): When using D:/css/pizzavideo.mp4 Welcome to OpenCV 2.4.8.0 m = [1, 0, 0; 0, 1, 0; 0, 0, 1] camera found----org.opencv.highgui.VideoCapture@87816d Frame Obtained Captured Frame Width 480 Height 262 OK Please reply if any one knows how to connect my IP Camera and take photos or video in my java application?
score: 2
downvote count: 0
has title: How to connect with Tenvis IP camera from java application using OpenCV
has comment: http://stackoverflow.com/comment/34960603

http://stackoverflow.com/q/22964668
type: Question
accepted answer: http://stackoverflow.com/a/22964860
has title: Java reconstruction tree from postorder and preorder
score: 0
answer count: 1
has body: Hy, i have some troubles i want to reconstructe tree with two travelsar (postorder and preoorder). I saw on netbeans at least 5 hours and i cant solve problem with my this code. If anyone saw what i make wrong or give me other reconstruction. I will be vary grateful import java.util.Arrays; import java.util.List; public class ReConstructBTree { /** * @param args */ public static void main(String[] args) { String[] pre = "I Q J H L E M V O T S B R G Y Z K C A &amp; F P N U D W X".split("\\s"); String[] post = "H E M L J V Q S G Y R Z B T C P U D N F W &amp; X A K O I".split("\\s"); List preList = Arrays.asList(pre); List postList = Arrays.asList(post); BTree tree = reBuildTree(preList, postList); tree.inOrder(tree); //print in-order System.out.println(); tree.postOrder(tree);//print post order to re-check System.out.println(); tree.preOrder(tree);//print pre order to re-check } private static BTree reBuildTree(List preList, List postList) { BTree tree = null; if(preList.size() != 0 &amp;&amp; postList.size() != 0) { tree = new BTree(); String val = preList.get(0); tree.val = val; if(preList.size() &gt; 1 &amp;&amp; postList.size() &gt; 1) { int postOrderPos = postList.indexOf(preList.get(1)); int preOrderPos = preList.indexOf(postList.get(postList.size()-2)); //find the two sub set of the list from pre-order List leftPreOrder = preList.subList(1, preOrderPos); List rightPreOrder = preList.subList(preOrderPos, preList.size()); //find the two sub set of the list from post-order List leftPostOrder = postList.subList(0, postOrderPos+1); List rightPostOrder = postList.subList(postOrderPos+1, postList.size()-1); tree.left = reBuildTree(leftPreOrder, leftPostOrder); tree.right = reBuildTree(rightPreOrder, rightPostOrder); } } return tree; } static class BTree { String val; BTree left; BTree right; void inOrder(BTree tree) { if(tree.left != null) inOrder(tree.left); System.out.print(tree.val+" "); if(tree.right != null) inOrder(tree.right); } void preOrder(BTree tree) { Syst…
has answer: http://stackoverflow.com/a/22964860
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1136999
tagged with: java

http://stackoverflow.com/comment/34980600
score: 0
type: AnswerComment
has text: @Lauren Your welcome and you're right about the typo, I updated the my answer :)
type: Comment
comment on: http://stackoverflow.com/a/22908522

gmail
type: Tag
tags question: http://stackoverflow.com/q/22890719
tag name: gmail
tags question: http://stackoverflow.com/q/22883246
tags question: http://stackoverflow.com/q/22835093

http://stackoverflow.com/q/22956280
type: Question
has comment: http://stackoverflow.com/comment/35049375
tagged with: java
score: -1
tagged with: http-status-code-403
tagged with: servlets
downvote count: 2
has answer: http://stackoverflow.com/a/51278615
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/35049300
has title: Error 403 when accessing java servlet in tomcat root context using POST
favorite count: 0
has comment: http://stackoverflow.com/comment/35050208
has answer: http://stackoverflow.com/a/22956517
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/35358175
tagged with: tomcat7
has body: Basically I setup a servlet which you can simply post for some data and it worked on localhost. However when it was deployed to tomcat on our VPS, you can view the page in a browser, but if my java code tries to make a POST request-I get error 403 (forbidden). Any idea why this is and if so, any help would be greatly appreciated! :) Additional detail: Server: Tomcat 7 Context: ROOT (I think) Stack trace: java.io.IOException: Server returned HTTP response code: 403 for URL: http://minemanager.org/auth at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626) at net.stormdev.MTA.SM.http.SimplePostClient.post(SimplePostClient.java:40) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) And in the servlet the code is a simple response in the 'doPost' method which works on localhost: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Set response content type response.setContentType("text/html"); // Actual logic goes here. PrintWriter out = response.getWriter(); out.println(" Oh dear, you can't access this like this! "); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text"); PrintWriter out = response.getWriter(); Object accEmail = request.getParameter("accEmail"); Object accUUID = request.getParameter("accUUID"); if(accEmail == null || accUUID == null){ out.println("false"); //Nope, not valid... out.flush(); out.close(); return; } String resp = ""+Auths.isValid(accUUID.toString(), accEmail.toString()); out.println(resp); out.flush(); out.close(); } And finally the code sending the reques…

http://stackoverflow.com/comment/38889461
comment on: http://stackoverflow.com/a/22895595
type: AnswerComment
score: 0
type: Comment
has text: I wanted to follow up on this after a little experimentation. Apache `HttpClient` was able handle about 80% of the requests and I was able to raise that to about ~95% simply using `HttpURLConnection`. Ultimately I've decided the effort involved isn't worth the liability. 1-2% failure could mean 100k+ broken requests so I've decided to move the proxying out of the app. Varnish is sitting in front of the app and on a 305 (Use Proxy) response it uses a transparent Squid proxy as the backend. Here's the ProxyService https://gist.github.com/corycomer/944725400afa0abf8906 thanks a lot for the help!

http://stackoverflow.com/comment/34935773
comment on: http://stackoverflow.com/a/22892853
type: Comment
has text: yes! It works! Just change ".append" with ".push". You're right... I writing the html code by appending strings. Which is the correct alternative?
type: AnswerComment
score: 0

http://stackoverflow.com/q/22825578
tagged with: execution
score: 0
answer count: 1
has body: We are building a grading system, and part of its job is to take input files, and from the given directory, our system will compile and run a (non-java) source code file written by the students. Then, the system will display the output from that run. It is not limited to python, any other language that can meet the requirement is OK. Is there is any method for providing for the location of the python code and the input file, and then run that code, returning the output file. If not, how can i achieve this goal?
type: UnansweredQuestion
has title: Run a python or other language code inside Java
tagged with: python
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22825630
tagged with: compilation

http://stackoverflow.com/q/22822443
tagged with: eclipse
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23225695
has answer: http://stackoverflow.com/a/23225695
tagged with: tcserver
has answer: http://stackoverflow.com/a/23223814
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23223814
has title: How to setup TC Server Developer Edition (in STS) and accessing a UNC path
type: Question
tagged with: spring-tool-suite
has body: I Have a java project running in Spring Tool Source IDE in an instance of TC Server Developer Edition and I need to access a UNC path share on our network. How do I configure the TC Server Developer Edition to use our "Service Account" that has been granted access to the share on our network? I read that for Apache Tomcat you could just configure the windows service, but the dev version of TC Server I have, it does not seem to have a service installed.

android-sdcard
tags question: http://stackoverflow.com/q/22928956
tag name: android-sdcard
tags question: http://stackoverflow.com/q/22892070
type: Tag

http://stackoverflow.com/q/22940673
downvote count: 1
has comment: http://stackoverflow.com/comment/35021608
has comment: http://stackoverflow.com/comment/35022360
has comment: http://stackoverflow.com/comment/35021897
has title: Count and display the occurrences of each of the letters of the alphabet, in alphabetical order using Java
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35021758
has comment: http://stackoverflow.com/comment/35021720
tagged with: java
linked to: http://stackoverflow.com/q/15532866
type: Question
has comment: http://stackoverflow.com/comment/35021571
has comment: http://stackoverflow.com/comment/35021830
has answer: http://stackoverflow.com/a/22940930
score: 0
has body: Good Afternoon I've a piece of code that will count and display the occurrences of each of the letters of the alphabet from user input. But I need to put it in alphabetical order and display the most frequently occurring letter and the number of occurrences for that letter: package Assessment2; import java.util.Scanner; public class test2 { String str = "Hello World", s = str; int count = 0; public void show() { Scanner input = new Scanner(System.in); System.out.print("Enter String: "); String s = input.nextLine(); System.out.println("****************************"); while (s.length() &gt; 0) { count = 0; for (int i = 0; i &lt; s.length(); i++) { if (s.charAt(i) == s.charAt(0)) count++; } System.out.println(s.charAt(0) + ": " + count); s = s.replace(String.valueOf(s.charAt(0)), ""); } } public static void main(String[] ar) { new test2().show(); } }
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22940810

http://stackoverflow.com/a/22895883
type: Answer
answers question: http://stackoverflow.com/q/22895518
has body: 1-you have to clone (or to copy) the array to the sortedArray. 2-The swap method was not correct. 3-The first call of the method recursiveSort should be parametrized by the last index of the array so sortedArray.length - 1. public class RecursiveSorter { private int[] sortedArray; private int[] array; public RecursiveSorter() { array = new int[1]; } public RecursiveSorter(int[] a) { array = a; } public void setArray(int[] a) { array = a; } public int[] getSortedArray() { return sortedArray; } public int[] getOriginalArray() { return array; } public void sort() { sortedArray = array.clone(); System.out.println(this); recursiveSort(sortedArray.length - 1); //Should subtract by length } public void recursiveSort(int endIndex) { System.out.println("Sorting with param : "+endIndex); if (endIndex &gt;= 0) { int m = getMaxIndex(endIndex, sortedArray); swap(m, endIndex); System.out.println(this); recursiveSort(endIndex - 1); } } public int getMaxIndex(int endIndex, int[] a) { int max = a[0]; int maxIndex = 0; for (int i = 1; i &lt;= endIndex; i++) { if (a[i] &gt; max) { max = a[i]; maxIndex = i; System.out.println("Max index : " + i); } } return maxIndex; } public void swap(int src, int dest) { System.out.println("Swap : "+src+" to "+dest); int temp = sortedArray[dest]; sortedArray[dest] = sortedArray[src]; sortedArray[src] = temp; } public String toString() { return "Original: " + prettyPrint(getOriginalArray()) + "\n" + "Sorted: " + prettyPrint(getSortedArray()); } private String prettyPrint(int[] a) { String s = ""; for (int i : a) { s += i + " "; } return s; } public static void main(String[] args) { // Automate running, but not testing int[] array = {5, 67, 12, 20}; RecursiveSorter s = new RecursiveSorter(array); s.sort(); //System.out.println(s); // uses Sorter.toString } }
score: 0
has comment: http://stackoverflow.com/comment/34941138

http://stackoverflow.com/a/22893230
upvote count: 2
has body: It's not possible. Names of local variables are not even persistent in the compiled Class file. Names of fields are there, as it is the part of API, but you would have to modify the Class file runtime - and that is not what do you want. With Hashtable, it may be done like this: Hashtable&lt;String, Person&gt; hashtable = new Hashtable&lt;&gt;(); hashtable.put("student", new Person()); Then you may get your "variable" by: Person person = hashtable.get("student"); When I guess what you are trying to do, this is some more helpful example: import java.util.Hashtable; import java.util.Scanner; public class Test { public static class Person { public final String name; public final int age; public Person(String name, int age) { this.name = name; this.age = age; } @Override public String toString() { return "Name: " + name + ", age: " + age; } } public static class PersonsList { private Hashtable&lt;String, Person&gt; persons = new Hashtable&lt;String, Test.Person&gt;(); public void addPerson(Person person) { this.persons.put(person.name, person); } public Person findPerson(String name) { return persons.get(name); } @Override public String toString() { return persons.toString(); } } public static void main(String[] args) { PersonsList personsList = new PersonsList(); Scanner scanner = new Scanner(System.in); while (scanner.hasNextLine()) { String line = scanner.nextLine(); if (line.equals("END")) { break; } try { String[] parts = line.split(" "); String name = parts[0]; int age = Integer.valueOf(parts[1]); personsList.addPerson(new Person(name, age)); } catch (NumberFormatException e) { System.out.println("Age must be an decimal non-floating-point number."); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("You must enter both name and age"); } } scanner.close(); System.out.println(personsList); } }
answers question: http://stackoverflow.com/q/22893152
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/34821794
comment on: http://stackoverflow.com/a/22828845
type: AnswerComment
score: 0
type: Comment
has text: Yea but there's no guarantee they'll add them

http://stackoverflow.com/comment/34959906
comment on: http://stackoverflow.com/a/22875212
score: 0
type: Comment
has text: @AchimNierbeck: Thanks! I've seen and upvoted that earlirer :-)
type: AnswerComment

http://stackoverflow.com/q/22946149
accepted answer: http://stackoverflow.com/a/22946573
type: Question
type: AnsweredQuestion
tagged with: java
answer count: 1
tagged with: apache-felix
score: 0
tagged with: osgi
has title: Getting osgi declatative service from activator (same package)
has body: I am newbie to osgi and it may be the reason of such simple question. A have a osgi bundle. Inside I have service,activator and pojo. Instance of pojo I create in activator. How can I pass the reference of pojo to service before anyone uses this service? The only way that comes to my mind is to access service as a standard service and use default identifier for setter, but it's not so good solution. CDI is not used.
has answer: http://stackoverflow.com/a/22946573

http://stackoverflow.com/a/22955119
has body: Declare the default value as 0 in both rating and event . And then remove super() keyword in your constructor.
answers question: http://stackoverflow.com/q/22954724
type: Answer
has comment: http://stackoverflow.com/comment/35048416
score: 0

http://stackoverflow.com/comment/34942761
score: 0
type: QuestionComment
has text: @MattMurch: Click the link for details.
type: Comment
comment on: http://stackoverflow.com/q/22896401

http://stackoverflow.com/comment/34900352
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22873405
has text: Is there a site you have? I can't seem to find anything on Google. I could not figure this out: http://stackoverflow.com/questions/16378109/java-swing-scrolling-by-dragging-the-mouse

http://stackoverflow.com/q/22880012
accepted answer: http://stackoverflow.com/a/22880991
tagged with: hibernate-mapping
score: 4
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
upvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/22881774
has body: I have 2 entities : Field and ViewOptions fields and methods not related to the problem are omitted Table structure: CREATE TABLE FIELD ( ID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (ID), ); CREATE TABLE VIEW_OPTIONS ( ID INT NOT NULL AUTO_INCREMENT, FIELD_ID INT NOT NULL, PRIMARY KEY (ID), INDEX (FIELD_ID ASC), CONSTRAINT FOREIGN KEY (FIELD_ID) REFERENCES FIELD (ID) ON DELETE NO ACTION ON UPDATE NO ACTION); Mapping: @Table(name = "FIELD") @Entity public class Field { @OneToOne(mappedBy ="field") ViewOptions viewOptions; @Table(name = "VIEW_OPTIONS") @Entity public class ViewOptions { @OneToOne @JoinColumn(name = "FIELD_ID") Field field; In this relation the owner side is ViewOptions and the inverse side is Field. What i want to do is to swap sides - make Field the owner side. But if i mark viewOptions like this @OneToOne @JoinColumn(name = "FIELD_ID") ViewOptions viewOptions; Hibernate expecting join column in Field table. Is there any way to tell hibernate to search for join column in VIEW_OPTIONS?
tagged with: jpa
has answer: http://stackoverflow.com/a/22881774
downvote count: 0
has answer: http://stackoverflow.com/a/22880991
favorite count: 0
tagged with: one-to-one
has title: JPA OneToOne unidirectional mapping

http://stackoverflow.com/q/22825977
type: Question
has answer: http://stackoverflow.com/a/22825992
favorite count: 0
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22826136
has comment: http://stackoverflow.com/comment/34814517
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22826029
has comment: http://stackoverflow.com/comment/34815491
has title: How to use else statement
tagged with: java
has body: I tried in my code to use else statement, but I always get an error. Here is my code, I wanna to say else mode=0. public static int mode(int n[]) { sort(n); int l[]=new int[n[n.length-1]+1]; int mode = 0; int j = 0; // to count the number which repeated most int i=0; for ( i=0; i &lt; n.length; i++) // for loop to go over all elements { l[n[i]]++; // increment the number if (j &lt; l[n[i]]) j = l[n[i]]; mode = n[i]; else mode=0; } return mode; }

http://stackoverflow.com/q/22818590
favorite count: 0
upvote count: 20
has answer: http://stackoverflow.com/a/77596212
has answer: http://stackoverflow.com/a/45843117
has answer: http://stackoverflow.com/a/22818845
has comment: http://stackoverflow.com/comment/34801406
has comment: http://stackoverflow.com/comment/34802215
score: 19
has answer: http://stackoverflow.com/a/22819255
has answer: http://stackoverflow.com/a/30390710
type: AnsweredQuestion
tagged with: java
type: Question
has title: Java: How to check that 2 binary files are same?
answer count: 8
has answer: http://stackoverflow.com/a/22820114
accepted answer: http://stackoverflow.com/a/22820114
has answer: http://stackoverflow.com/a/61539141
possible better answer: http://stackoverflow.com/a/22819255
has comment: http://stackoverflow.com/comment/34801391
downvote count: 1
has comment: http://stackoverflow.com/comment/34801203
has answer: http://stackoverflow.com/a/22820369
has body: What is the easiest way to check (in a unit test) whether binary files A and B are equal?

http://stackoverflow.com/comment/35021054
has text: In this case you don't "create" a `String` you get it from somewhere.. resources? Where your ringtone are stored?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22883315

http://stackoverflow.com/q/22926538
has title: Exceptions with okHttp and SPDY
has body: I have an Android Application using okHttp to do the communication with my server. I do some detailed error handling on the client side, reported to BugSense, and I've gotten a few confusing IOExceptions that I was hoping could be explained to me. The exceptions are: 1. stream was reset: CANCEL 2. connect failed: ENETUNREACH (Network is unreachable) 3. stream was reset: REFUSED_STREAM 4. Hostname 'myversion-dot-myapplication.appspot.com' was not verified I don't recall seeing the first three before migrating to okHttp, specificlly the SPDY pieces. The last one is an issue that I have constantly struggled with on app engine (SSL provided by AppEngine seems to throw that error.) I am checking for connectivity before initiating my transfer, so could this just be something that happens when connectivity is dropped while transferring? Is there something else that could cause this? Thanks! Evan
tagged with: google-app-engine
accepted answer: http://stackoverflow.com/a/22928708
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
tagged with: network-programming
downvote count: 0
has answer: http://stackoverflow.com/a/22928708
score: 3
tagged with: android
answer count: 1
tagged with: okhttp
favorite count: 0

http://stackoverflow.com/comment/35011064
score: 0
type: AnswerComment
type: Comment
has text: @nos if **myList** is **LinkedList** - your code will not work
comment on: http://stackoverflow.com/a/22932150

http://stackoverflow.com/comment/35060083
has text: lb is obviously null: findViewById(R.id.linearMain) returns null. You have to double check, whether the linearMain view really exists. For further help, you need to provide the xml-file where this id is defined.
score: 1
comment on: http://stackoverflow.com/q/22962432
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34949799
type: Comment
has text: Sorry, for 1) I meant to write "nc 192.168.56.1 6666" on Fedora.
comment on: http://stackoverflow.com/q/22873166
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34986283
type: Comment
comment on: http://stackoverflow.com/a/22920844
has text: Aha, I'm seeing it now, it's in attempting to call the method itself.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/58265584
type: Comment
has text: Thanks this is the easiest way to do it I hope this question got more attention and votes
comment on: http://stackoverflow.com/a/22965940
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34975686
comment on: http://stackoverflow.com/q/22914536
type: Comment
type: QuestionComment
has text: can you add full code of your testing class ?
score: 0

http://stackoverflow.com/a/22938142
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22937065
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22937065
has body: Use regular expressions instead: ([\w_]+=(?:\{[\w=_,\[\]"\|:\.\s-]*\}))|([^,]+) This will group the line into 4 sections: LanguageID=0 LastKnownPeriod="Active" c_MultiPartyCall={Counter=1,TimeStamp=1394539271448} LTH={Data=["1|MTC|01.01.1970 15:00:00|0.0|7|-1|OnPeakAccountID|0|1000||","1|MTC|01.01.1970 15:00:00|0.0|7|-1|OnPeakAccountID|0|1000||"} Code: import java.util.regex.*; public class JavaRegEx { public static void main(String[] args) { String line = "LanguageID=0,LastKnownPeriod=\"Active\",c_MultiPartyCall={Counter=1,TimeStamp=1394539271448},LTH={Data=[\"1|MTC|01.01.1970 15:00:00|0.0|7|-1|OnPeakAccountID|0|1000||\",\"1|MTC|01.01.1970 15:00:00|0.0|7|-1|OnPeakAccountID|0|1000||\"}"; Pattern pattern = Pattern.compile("([\\w_]+=(?:\\{[\\w=_,\\[\\]\"\\|:\\.\\s-]*\\}))|([^,]+)"); Matcher matcher = pattern.matcher(line); while(matcher.find()) System.out.println(matcher.group(0)); } }

http://stackoverflow.com/a/22832969
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22832624
has comment: http://stackoverflow.com/comment/34826841
has body: You need to add another loop. Stylistically speaking, I would avoid using do...while loops, as they are difficult to read. I have included a while loop done the more traditional way to show you how blissfully sexy they are. while(anotherFlag) { TARGET = generator.nextInt(100) + 1; //establishes the target number System.out.print("Can you guess what it is?\n"); do { //beginning the loop guess = consoleIn.nextInt(); count++; if (guess &gt; TARGET) System.out.print("Sorry - Your guess is too high \n"); else if (guess &lt; TARGET) System.out.print("Sorry - Your guess is too low \n"); } while(guess != TARGET &amp;&amp; count &lt; 6); if(guess == TARGET) { System.out.println("Congratulations! - You found it!"); System.out.println(); } else { System.out.println("Sorry - You have used all 6 guesses"); } System.out.println(); System.out.println("Would you like to guess again? (yes/no)"); another = consoleIn.next(); } The above won't work fully, you need to set anotherFlag to false if the user inputs 'no'. That should be a relatively simple exercise, but the above will get the program to loop over and over.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22832624

http://stackoverflow.com/q/22887995
has answer: http://stackoverflow.com/a/22888228
has comment: http://stackoverflow.com/comment/34927558
has answer: http://stackoverflow.com/a/22888033
tagged with: java
has comment: http://stackoverflow.com/comment/34926542
has body: hey i need some quick advice. i want to calculate average score for game, and update it every round, but i cant do this properly. private void updateAverage(GLabel average) { average.setLabel(String.valueOf("Avg: " + String.valueOf((int)((AI_SCORE + PLAYER_SCORE) / TOTAL_GAMES)))); average.setLocation(getWidth() / 2 - average.getWidth() / 2, getHeight() - PADDING); TOTAL_GAMES++; } this is the code I use. I also call this method before 1st round, to put the counter on screen. If I set TOTAL_GAMES = 0; when definig, I get / by 0 error. But if I set it at 1, by average is flawed. I can't find the right place for TOTAL_GAMES++;m I tried putting it in method detecting game loss, after upadting average like in code above and some other, but every time the average is calculated wrong. Full code here
type: Question
tagged with: average
accepted answer: http://stackoverflow.com/a/22888033
has title: Average Score for games. Either I divide by zero or calculate one too many
tagged with: function
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34926530
possible better answer: http://stackoverflow.com/a/22888228
type: AnsweredQuestion

http://stackoverflow.com/q/22963443
tagged with: selenium-webdriver
tagged with: java
tagged with: selenium
type: Question
score: 0
answer count: 1
type: UnansweredQuestion
has title: Not able to switch to the frame in the page of the timeofindia site
has answer: http://stackoverflow.com/a/22964663
has body: import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class TimeOfIndiaElements { public static void main(String[] args) { WebDriver driver=new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); driver.get("http://timesofindia.indiatimes.com/"); WebElement element=driver.findElement(By.xpath("//form[@name='pollform']")); driver.switchTo().frame(element"); String mathText=driver.findElement(By.xpath("//div[@id='pdiv']//span[@id='mathq2']")).getText(); System.out.println(mathText); } } I am not able to switch to the frame(containing 5+5) in the timesofindia site and getting NoSuchElementException. Kindly help me as am new to selenium.

http://stackoverflow.com/q/22901885
tagged with: java
tagged with: comparable
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34951683
possible better answer: http://stackoverflow.com/a/22901935
favorite count: 0
has answer: http://stackoverflow.com/a/22901935
accepted answer: http://stackoverflow.com/a/22901897
tagged with: nullpointerexception
answer count: 3
has answer: http://stackoverflow.com/a/22901959
has body: Everything runs well in my post office file except when I run the post office file, it says there is a problem with my compareTo method which is in my letters file. The error reads: ----jGRASP exec: java PostOffice Exception in thread "main" java.lang.NullPointerException at Letter.compareTo(Letter.java:33) at Letter.compareTo(Letter.java:1) at SortSearchUtil.selectionSort(SortSearchUtil.java:106) at PostOffice.sortLetters(PostOffice.java:73) at PostOffice.main(PostOffice.java:15) ----jGRASP wedge: exit code for process is 1. ----jGRASP: operation complete. I don't know what could be wrong with my method. My compareTo method is supposed to compare the current Letter to the one passed in first by zip code, then by street value of the to address if the zip codes are the same. Here's my Post Office Method: import java.util.*; import java.io.*; public class PostOffice { private final int max = 1000; private Letter [] ltrAra = new Letter[max]; private int count; public static void main(String [] args) { PostOffice postOffice = new PostOffice(); postOffice.readLetters("letters.in"); postOffice.sortLetters(); postOffice.printLetters(); } public PostOffice() { Letter [] Letters = ltrAra; this.count = 0; } public void readLetters(String filename) { int count = 0; int iWork = 0; Scanner fin = new Scanner(filename); String toName, toStreet, toCity, toState, toZip; String fromName, fromStreet, fromCity, fromState, fromZip, temp; double weight; String sWork; fin = FileUtil.openInputFile(filename); if (fin != null) { while (fin.hasNext()) { toName = fin.nextLine(); toStreet = fin.nextLine(); sWork = fin.nextLine(); iWork = sWork.indexOf(","); toCity = sWork.substring(0, iWork); iWork = iWork + 2; toState = sWork.substring(iWork, iWork + 2); iWork = iWork + 3; toZip = sWork.substring(iWork); fromName = fin.nextLine(); fromStreet = fin.nextLine(); sWork = fin.nextLine(); iWork = sWork.indexOf(","); fromCity = sWork.substring(0, iWork); iWork = iWork + 2; fromState = sWork.substring…
has title: Error with compareTo method
upvote count: 1
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/22901897

admob
tags question: http://stackoverflow.com/q/22870961
tags question: http://stackoverflow.com/q/22900635
tags question: http://stackoverflow.com/q/22848784
type: Tag
tag name: admob
tags question: http://stackoverflow.com/q/22850673

http://stackoverflow.com/comment/34807808
has text: Yep, thanks for the explaination.. :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22821905

http://stackoverflow.com/q/22907586
accepted answer: http://stackoverflow.com/a/22907725
favorite count: 0
has comment: http://stackoverflow.com/comment/34961550
tagged with: android-logcat
tagged with: android
has answer: http://stackoverflow.com/a/22907833
has answer: http://stackoverflow.com/a/22907794
score: 1
has answer: http://stackoverflow.com/a/22908093
upvote count: 1
has comment: http://stackoverflow.com/comment/34961694
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34961630
tagged with: java
answer count: 6
possible better answer: http://stackoverflow.com/a/22907768
has body: i have a update my eclipse and sdk to a newer version.the evidence of this is now when i create a new android project instead of just 1 java and 1 xml file i also create 1 fragment. my question is this why do i get an error in the appcompat_v7. is this because of appcompat_v7 because my code has no error why cant i run the app. i dont get why i have this android.content.ContextWrapper.getResources(ContextWrapper.java:89) because my code is just up to 87 lines. 04-07 04:36:57.490: E/AndroidRuntime(1176): FATAL EXCEPTION: main 04-07 04:36:57.490: E/AndroidRuntime(1176): Process: com.afield.numpad, PID: 1176 04-07 04:36:57.490: E/AndroidRuntime(1176): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.afield.numpad/com.afield.numpad.MainActivity}: java.lang.NullPointerException 04-07 04:36:57.490: E/AndroidRuntime(1176): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) 04-07 04:36:57.490: E/AndroidRuntime(1176): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 04-07 04:36:57.490: E/AndroidRuntime(1176): at android.app.ActivityThread.access$800(ActivityThread.java:135) 04-07 04:36:57.490: E/AndroidRuntime(1176): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 04-07 04:36:57.490: E/AndroidRuntime(1176): at android.os.Handler.dispatchMessage(Handler.java:102) 04-07 04:36:57.490: E/AndroidRuntime(1176): at android.os.Looper.loop(Looper.java:136) 04-07 04:36:57.490: E/AndroidRuntime(1176): at android.app.ActivityThread.main(ActivityThread.java:5017) 04-07 04:36:57.490: E/AndroidRuntime(1176): at java.lang.reflect.Method.invokeNative(Native Method) 04-07 04:36:57.490: E/AndroidRuntime(1176): at java.lang.reflect.Method.invoke(Method.java:515) 04-07 04:36:57.490: E/AndroidRuntime(1176): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 04-07 04:36:57.490: E/AndroidRuntime(1176): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:5…
has answer: http://stackoverflow.com/a/22907698
has answer: http://stackoverflow.com/a/22907768
type: Question
has title: android appcompat_v7 error logcat
has answer: http://stackoverflow.com/a/22907725
downvote count: 0

http://stackoverflow.com/q/22926354
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/34996210
tagged with: methods
type: Question
score: -2
tagged with: java
has title: how can I fix calling this array in the method?
downvote count: 2
has comment: http://stackoverflow.com/comment/34996456
has comment: http://stackoverflow.com/comment/34996205
tagged with: arrays
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22926376
has body: public int sumgrades(int[] arr_grades) { int sum = 0; for(int vals; arr_grades) { sum += vals; } return sum; } It doesn't like the arr_grades, I have this down at the bottem LectureEx lect = new LectureEx(); int[] grades = {93, 87, 78, 98, 95, 92}; int sum = lect.sumgrades(grades); any suggestions? I have more code in the program if y'all need to see that too, Thanks!
has answer: http://stackoverflow.com/a/22926376

http://stackoverflow.com/comment/34996272
type: Comment
comment on: http://stackoverflow.com/q/22917785
score: 0
type: QuestionComment
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556)

http://stackoverflow.com/comment/40473662
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22897992
has text: i can't post more quetions on this site by above question please.. i am poor in english.. here after i post clear question. please remove the badges for this question.. i don't know how to improve this question...pls

http://stackoverflow.com/q/22919206
tagged with: noclassdeffounderror
upvote count: 1
type: Question
tagged with: debugging
has title: How to debug NoClassDefFoundError originating from a 3rd party jar?
downvote count: 0
has comment: http://stackoverflow.com/comment/34983294
favorite count: 0
has comment: http://stackoverflow.com/comment/34982771
type: UnansweredQuestion
has body: I am getting NoClassDefFoundError while interacting with a 3rd party class which further does some native calls. Wanted to know what is the best way to debug such an error? Exception in thread "main" java.lang.NoClassDefFoundError: com/somelib/SomeClass at MyTest.foo(MyTest.java:28) at MyTest.main(MyTest.java:11) Caused by: java.lang.ClassNotFoundException: com.somelib.SomeClass at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 2 more
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/22963045
has body: I tested that code, and it works fine for me. The window is opened for about 2 minutes and everything works as it should. When does lag begin? When clicking buttons? Moving the window?
has comment: http://stackoverflow.com/comment/35061530
has comment: http://stackoverflow.com/comment/35062789
has comment: http://stackoverflow.com/comment/35071942
has comment: http://stackoverflow.com/comment/35158190
has comment: http://stackoverflow.com/comment/35074107
has comment: http://stackoverflow.com/comment/35169654
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35157088
answers question: http://stackoverflow.com/q/22962829
has comment: http://stackoverflow.com/comment/35061086
has comment: http://stackoverflow.com/comment/35061692
has comment: http://stackoverflow.com/comment/35061304
has comment: http://stackoverflow.com/comment/35064757
accepted answer of: http://stackoverflow.com/q/22962829
has comment: http://stackoverflow.com/comment/35063040
has comment: http://stackoverflow.com/comment/35162110
type: Answer
has comment: http://stackoverflow.com/comment/35062370
has comment: http://stackoverflow.com/comment/35064306
has comment: http://stackoverflow.com/comment/35061634
score: 2
has comment: http://stackoverflow.com/comment/35190284
has comment: http://stackoverflow.com/comment/35063851
has comment: http://stackoverflow.com/comment/35061362
has comment: http://stackoverflow.com/comment/35158730
upvote count: 2
has comment: http://stackoverflow.com/comment/35064198
has comment: http://stackoverflow.com/comment/35062923
has comment: http://stackoverflow.com/comment/35193044
has comment: http://stackoverflow.com/comment/35192379
has comment: http://stackoverflow.com/comment/35061214
has comment: http://stackoverflow.com/comment/35061195
has comment: http://stackoverflow.com/comment/35061582
has comment: http://stackoverflow.com/comment/35062600
has comment: http://stackoverflow.com/comment/35170695
has comment: http://stackoverflow.com/comment/35068564
has comment: http://stackoverflow.com/comment/35062145

http://stackoverflow.com/a/22844169
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22830601
upvote count: 1
has comment: http://stackoverflow.com/comment/34867258
score: 1
has body: Your XML is not well-formed because you need to have a single root element. Your document has two! If you place them under a single root, you will obtain a well-formed XML (but not necessarily a valid one, since that depends on how you are going to use it): &lt;root&gt; &lt;xsd:schema ...&gt; ... &lt;/xsd:schema&gt; &lt;xsd:schema ...&gt; ... &lt;/xsd:schema&gt; &lt;/root&gt; A valid way to combine the definitions in two schemas would be to include their contents in one schema, having &lt;xsd:schema&gt; as the root element: &lt;xsd:schema ...&gt; &lt;xsd:complexType ...&gt; ... &lt;/xsd:complexType&gt; &lt;xsd:element ...&gt; ... &lt;/xsd:element&gt; &lt;/xsd:schema&gt; But if it will work or not depends on your namespace definitions. If you had the same target namespaces for both schemas, you could keep them in different files and include one in the other using &lt;xsd:include&gt;. With different namespaces, as it seems to be your case, you can use &lt;xsd:import&gt; to import the qualified elements from your second schema to your first one : &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;xsd:import namespace="services/data/common" schemaLocation="your-second-schema.xsd"/&gt; &lt;xsd:complexType name="NoNamespaceType"&gt;...&lt;/xsd:complexType&gt; ... &lt;/xsd:schema&gt; That will allow you to use it to validate instances which use elements from your second schema, as long as they are qualified with a namespace: &lt;d:request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="your-first-schema.xsd" xmlns:d="services/data/common"&gt; &lt;d:header&gt;&lt;/d:header&gt; &lt;d:body&gt;&lt;/d:body&gt; &lt;/d:request&gt; as well as unqualified elements that use the no-namespace schema: &lt;noNamespace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="your-first-schema.xsd"&gt; &lt;firstElement&gt;&lt;/firstElement&gt; &lt;secondElement&gt;&lt;/secondElement&gt; &lt;/noNamespace&gt;
accepted answer of: http://stackoverflow.com/q/22830601
type: AcceptedAnswer

http://stackoverflow.com/q/22958518
has comment: http://stackoverflow.com/comment/35060821
tagged with: opengl-es-2.0
has comment: http://stackoverflow.com/comment/35060570
tagged with: android
linked to: http://stackoverflow.com/q/22997256
tagged with: vbo
has title: Switching to use Interleaved VBO's - compiles but nothing is drawn - opengl es 2.0
accepted answer: http://stackoverflow.com/a/23081473
has comment: http://stackoverflow.com/comment/35114561
type: AnsweredQuestion
tagged with: rendering
tagged with: java
has comment: http://stackoverflow.com/comment/35099453
type: Question
has comment: http://stackoverflow.com/comment/35102067
score: 0
has comment: http://stackoverflow.com/comment/35078693
has answer: http://stackoverflow.com/a/23081473
answer count: 1
has body: I have just tried switching to use Interleaved VBOs. I have stepped through the process of creating the Interleaved VBO and it appears that it has the correct information init. VVV NNN TT etc. Here is the code for initialising the buffer VertexBuffer = Loader.vertexBuffer; final int buffers[] = new int[1]; GLES20.glGenBuffers(1, buffers, 0); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, buffers[0]); GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, VertexBuffer.capacity(), VertexBuffer, GLES20.GL_STATIC_DRAW); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0); mBufferIdx = buffers[0]; VertexBuffer.limit(0); VertexBuffer = null; and here is my code for drawing the model final int stride = (mPositionDataSize + mNormalDataSize + mTextureCoordinateDataSize) * mBytesPerFloat; // Pass in the position information GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mBufferIdx); GLES20.glEnableVertexAttribArray(mPositionHandle); GLES20.glVertexAttribPointer(mPositionHandle, mPositionDataSize, GLES20.GL_FLOAT, false, stride, 0); // Pass in the normal information GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mBufferIdx); GLES20.glEnableVertexAttribArray(mNormalHandle); GLES20.glVertexAttribPointer(mNormalHandle, mNormalDataSize, GLES20.GL_FLOAT, false, stride, mPositionDataSize * mBytesPerFloat); // Pass in the texture information GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mBufferIdx); GLES20.glEnableVertexAttribArray(mTextureCoordinateHandle); GLES20.glVertexAttribPointer(mTextureCoordinateHandle, mTextureCoordinateDataSize, GLES20.GL_FLOAT, false, stride, (mPositionDataSize + mNormalDataSize) * mBytesPerFloat); // Clear the currently bound buffer (so future OpenGL calls do not use this buffer). GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0); // Draw . GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, NumVertices); I left the matrices work out as this worked before using VBOs and i am seeting all the handles correctly. My app appears to run as if the models are there but just invisible. for example i …
has comment: http://stackoverflow.com/comment/35060146

templates
tags question: http://stackoverflow.com/q/22951276
tag name: templates
tags question: http://stackoverflow.com/q/22924619
type: Tag
tags question: http://stackoverflow.com/q/22924831

http://stackoverflow.com/q/22895553
has comment: http://stackoverflow.com/comment/34958375
type: Question
has answer: http://stackoverflow.com/a/22908333
has title: Spring security with different type of sessions
answer count: 1
has comment: http://stackoverflow.com/comment/34945964
tagged with: spring-security
accepted answer: http://stackoverflow.com/a/22908333
has body: I'm using spring security 3.1.4 and I have the following problem. In one web app I have 2 types of users with different custom "UserDetails" instance. How do I differentiate between the users in the implementation of UserDetailsService.loadUserByUsername. Can I have 2 UserDetailsServiceImpl and know when to use each one?
tagged with: spring
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/q/22829654
score: 0
tagged with: javascript
has title: how to send the array to servlet and save to the database
answer count: 4
has answer: http://stackoverflow.com/a/22829757
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22829835
has comment: http://stackoverflow.com/comment/34821252
has answer: http://stackoverflow.com/a/22829725
has body: i had a function it contains an array.my problem is how to send the values which are in array to java.class file this is my code function sales_det(){ var salDet=document.getElementsByClassName("sales_details"); //console.log(salDet.length); for (var i = 0; i &lt; salDet.length; i++) { var sal=salDet[i].getElementsByTagName("td"); window["array_"+i] = []; window["array_"+i].push(sal[0].textContent,sal[1].textContent,sal[2].textContent,sal[3].textContent); console.log(window["array_"+i]); } }
tagged with: java
has answer: http://stackoverflow.com/a/22830111
type: Question

http://stackoverflow.com/a/22892637
has body: What you are looking for is a simple linear interpolation between the two positions. To achieve this, you can use libgdx's provided lerp(...) method. If you want to calculate the positions inbetween CAM_POSITION_DEFAULT and CAM_POSITION_TOP, you just need to interpolate between the two vectors: Vector3 inbetween = CAM_POSITION_DEFAULT.lerp(CAM_POSITION_TOP, alpha); If you provide a value of alpha=0, you will get CAM_POSITION_DEFAULT returned, if you provide alpha=1, you will get CAM_POSITION_TOP... alpha=0.5f will therefore be the point directly in the middle of the two positions... The trick now is how to choose the alpha value for a smooth transition that takes a defined amount of seconds: class CameraTransition { private final Vector3 startPos; private final Vector3 goalPos; private final float duration; private float stateTime = 0.0f; public CameraTransition(final Vector3 startPos, final Vector3 goalPos, float duration) { this.startPos = startPos; this.goalPos = goalPos; this.duration = duration; } public Vector3 act(float delta) { stateTime += delta; return startPos.lerp(goalPos, MathUtils.clamp(stateTime/duration, 0.0f,1.0f)); } } So you could use this code (not tested, sorry)... Create a new CameraTransition and set the duration. Then within your render(float delta) you just have to call the act() method and pass the delta time. Of course you should only call the act() method when you want the transition to run. Hope this helps... :) UPDATE: After seeing that you are looking for a smooth transition which starts slowly and ends slowly, I have changed the interpolation to something that uses a smoother curve instead of linear interpolation: class CameraTransition { private final Vector3 startPos; private final Vector3 goalPos; private final float duration; private float stateTime = 0.0f; private float alpha; public CameraTransition(final Vector3 startPos, final Vector3 goalPos, float duration) { this.startPos = startPos; this.goalPos = goalPos; this.duration = …
has comment: http://stackoverflow.com/comment/34959119
answers question: http://stackoverflow.com/q/22892251
has comment: http://stackoverflow.com/comment/34963776
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34935860
accepted answer of: http://stackoverflow.com/q/22892251
type: Answer
has comment: http://stackoverflow.com/comment/34935196
has comment: http://stackoverflow.com/comment/34964329
upvote count: 3
has comment: http://stackoverflow.com/comment/34936312
score: 3
has comment: http://stackoverflow.com/comment/34964093

http://stackoverflow.com/comment/34998116
comment on: http://stackoverflow.com/q/22927321
type: Comment
type: QuestionComment
score: 1
has text: check the implementation of height method?

http://stackoverflow.com/q/22813539
type: UnansweredQuestion
has title: Spring Data JPA - repository findAll method using flag column
downvote count: 0
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/34793147
has comment: http://stackoverflow.com/comment/34792544
type: Question
score: 17
has body: I want to use the method findAll in a repository, but I`d like it to return just entities which have a certain value. For example, I want it to return just entities which are active = 1. Is there a way to do that? Now I have to write for all my repositories something like this: @Query("select p from Parameter p where p.active = 1") public List&lt;Parameter&gt; findAll(); Instead of using the findOne method I have to write this in all my repositories: @Query("select p from Parameter p where p.active = 1 and p.id=?1") public Parameter findById(Long id); Is there a better way to apply a blanket filter to all queries?
tagged with: spring-data-jpa
answer count: 1
upvote count: 17
has answer: http://stackoverflow.com/a/22843186
has comment: http://stackoverflow.com/comment/34792145

http://stackoverflow.com/q/22893996
has comment: http://stackoverflow.com/comment/34937470
has title: Fastest collection for concurrent read and write other than Java Collections
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/34937140
has body: I have a requirement to store Strings into a collections. The Collection will hold billions of strings. The collection must support fast look up, add , delete in a concurrent manner. Is there any know fast, low latency collections available besides Java collections... I searched but didn't come across anything interesting...
has answer: http://stackoverflow.com/a/22894453
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22894453
has comment: http://stackoverflow.com/comment/34937240
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34937329
has comment: http://stackoverflow.com/comment/34937077
has comment: http://stackoverflow.com/comment/34937169
tagged with: java

http://stackoverflow.com/a/22842538
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/34844035
score: -1
downvote count: 1
has body: you can create another array of String with the n elements which u want in that new array and then return that array.
answers question: http://stackoverflow.com/q/22842299

http://stackoverflow.com/a/22949911
upvote count: 1
has body: You've pretty much got it. Create a temporary, uninitialized variable Basketball temp; before the for loop that iterates through the bbArray and then set it equal to the bbArray[index] if the if condition is met. If you want to save the index it was found at then create an int indexFound; as well. Looping through it backwards as user2651804 suggested yields this: public class basketballObj { public static void main(String[] args) { ... Basketball temp; int indexFound = -1; ... for(index = bbArray.length - 1; index &gt;= 0; index++) { if(bbArray[index].getPoints() % 2 == 0) { temp = bbArray[index]; indexFound = index; break; } } //note temp will be null if no scores were even //if (temp != null) //you can use the above if statement if you don't want to use indexFound //you can also just check if indexFound == -1 if (indexFound != -1) { System.out.println("Found at index: " + indexFound); // } } }
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22949753

http://stackoverflow.com/a/23967094
has comment: http://stackoverflow.com/comment/37365919
type: Answer
has comment: http://stackoverflow.com/comment/37326409
has comment: http://stackoverflow.com/comment/37361332
has comment: http://stackoverflow.com/comment/37332348
has comment: http://stackoverflow.com/comment/37380588
has comment: http://stackoverflow.com/comment/37363331
score: 0
has comment: http://stackoverflow.com/comment/37377696
has comment: http://stackoverflow.com/comment/37325887
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22966731
has comment: http://stackoverflow.com/comment/37371439
answers question: http://stackoverflow.com/q/22966731
has body: 1. Check following Stack Overflow answers (and its many duplicate links) Compiling a java program into an executable. You should find suitable tools that will allow you to create an easy to deploy form of your application, e.g. *.exe for Windows with all the necessary run-time libraries optionally included. 2. For inspiration of how such deployment might work (either run through the web browser click or easy to download/run installer) check yWorks yED. If you like their way you may send them an "share your know how" e-mail

http://stackoverflow.com/comment/34897932
has text: You are running into issues with *precision*.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22872260

http://stackoverflow.com/q/22919229
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22949703
score: 3
upvote count: 3
tagged with: java
has title: How do I deal with greedy write locking in MongoDB?
has body: My question - is there a way to read and write to the MongoDB simultaneously? Or make MongoDB reader greedy? I have a web application that uses MongoDB for the database. In my application, I have a Serial Event that I am listening for. On this Serial Event, I create a new thread to deal with the event. In the thread, the string from serial is parsed and an object is created then written to the mongo database (a new document is created and added into a specific collection). However, while this serial event is occurring, I am trying to also read from the database and update a graph to show the new incoming data from this collection. The problem is that because MongoDB is writer greedy (see http://docs.mongodb.org/manual/faq/concurrency/), it appears that the reads are never being allowed to occur. My serial events are happening about 2/3 times a second. And my reading is happening about 2 times a second as well. The data needs to stay written to a database so that all clients can have access to it, not just the client receiving the Serial event. So my question is, is there a way to allow my reads through? Can I change the lock on MongoDB to be reader greedy? Or is there a way I can read and write at the same time without compromising speed? Is sharding a way around this problem (I do not know a lot about sharding so not sure if this would fix my problem)? If you want any code posted up let me know! Any comments or workarounds would be greatly appreciated!
type: Question
tagged with: mongodb
tagged with: locking
downvote count: 0
tagged with: readwritelock
tagged with: read-write
answer count: 1

http://stackoverflow.com/a/22962906
has body: you cannot instantiate an interface if we suppose you mean a parent class, in the first case you cannot the access method(s) of class b Suppose you have these classes: public class a { //some methods } public class b extends a { //some methods type method1(args) {...} } What would be the difference between? a asd=new b(); // you cannot call method1 using asd and b asf=new b();
type: Answer
answers question: http://stackoverflow.com/q/22962856
score: 0

http://stackoverflow.com/comment/35053984
has text: Yes, location updates will refresh getLastKnownLocation results, also you can store onLocationChanger param in some variable and use it when you need without getLastKnownLocation method.
type: Comment
comment on: http://stackoverflow.com/a/22958321
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34845786
comment on: http://stackoverflow.com/q/22843596
score: 0
type: QuestionComment
type: Comment
has text: The `EntityManager` is not being injected because it's not being created. Looks like your persistence.xml file has a problem.

http://stackoverflow.com/q/22922529
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27986024
tagged with: java
upvote count: 1
tagged with: eclipse
downvote count: 1
type: Question
has body: I have an Android Project, and I would like to create a similar application. But the only difference between both apps is only on the Application Name, The style, Colors and drawables. Thus, the Java code is the same, but the resources are partially different. My target is to have something like this: 1 - Shared Project with the complete logic. 2 - The first extension of the Shared project: Overwrite the style.xml, color.xml, drawable/*and string.xml. 3 - The Second extension of the Shared project: Overwrite the style.xml, color.xml, drawable/* and string.xml
possible better answer: http://stackoverflow.com/a/22923349
has answer: http://stackoverflow.com/a/22923349
accepted answer: http://stackoverflow.com/a/27986024
score: 0
answer count: 2
has title: Shared android project Eclipse
has comment: http://stackoverflow.com/comment/34989486
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/35009239
tagged with: android
has comment: http://stackoverflow.com/comment/35064392

http://stackoverflow.com/comment/34839534
type: AnswerComment
has text: i tried that way too, but then my broj1clicked isnt recognised
type: Comment
comment on: http://stackoverflow.com/a/22840238
score: 0

http://stackoverflow.com/comment/34931424
score: 0
type: Comment
has text: am I ? I never heard about REST framework but I want to know about that. Please give me some information or link. :)
comment on: http://stackoverflow.com/a/22889865
type: AnswerComment

http://stackoverflow.com/comment/35026815
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22942248
has text: I use the following code Runtime rt = Runtime.getRuntime(); String[] commands = {"curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{“Comments“:”Hello”' http://julesserivce-int.iil.intel.com/JuleSService.svc/submit}; Process proc = rt.exec(commands);
type: Comment

http://stackoverflow.com/q/22824675
has comment: http://stackoverflow.com/comment/34812494
type: UnansweredQuestion
tagged with: android
tagged with: php
has comment: http://stackoverflow.com/comment/34812370
answer count: 0
has title: Converting a Bitmap to a String and saving it in a mySQL server
tagged with: java
tagged with: mysql
type: Question
score: 0
has body: My program takes a bitmap and converts it to a string, then saves that string in a myswl through php. I am not getting any response from my server which includes not getting an error. Here is the JAVA portion: ByteArrayOutputStream bos = new ByteArrayOutputStream(); proPic.compress(Bitmap.CompressFormat.JPEG, 100, bos); byte[] data = bos.toByteArray(); String image = Base64.encodeToString(data, Base64.DEFAULT); entity.addPart("tag", new StringBody("register")); entity.addPart("name", new StringBody(name)); entity.addPart("email", new StringBody(email)); entity.addPart("password", new StringBody(password)); entity.addPart("image", new StringBody(image)); Here is the php part: $name = $_POST['name']; $stringPic = $_POST['image']; $email=$_POST['email']; $password=$_POST['password']; $profilePic=base64_decode($stringPic);
has comment: http://stackoverflow.com/comment/34813331

http://stackoverflow.com/q/22880758
has comment: http://stackoverflow.com/comment/34913357
possible better answer: http://stackoverflow.com/a/22880789
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34913311
tagged with: java
has title: implementation formula volume of a sphere with Java and JUnit?
has body: I have to make an implementation to calculate volume of a sphere to be checked with JUnit test, but there are some errors. The formula is correct, but when I test it, it doesn't work : class VolumeSphere.java public class VolumeSphere { public static double volsph(double j) { double volume; double const = 1.33; double phi = 3.14; volume = const * phi * (j * j * j); return volume; } } and then this the test file : VolumeSphereTest.java import junit.framework.*; public class VolumeSphereTest extends TestCase { public VolumeSphereTest(String name) { super(name); } public void testSimple() { assertEquals(33.4096, VolumeSphere.volsph(2.0)); } } when I run the JUnit test, it's said "Expected: (33.4096) but was: (33.4096000005)." So, what should I do? Thankyou in advance for the help!
has answer: http://stackoverflow.com/a/22880894
type: Question
has answer: http://stackoverflow.com/a/22880815
has comment: http://stackoverflow.com/comment/34913278
has comment: http://stackoverflow.com/comment/34913317
accepted answer: http://stackoverflow.com/a/22880815
score: 0
has comment: http://stackoverflow.com/comment/34913669
has comment: http://stackoverflow.com/comment/34913385
answer count: 3
has comment: http://stackoverflow.com/comment/34913234
tagged with: junit
has comment: http://stackoverflow.com/comment/34913484
has answer: http://stackoverflow.com/a/22880789
has comment: http://stackoverflow.com/comment/34913263
has comment: http://stackoverflow.com/comment/34913441

http://stackoverflow.com/q/22957431
linked to: http://stackoverflow.com/q/38922754
tagged with: arrays
tagged with: date
has answer: http://stackoverflow.com/a/22958073
has answer: http://stackoverflow.com/a/49503213
has comment: http://stackoverflow.com/comment/35054559
score: 0
has answer: http://stackoverflow.com/a/22980774
has comment: http://stackoverflow.com/comment/35094720
has answer: http://stackoverflow.com/a/22958446
has title: Subtraction of Date and time
has answer: http://stackoverflow.com/a/22958003
has body: I am trying to subtract the date and time of two consecutive lines from a file, like doing: String result1=line2-line1; String result2=line4-line3; // and so on......... A sample file content could be the following: Thu Jan 16 2014 16:59:43.5020 Thu Jan 16 2014 16:59:43.5020 Thu Jan 16 2014 16:59:43.5020 Thu Jan 16 2014 16:59:43.5090 Thu Jan 16 2014 16:59:43.5100 Thu Jan 16 2014 16:59:43.5100 Thu Jan 16 2014 16:59:43.5170 Thu Jan 16 2014 16:59:43.9190 Thu Jan 16 2014 16:59:43.9200 Thu Jan 16 2014 16:59:43.9200 Thu Jan 16 2014 16:59:43.9200 Thu Jan 16 2014 16:59:43.9210 Thu Jan 16 2014 16:59:43.9210 Thu Jan 16 2014 16:59:43.9210 Thu Jan 16 2014 16:59:43.9210 Thu Jan 16 2014 16:59:43.9210 Thu Jan 16 2014 16:59:43.9220 Thu Jan 16 2014 16:59:43.9290 Thu Jan 16 2014 16:59:43.9290 Thu Jan 16 2014 16:59:43.9290 Thu Jan 16 2014 16:59:43.9330 Thu Jan 16 2014 16:59:44.0210 Thu Jan 16 2014 16:59:44.0210 Thu Jan 16 2014 16:59:44.0210
answer count: 5
linked to: http://stackoverflow.com/q/1555262
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35051817
tagged with: java
possible better answer: http://stackoverflow.com/a/22958446
accepted answer: http://stackoverflow.com/a/22958073
type: Question
has comment: http://stackoverflow.com/comment/35051535

http://stackoverflow.com/a/22847432
downvote count: 0
score: 1
has body: readMessage variable should contain text only with numbers, "-" sign or point, so "121" or "13.5" or "-5". If there is a string with other symbol, NumberFormatException occurs. Just see (by Log.d for instance), what is in readMessage variable before parsing
has comment: http://stackoverflow.com/comment/34853232
has comment: http://stackoverflow.com/comment/34853348
accepted answer of: http://stackoverflow.com/q/22847328
answers question: http://stackoverflow.com/q/22847328
has comment: http://stackoverflow.com/comment/34853304
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34853045
has comment: http://stackoverflow.com/comment/34853149
has comment: http://stackoverflow.com/comment/34900405
type: Answer
has comment: http://stackoverflow.com/comment/34900155

http://stackoverflow.com/comment/35001902
comment on: http://stackoverflow.com/a/22924892
type: Comment
score: 0
type: AnswerComment
has text: Now its clear from your new code as @MadProgrammer has already answered.

http://stackoverflow.com/q/22876963
answer count: 5
has answer: http://stackoverflow.com/a/22877135
has comment: http://stackoverflow.com/comment/34908241
has answer: http://stackoverflow.com/a/22877071
type: AnsweredQuestion
tagged with: java
tagged with: collections
possible better answer: http://stackoverflow.com/a/22876996
type: Question
has comment: http://stackoverflow.com/comment/34908147
score: 4
has title: ConcurrentModificationException while using PriorityQueue
has answer: http://stackoverflow.com/a/22877033
upvote count: 4
accepted answer: http://stackoverflow.com/a/22877135
downvote count: 0
has answer: http://stackoverflow.com/a/22876996
favorite count: 0
has body: I am using a for-each loop to iterate over a PriorityQueue and trying to poll it. Why am I getting java.util.ConcurrentModificationException?. Where am I modifying 'concurrently' as the Exception name implies? Is assigning itself a modification as it internally uses poll()? Please explain. Snippet: String[] sa = {"&gt;ff&lt;", "&gt; f&lt;", "&gt;f &lt;", "&gt;FF&lt;"}; //This code demonstrates that white spaces come before capital letters and //capital letters come before the small letters in natural ordering PriorityQueue&lt;String&gt; pq = new PriorityQueue&lt;String&gt;(); for (String str : sa) { pq.offer(str); } System.out.println(pq); for (String str : pq) { System.out.print(pq.poll() + " "); } } Edit: As I understand from the explanations given below, each poll() method invocation causes the size of the PriorityQueue object to change. So, it makes sense to throw an exception while iterating and trying to poll(varying the size constantly). Hence the pq object is throwing an exception which is a misnomer. Is my understanding correct?
has answer: http://stackoverflow.com/a/22877216

http://stackoverflow.com/q/22931213
has body: We need our protobuf messages to contain as little data as possible. So what are the best practices we can follow in order to gain the maximum out of it. As an example writing byte[] as a String or ByteString ? What makes the difference? And adding a list of Integers as a repeated list or something else ?
answer count: 1
score: 0
tagged with: protocol-buffers
accepted answer: http://stackoverflow.com/a/22931301
has title: Best Practice for Writing Data Using protobuf
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22931301

http://stackoverflow.com/comment/51986387
type: Comment
comment on: http://stackoverflow.com/a/31273658
has text: You are absolutely correct Insac, finally after facing lot of issues with Teradata with OLTP application we have to Oracle.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22853390
favorite count: 0
has comment: http://stackoverflow.com/comment/34864730
has title: Tab as a delimiter(StringTokenizer) not taking as an argument
has answer: http://stackoverflow.com/a/23562257
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34864108
tagged with: delimiter
has comment: http://stackoverflow.com/comment/34864891
downvote count: 2
has body: I have seen several post regarding this.But they tell about split not StringTokenizer. This is my input file:inputfile with tab delimiter I wrote stringTokenizer to get each value in a line.So I am able to get 1.0 3.0 delim1.0 delim3.0 so on But when I tried to take delimiter as an argument it is not working fine for me. while ((sCurrentLine = br.readLine()) != null) { System.out.println(sCurrentLine); StringTokenizer st = new StringTokenizer(sCurrentLine, args[0]); while(st.hasMoreTokens()){ System.out.println("delim"+st.nextToken()); } } 1.passed " " (by pressing "Tab" key in keyboard)as an argument ,It is working fine. 2.passed "\t" as an argument.It is showing 1.0 3.0 delim1.0 3.0 3.passed \t as an argument.It is showing the same 1.0 3.0 delim1.0 3.0 Why is it so.
has comment: http://stackoverflow.com/comment/34863892
upvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34863983
score: -1
has comment: http://stackoverflow.com/comment/34864166
has comment: http://stackoverflow.com/comment/34864251
tagged with: stringtokenizer
has comment: http://stackoverflow.com/comment/34864780
has comment: http://stackoverflow.com/comment/34864395
has comment: http://stackoverflow.com/comment/34864834
has comment: http://stackoverflow.com/comment/34864085
answer count: 1
has comment: http://stackoverflow.com/comment/34864590

http://stackoverflow.com/comment/34949118
score: 1
comment on: http://stackoverflow.com/q/22900456
type: Comment
type: QuestionComment
has text: Those are fields, not properties; you cannot write code in the setters / getters.

http://stackoverflow.com/q/22917518
has answer: http://stackoverflow.com/a/22920206
favorite count: 0
has title: Create a HashSet By Enumeration
has answer: http://stackoverflow.com/a/22931617
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22921278
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22920206
type: Question
has body: I have class : @Entity @Table(name = "PROJECT_INDICATOR") public class Project_Indicator { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @NotNull @ManyToOne private Indicator indicator; @NotNull @ManyToOne private Project project; @NotNull private int year; // here I want create List (HashSet) with enumeration of months public long getId() { return id; } public void setId(long id) { this.id = id; } public Indicator getIndicator() { return indicator; } public void setIndicator(Indicator indicator) { this.indicator = indicator; } public Project getProject() { return project; } public void setProject(Project project) { this.project = project; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } } This Project_Indicator class must contain an attribute wish is a List of months (jan until december) I want create a list with keys are (jan until dec) and each month have an attribute for example int value, then I want to do this : int value=mySet.get("July"); please just I want an idea (or other Idea) if you understood my problem. Thanx.
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/22921278
has answer: http://stackoverflow.com/a/22922755
upvote count: 1

mysql
tags question: http://stackoverflow.com/q/22904438
tags question: http://stackoverflow.com/q/22893151
tags question: http://stackoverflow.com/q/22819887
tags question: http://stackoverflow.com/q/22831625
tags question: http://stackoverflow.com/q/22849916
tags question: http://stackoverflow.com/q/22925908
tags question: http://stackoverflow.com/q/22882341
tags question: http://stackoverflow.com/q/22824675
tags question: http://stackoverflow.com/q/22964314
tags question: http://stackoverflow.com/q/22966187
tags question: http://stackoverflow.com/q/22831895
tags question: http://stackoverflow.com/q/22870628
tags question: http://stackoverflow.com/q/22890243
tags question: http://stackoverflow.com/q/22835493
tags question: http://stackoverflow.com/q/22962763
tags question: http://stackoverflow.com/q/22949908
tags question: http://stackoverflow.com/q/22886960
tag name: mysql
tags question: http://stackoverflow.com/q/22954787
tags question: http://stackoverflow.com/q/22866197
tags question: http://stackoverflow.com/q/22845543
tags question: http://stackoverflow.com/q/22826191
tags question: http://stackoverflow.com/q/22960787
tags question: http://stackoverflow.com/q/22920063
tags question: http://stackoverflow.com/q/22854316
tags question: http://stackoverflow.com/q/22938817
tags question: http://stackoverflow.com/q/22809340
tags question: http://stackoverflow.com/q/22836822
tags question: http://stackoverflow.com/q/22820869
tags question: http://stackoverflow.com/q/22945562
tags question: http://stackoverflow.com/q/22930456
tags question: http://stackoverflow.com/q/22830143
tags question: http://stackoverflow.com/q/22906216
tags question: http://stackoverflow.com/q/22909545
tags question: http://stackoverflow.com/q/22886133
tags question: http://stackoverflow.com/q/22822878
tags question: http://stackoverflow.com/q/22894499
tags question: http://stackoverflow.com/q/22818062
tags question: http://stackoverflow.com/q/22824806
tags question: http://stackoverflow.com/q/22928214
tags question: http://stackoverflow.com/q/22926676
tags question: http://stackoverflow.com/q/22947010
tags question: http://stackoverflow.com/q/22933080
tags question: http://stackoverflow.com/q/22862157
tags question: http://stackoverflow.com/q/22879001
tags question: http://stackoverflow.com/q/22954091
tags question: http://stackoverflow.com/q/22893914
tags question: http://stackoverflow.com/q/22925639
tags question: http://stackoverflow.com/q/22910078
tags question: http://stackoverflow.com/q/22968044
tags question: http://stackoverflow.com/q/22855525
tags question: http://stackoverflow.com/q/22910949
tags question: http://stackoverflow.com/q/22832987
tags question: http://stackoverflow.com/q/22933786
tags question: http://stackoverflow.com/q/22945862
tags question: http://stackoverflow.com/q/22822264
tags question: http://stackoverflow.com/q/22893156
tags question: http://stackoverflow.com/q/22864183
tags question: http://stackoverflow.com/q/22897006
tags question: http://stackoverflow.com/q/22822013
type: Tag
tags question: http://stackoverflow.com/q/22928173
tags question: http://stackoverflow.com/q/22905514
tags question: http://stackoverflow.com/q/22902065
tags question: http://stackoverflow.com/q/22954432
tags question: http://stackoverflow.com/q/22909438
tags question: http://stackoverflow.com/q/22882771
tags question: http://stackoverflow.com/q/22828995
tags question: http://stackoverflow.com/q/22909490
tags question: http://stackoverflow.com/q/22884442
tags question: http://stackoverflow.com/q/22863357
tags question: http://stackoverflow.com/q/22906025
tags question: http://stackoverflow.com/q/22895495
tags question: http://stackoverflow.com/q/22960707
tags question: http://stackoverflow.com/q/22862727
tags question: http://stackoverflow.com/q/22810323
tags question: http://stackoverflow.com/q/22881053
tags question: http://stackoverflow.com/q/22873205
tags question: http://stackoverflow.com/q/22920371
tags question: http://stackoverflow.com/q/22936487

http://stackoverflow.com/a/65529342
score: 0
has body: You need set other kind event of notify on serialPorts[i].notifyO.... such as: serialPort.notifyOnRingIndicator(true)
type: Answer
answers question: http://stackoverflow.com/q/22918280

spring-transactions
tags question: http://stackoverflow.com/q/22910243
tags question: http://stackoverflow.com/q/22966886
type: Tag
tags question: http://stackoverflow.com/q/22836854
tag name: spring-transactions
tags question: http://stackoverflow.com/q/22862006

http://stackoverflow.com/comment/34868451
score: 0
type: AnswerComment
has text: The result is a `Stream` though, not an array
type: Comment
comment on: http://stackoverflow.com/a/22856009

http://stackoverflow.com/a/22962743
downvote count: 0
score: 5
has body: The compiler always makes the choice to use the most specific method. In the first case, because the number of the arguments exactly matches void method(int x), it is the one that's being called. In the second case, the number of the arguments don't match any case, and it can be called from both methods, resulting the ambiguity. Check the JLS - 15.12.2. Compile-Time Step 2: Determine Method Signature for details.
type: AcceptedAnswer
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/22962484
answers question: http://stackoverflow.com/q/22962484

http://stackoverflow.com/q/22936404
favorite count: 0
has comment: http://stackoverflow.com/comment/35015302
has answer: http://stackoverflow.com/a/22939982
has comment: http://stackoverflow.com/comment/35017314
tagged with: surefire
tagged with: maven
upvote count: 1
type: AnsweredQuestion
tagged with: junit4
has comment: http://stackoverflow.com/comment/35016468
has comment: http://stackoverflow.com/comment/35016165
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35015394
type: Question
has comment: http://stackoverflow.com/comment/35014717
has title: Why is my @AfterClass method called multiple times?
downvote count: 0
has comment: http://stackoverflow.com/comment/35015387
accepted answer: http://stackoverflow.com/a/22939982
has body: For testing REST services I have built a base class 'RestTestBase' that fires up an embedded Jetty server: class RestTestBase { protected static AnnotationConfigWebApplicationContext rootCtx; protected static AnnotationConfigWebApplicationContext webCtx; private static Server jettyServer; @BeforeClass public static void initSpringAndJetty() { if(jettyServer == null) { // init jetty and spring } } @AfterClass public static void shutdownJetty() { if(jettyServer!=null && jettyServer.isRunning()) { // shutdown jetty and stop spring contexts } } } When I run this in a single-threaded environment from the Eclipse IDE, all is fine. Jetty and Spring are initialized only once, then all my tests run, then jetty is shut down. However, when I run it in a multithreaded environment with Maven Surefire, the Jetty server is reinitialized for every single test. Why is that? This is my surefire configuration: org.apache.maven.plugins maven-surefire-plugin 0 true
answer count: 1
linked to: http://stackoverflow.com/q/22939226
has comment: http://stackoverflow.com/comment/35016621

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/22940778

http://stackoverflow.com/q/22824817
linked to: http://stackoverflow.com/q/21618830
tagged with: swing
answer count: 1
tagged with: java
type: UnansweredQuestion
has title: Updating JTextField every second
tagged with: user-interface
tagged with: timer
type: Question
has answer: http://stackoverflow.com/a/22824851
has comment: http://stackoverflow.com/comment/34815189
has body: I have this simple GUI for a time registration application As the GUI is used for time registration, I'd like it to show a timer that runs as you press "Start" until you press "Stop". Currently the two methods are done like this: private void trStartBtnActionPerformed(java.awt.event.ActionEvent evt) { trStartBtn.setEnabled(false); trStopBtn.setEnabled(true); startTime = System.nanoTime(); } private void trStopBtnActionPerformed(java.awt.event.ActionEvent evt) { endTime = System.nanoTime(); trStartBtn.setEnabled(true); trStopBtn.setEnabled(false); // Opgave Navn String taskName = JOptionPane.showInputDialog( this, "Task name", "Time Registration", JOptionPane.INFORMATION_MESSAGE); // Tiden det tog long result = endTime - startTime; double seconds = (double) result / 1000000000; int minutes = (int)seconds / 60; int hours = minutes / 60; String time = hours + ";" + minutes + ";" + (int) seconds; // Dags Dato DateFormat format = new SimpleDateFormat("dd/MM/yyyy"); Date today = new Date(); String date = format.format(today); DefaultTableModel m = (DefaultTableModel)trTable.getModel(); Object[] data = {date,time,taskName}; m.addRow(data); trScrollPane.repaint(); } But how would I add functionality so that the timer up to the right will tick every second as to show the time as you use the program? It's been a while and I am a bit rusty at Swing. I know that making a thread to take care of it is not safe.
score: 0

http://stackoverflow.com/comment/35068090
has text: Angelo Immediata thank you it works
type: Comment
comment on: http://stackoverflow.com/q/22966666
score: 0
type: QuestionComment

http://stackoverflow.com/q/22872038
has body: I have a Jersey Web Service with the following signature: @POST @Consumes(MediaType.APPLICATION_JSON) public Response save(Student a) {...} I want to make a POST request in my java code using org.apache.http.client.HttpClient and pass a Student object. How can I go about doing this? I found plenty of examples that post a string as namedvaluepair. But not so clear on how a custom object can be posted. Suggestions? Thanks in advance.
has answer: http://stackoverflow.com/a/22872110
score: 0
tagged with: java
type: Question
tagged with: jersey
has title: How to post an object to Jersey Rest Service
tagged with: rest
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/42886279
type: Comment
has text: Doing Step 4 and changing the spring-core to 'compile' solved the issue for me. A mix and match of this answer with this http://stackoverflow.com/questions/25488194/cannot-access-org-springframework-core-env-environmentcapable
comment on: http://stackoverflow.com/a/22956610
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34820678
comment on: http://stackoverflow.com/q/22828525
score: 0
has text: Hi RC, the given example is not working. Could you please let me know if you have any other solution. I tried in the following way. In Java as System.setProperty("processDir","C:\\CABS_Exstream\\logTest"); In properties file as log4j.appender.cabsLoggerTestRoll.File=${processDir}/test.log
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22918471
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has body: I plan on reading several files when my app/game is created and using the information from them for the entirety of the app. I also have to write to the file at one point. I have two files. One is a 2-column text file that I'll turn into a dictionary for fast searching. The other is a text file that has 11 columns. I'll make a dictionary out of two of the columns, and the other data I need kept as is so I can write to the columns to count the amount of times something happens in different circumstances for datamining. Currently, I've turned the second file into a list of a list of strings, or List>. I can't figure out how to pass that around in intents. ".putStringArrayListExtra" only works for a list of strings. Am I going about this the wrong way entirely? This is my first real Android app.
tagged with: android
has title: Android Intents and Lists
linked to: http://stackoverflow.com/q/6087198
linked to: http://stackoverflow.com/q/3132853
has answer: http://stackoverflow.com/a/22918536
accepted answer: http://stackoverflow.com/a/22918536
upvote count: 1
tagged with: android-intent
has comment: http://stackoverflow.com/comment/34981130
type: AnsweredQuestion
tagged with: list
score: 1
tagged with: java

http://stackoverflow.com/comment/34849257
score: 2
has text: "*this is one of the Java Problems my professor gave me and I needed to accomplish this by not using other layouts (such as CardLayout) and I should use the null layout only.*" That is a ridiculous and fruitless assignment. I'll apologize for the Professor. Sorry!
comment on: http://stackoverflow.com/q/22845506
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35095614
type: QuestionComment
comment on: http://stackoverflow.com/q/22968044
has text: @NeilStockton sorry if I was unclear. I will update my question with clarification, but I mean I am running a SQL query from `PersistenceManager.newQuery("javax.jdo.query.SQL", "SELECT * FROM ...")`.
score: 0
type: Comment

http://stackoverflow.com/comment/34917833
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22883044
has text: You also need to change the type of `employee` from `int` to `String`.

http://stackoverflow.com/q/22911435
type: Question
tagged with: arrays
accepted answer: http://stackoverflow.com/a/22911613
tagged with: while-loop
answer count: 1
has title: The while loop is changing intended values for unknown reason
favorite count: 0
score: 0
upvote count: 1
has body: I'm new to coding and was working on making a condition for an array, but the while loop condition I've set up for some reason changes the array when it shouldn't have. I'm sorry if this is something obvious, but I couldn't seem to find an question here that applied to my problem. The code: import java.util.Scanner; //================================================================ public class ArrayIrreg { //---------------------------------------------------------------- private static Scanner Keyboard = new Scanner(System.in); public static void main(String[] args) { //---------------------------------------------------------------- char group, rLetter; int num = 10; // for test int rows = 10; int columns = 8; // creating 2d array System.out.print("Please enter number of rows : "); rows = Keyboard.nextInt(); while (rows &lt; 0 || rows &gt;= 10) { System.out.print("ERROR:Out of range, try again : "); rows = Keyboard.nextInt(); } double[][] figures = new double[rows + 1][num]; for(int t = 0; t &lt; rows; t++) { rLetter = (char)((t)+(int)'A'); System.out.print("Please enter number of positions in row " + rLetter + " : "); columns = Keyboard.nextInt(); while(columns &lt; 0 || columns &gt;= 8) { System.out.print("ERROR:Out of range, try again : "); columns = Keyboard.nextInt(); } for(int j = 0; j &lt;= columns; j++) { figures[j] = new double[j] ; } } // filling the array for(int row = 0; row &lt; figures.length; ++row) { for(int col = 0; col &lt; figures[row].length; ++col) { figures[row][col] = 0.0; } } // printing the array for(int row = 0; row &lt; figures.length; ++row) { // printing data row group = (char)((row)+(int)'A'); System.out.print(group + " : "); for(int col = 0; col &lt; figures[row].length; ++col) { System.out.print(figures[row][col] + " "); System.out.print(" "); } System.out.println(); } // printing final border for(int col = 0; col &lt; figures[0].length; ++col) { System.out.print("-+"); } System.out.println(" "); } } It displays correctly the first…
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34968201
has comment: http://stackoverflow.com/comment/34968224
has answer: http://stackoverflow.com/a/22911613
tagged with: java

hashtable
tags question: http://stackoverflow.com/q/22951011
tags question: http://stackoverflow.com/q/22812385
tag name: hashtable
tags question: http://stackoverflow.com/q/22884745
tags question: http://stackoverflow.com/q/22898629
tags question: http://stackoverflow.com/q/22872456
type: Tag
tags question: http://stackoverflow.com/q/22884116

http://stackoverflow.com/a/22823552
has comment: http://stackoverflow.com/comment/34810388
downvote count: 0
answers question: http://stackoverflow.com/q/22823514
type: Answer
has body: There is no difference except after the first one, you have a variable runner that refers to the Runner, and after the second one, you don't. But both of them create a new Runnerobject, and construct a new Thread using that new object.
score: 5
upvote count: 5

http://stackoverflow.com/q/22932537
has comment: http://stackoverflow.com/comment/35011308
score: 0
has comment: http://stackoverflow.com/comment/35008274
has answer: http://stackoverflow.com/a/22932646
has comment: http://stackoverflow.com/comment/35007746
has body: I have two entities Fichier and Categorie : Fichier.java @Entity @Table(name="\"Fichier\"") public class Fichier implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="\"idFichier\"", insertable=false, updatable=false) private int idFichier; ... @JoinColumn(name = "\"idCategorie\"", referencedColumnName = "\"idCategorie\"") @ManyToOne(cascade = ALL ) private Categorie categorieParent; ... And Categorie.java @Entity @Table(name="\"Categorie\"") public class Categorie implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="\"idCategorie\"", insertable=false, updatable=false) private int idCategorie; ... @OneToMany(mappedBy = "categorieParent", cascade = ALL) private List&lt;Categorie&gt; listeCategorie = new ArrayList&lt;Categorie&gt;(); @JoinColumn(name = "\"idCatParent\"", referencedColumnName = "\"idCategorie\"") @ManyToOne() private Categorie categorieParent; //bi-directional many-to-one association to Fichier @OneToMany(mappedBy="categorieParent", cascade = ALL) private List&lt;Fichier&gt; listeFichier; ... public Categorie addListeCategorie(Categorie listeCategorie){ getListeCategorie().add(listeCategorie); listeCategorie.setCategorieParent(this); return listeCategorie; } .... Main.java Categorie c =new Categorie(); Fichier f= new Fichier(); c.addFichier(f); em.persist(c); I get this error: Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: THE INSERT OR UPDATE VALUE OF FOREIGN KEY "Schema.Fichier.Contient" , the insert value of a foreign key must be equal to the value of the parent key SQLCODE=-530, SQLSTATE=23503, DRIVER=3.63.123 {prepstmnt -640961458 INSERT INTO "Schema"."Fichier" ("contenu", "description", "niveau", "nom", "type", "idCategorie") VALUES (?, ?, ?, ?, ?, ?)} [code=-530, state=23503] The error indicates a violation of integrity constrains, but why? I already try to persist child before parent, but still the same error.
type: UnansweredQuestion
tagged with: openjpa
has comment: http://stackoverflow.com/comment/35022290
has title: JPA ManyToOne OneToMany constraint violation
has comment: http://stackoverflow.com/comment/35007273
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35006738
answer count: 1
tagged with: jpa
tagged with: persistence

http://stackoverflow.com/q/22862832
score: 0
answer count: 1
tagged with: awtrobot
has body: I looking for a solution where I can "press" two keys at the same time using Java or .NET. Recently I have tried below code in Java which is working perfectly fine on one key. Here is the code for one key r.keyPress(KeyEvent.VK_R); Upon execution of this code it press letter 'R'. Now what I'm looking is to press "Windows+R" keys or say a combination of multiple keys not more than two keys at the same time.
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/34880488
has title: Simulate multiple key-press combinations
tagged with: java
has answer: http://stackoverflow.com/a/22863079
accepted answer: http://stackoverflow.com/a/22863079
has comment: http://stackoverflow.com/comment/34880521

http://stackoverflow.com/a/22897090
has comment: http://stackoverflow.com/comment/34943670
has comment: http://stackoverflow.com/comment/34943296
has body: BOOT_COMPLETED receivers cannot recieve a broadcast until an activity in the apk has been launched at least once. Its a weird rule google added to prevent people from downloading an app by mistake and having it run at boot.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22897002
has comment: http://stackoverflow.com/comment/34943814
has comment: http://stackoverflow.com/comment/34944312

http://stackoverflow.com/comment/34902116
type: AnswerComment
comment on: http://stackoverflow.com/a/22873629
type: Comment
score: 1
has text: Nope. The color should be contextual to the current element you are painting, not the canvas you're painting it to

http://stackoverflow.com/a/22902620
answers question: http://stackoverflow.com/q/22902594
has body: You want the second array to only increment to a maximum of i/2 as you are filling two array elements in the loop body.
score: 0
type: Answer

http://stackoverflow.com/comment/34888349
score: 0
type: Comment
type: QuestionComment
has text: @TedHopp Many new to Java developers who use Vector come from using `std::vector` in C++ without realising it is very different in many ways.
comment on: http://stackoverflow.com/q/22867119

http://stackoverflow.com/comment/34944312
type: AnswerComment
comment on: http://stackoverflow.com/a/22897090
score: 0
type: Comment
has text: @GabeSechan : It's not such a "weird rule". Think of it like this...even an Android device which is a phone is also 99% computer. At one time the most prevalent computer viruses (on DOS & Windows PCS at least) were ones which infected the MBR (Master Boot Record). In some ways the unrestricted use of `BOOT_COMPLETED` could potentially allow unauthorised software to become active similar to boot sector viruses on PCs. Android may be flawed in a number of ways but *ANY* restriction of malware potentially acting in an automated way has to better than none.

http://stackoverflow.com/a/22854844
downvote count: 0
has comment: http://stackoverflow.com/comment/34866595
type: Answer
answers question: http://stackoverflow.com/q/22854719
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34869507
has body: You read the values and store them in a List&lt;String&gt;. Then you shuffle the list using Collections.shuffle(list); Then you take the 5 first elements from the list.

http://stackoverflow.com/comment/35061634
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22963045
has text: Then it seems that your problem is somewhere else. It also works like a charm by me, have you made experience with other GUI applications written in Java? Try updating your graphics driver, java version?

http://stackoverflow.com/q/22943865
has answer: http://stackoverflow.com/a/22944213
type: Question
tagged with: android
score: -1
tagged with: java
has body: I am trying to use a .jar file for prettifying my code(in app). For this I have found an answer to a question here private static Map&lt;String, String&gt; buildColorsMap() { Map&lt;String, String&gt; map = new HashMap&lt;&gt;(); map.put("typ", "87cefa"); map.put("kwd", "00ff00"); map.put("lit", "ffff00"); map.put("com", "999999"); map.put("str", "ff4500"); map.put("pun", "eeeeee"); map.put("pln", "ffffff"); return map; } To use this new Hashmap with &lt;> angle brackets, I need to use Java 1.7 (which requires minSdk version of 18). When I update my compiler complaiance level to use 1.7, I get an error in my project, so need to clean. Once I clean the project, I get errors on my R.layout.XXX lines. It seems to be messing with this call to UI elements everywhere. Does anybody have any clue how to fix this issue?
downvote count: 1
answer count: 1
tagged with: hashmap
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11987660
upvote count: 0
has comment: http://stackoverflow.com/comment/35027416
has comment: http://stackoverflow.com/comment/35027401
has title: Use Java 1.7 and Android KitKat R.Layout issue.
favorite count: 0

http://stackoverflow.com/q/22831793
score: 0
tagged with: encoding
answer count: 1
has comment: http://stackoverflow.com/comment/34826265
has comment: http://stackoverflow.com/comment/34826306
type: UnansweredQuestion
has body: I have implemented gziping content of response in a filter. If server is sending 200 response without any content is still adding content encoding header like Content-Encoding:gzip Content-Length:0 On the other side another filter is reading the response and is trying to create GZIPInputStream which will fail because content does not contain gzip header and footer. Question is which side is doing it wrong? Should producer not add "Content-Encoding:gzip"? Should producer add gzip header/footer to content? Or maybe should consumer recognize empty content and don't try to create GZIPInputStream? Browsers not have any problem with consuming such responses.
tagged with: http
has comment: http://stackoverflow.com/comment/34825328
has title: Empty content from gziped http response
tagged with: gzip
tagged with: java
has answer: http://stackoverflow.com/a/22832442
type: Question

http://stackoverflow.com/q/22942567
has body: I would like to build a work order acceptance system that a) converts the pdf of the work order into images (possibly use iText for this) b) sends these as attachments to an MMS requesting approval from the recipient c) The recipient responds with "yes" or "No" to indicate approval of the work order I am sure twilio can do b) but I am not sure how to handle c). It is really not a vote. Is this possible using Twilio API - I need to associate the MMS with the workorder &amp; track the response
favorite count: 0
tagged with: mms
tagged with: twilio
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/22943923
accepted answer: http://stackoverflow.com/a/22943923
has comment: http://stackoverflow.com/comment/35027258
type: Question
tagged with: java
upvote count: 1
has title: Twilio MMS for work order acceptance
answer count: 1

http://stackoverflow.com/q/22965742
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
has comment: http://stackoverflow.com/comment/35071476
score: 0
tagged with: java
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/35069745
has body: I've generated client side stubs from a WSDL that includes the following snippet &lt;s:complexType&gt; &lt;s:sequence&gt; &lt;s:element ref="s:schema"/&gt; &lt;s:any/&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; I get back stubs which contain org.w3._2001.xmlschema.Schema variable instances. How do I unmarshall these? I am looking at JAXB's Unmarshaller as I suspect this is how to do it, but I haven't been able to piece it together yet. Can anyone point me to an example.
type: UnansweredQuestion
has title: How do you unmarshall a org.w3._2001.xmlschema.Schema in a wsimport generated stub

http://stackoverflow.com/q/22853167
type: AnsweredQuestion
tagged with: oop
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34863981
answer count: 1
has title: Java MVC with File Input/Output
has comment: http://stackoverflow.com/comment/34898083
has answer: http://stackoverflow.com/a/22853523
accepted answer: http://stackoverflow.com/a/22853523
score: 0
tagged with: file-io
has body: I am creating a program using MVC pattern in java... However Im very confused on how to properly perform file input. For example, should I perform all file input in MAIN? ..I tried but its getting messy, and Im not sure if there is a "uniform" way of performing file input for MVC pattern. This is for an OOP assignment btw. Thank you.
tagged with: input
tagged with: model-view-controller

http://stackoverflow.com/q/22952789
has comment: http://stackoverflow.com/comment/35043397
tagged with: character-encoding
type: Question
has body: So I recently finished a program for a colleague that wanted a quick quizzing system with very loose encryption. I emphasize very because the encryption is merely adding a flat number to each character in the file, thus resulting in (easily decryptable, but these are grad students in a completely unrelated field) a jarbled mess. This works as intended in Windows and Linux, it encrypts and decrypts fine. However, on Mac it does not. On Mac it encrypts fine, but then when decryption kicks in, it becomes an assortment of the occasional letter and several blank spaces. I currently think it's because I have not set what charset the character array is, but is it possible to set an array (not a string) to a specific charset? I'm currently not in a position to post code, but if people need further information before suggesting anything, I will be able to later.
score: 0
answer count: 1
has title: Character Handling on Mac in Java
tagged with: macos
has answer: http://stackoverflow.com/a/22952935
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/22900138
upvote count: 1
has body: wait and notify are meant to be used for synchronization. It seems to me that you wanted to use methods like Thread.suspend(), Thread.stop() and Thread.resume(), but those have been deprecated for the risk of problems with lock that they cause. The solution is to use a helper variable that the thread will check periodically to see if it should be running, otherwise, yield(or sleep) Why not to use suspend, stop or resume: http://docs.oracle.com/javase/6/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html Simple solutions: How to Pause and Resume a Thread in Java from another Thread http://www.tutorialspoint.com/java/java_thread_control.htm
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22899461

http://stackoverflow.com/a/22848906
score: 0
has comment: http://stackoverflow.com/comment/34961555
type: AcceptedAnswer
has body: In Spring you have default ObjectMapper bean which serialize yours objects to JSON. You have to override this default bean using below code: ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); Using it, your output should look like you expected. UPDATE 1 In this case when you want to wrap item in collection you have to implement your custom serializer and annotate specific List&lt;POJO&gt; property using this serializer. See answer of @Sotirios_Delimanolis for this question: Jackson JSON List with Object Type.
accepted answer of: http://stackoverflow.com/q/22837389
type: Answer
has comment: http://stackoverflow.com/comment/34970732
answers question: http://stackoverflow.com/q/22837389

http://stackoverflow.com/q/22872519
type: UnansweredQuestion
has title: How to configure PMD to only give Blocker warnings?
has comment: http://stackoverflow.com/comment/34913789
tagged with: pmd
score: 1
tagged with: java
tagged with: eclipse
type: Question
upvote count: 1
downvote count: 0
favorite count: 0
has body: I like the way you can tune FindBugs to warn you about only the most pressing problems. Then as you fix things you can lower it. This way you don't get overwhelmed by warnings. I'm trying to do something similar with PMD. I went to PMD > Rule Configuration, ordered the items by Priority and only selected Blocker. Re-ran it but it still finds tons of stuff, not limited to only Blocker category. How can I limit PMD in Eclipse to only show me Blocker warnings?
answer count: 0

http://stackoverflow.com/a/22893648
has comment: http://stackoverflow.com/comment/34937277
accepted answer of: http://stackoverflow.com/q/22893625
score: 3
answers question: http://stackoverflow.com/q/22893625
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34939643
type: Answer
has comment: http://stackoverflow.com/comment/34940608
downvote count: 0
has body: You could let doInBackground return JSONObject json and use it in onPostExecute. Then to check if it was all ok, do the check inside onPostExecute. Something like: class GetProductDetails extends AsyncTask&lt;String, String, JSONObject&gt; { @Override protected void onPreExecute() { //bla-bla-bla } protected JSONObject doInBackground(String... args) { JSONObject json = null; try { List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("pid", pid)); json = jsonParser.makeHttpRequest( url_product_detials, "GET", params); } catch (Exception e) { e.printStackTrace(); } return json; } protected void onPostExecute(JSONObject json) { pDialog.dismiss(); if (json == null) return; // check if json is null too! if null something went wrong (handle it, i used return as example) int success = json.getInt(TAG_SUCCESS);; if (success == 1) { JSONArray productObj = json.getJSONArray(TAG_PRODUCT); JSONObject product = productObj.getJSONObject(0); txtName = (TextView) findViewById(R.id.tvName); txtPrice = (TextView) findViewById(R.id.tvPrice); txtDesc = (TextView) findViewById(R.id.tvDescription); txtCurrent = (TextView) findViewById(R.id.tvCurrent); txtTurn = (TextView) findViewById(R.id.tvTurn); txtName.setText(product.getString(TAG_NAME)); txtPrice.setText(product.getString(TAG_PRICE)); txtDesc.setText(product.getString(TAG_DESCRIPTION)); txtCurrent.setText(product.getString("current")); txtTurn.setText(product.getString("turn")); }else{ } }
has comment: http://stackoverflow.com/comment/34939791
has comment: http://stackoverflow.com/comment/34939490

http://stackoverflow.com/comment/35025467
has text: @user2318813, works fine for me using JDK7 on Windows 7. Post your `SSCCE`, showing how you tested the code.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22941196
type: AnswerComment

http://stackoverflow.com/q/22959100
downvote count: 0
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35053878
type: Question
has answer: http://stackoverflow.com/a/23596706
tagged with: autocomplete
has body: I have heard that Eclipse uses reflection to provide its auto complete features.But How does it work actually?I searched Google but found no good article on it.Can Anyone please explain the procedures or provide me with any useful article on it.Thanks in advance.
score: 4
has comment: http://stackoverflow.com/comment/35054585
answer count: 1
has title: How Auto Complete in java works with Reflection?
favorite count: 0
type: UnansweredQuestion
upvote count: 4
tagged with: reflection

http://stackoverflow.com/comment/34968325
comment on: http://stackoverflow.com/a/22911601
type: AnswerComment
score: 0
type: Comment
has text: Thanks for reply but i dont want to build using maven.

http://stackoverflow.com/q/22862473
answer count: 0
type: UnansweredQuestion
tagged with: wildfly
type: Question
tagged with: java
tagged with: jboss
tagged with: hornetq
upvote count: 4
downvote count: 0
score: 4
favorite count: 0
has title: MDB is not consuming Messages from Queue on standalone Hornetq
has body: i am using wildfly-8.0.0.Final and hornetq-2.4.0.Final. I'm trying to read messages from queues on hornetq server using MDB. my MDB is running on wildfly. First i removed all messaging configuration from standalone.xml(wildfly).In hornetq-2.4.0.Final, i added my queue in hornetq-jms.xml. In my MDB, I gave @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/MyQueue"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"), @ActivationConfigProperty(propertyName = "connectorClassName", propertyValue = "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"), @ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=localhost;port=5445")}) @ResourceAdapter("hornetq-ra.rar") Then i started both servers(wildfly,hornetq), hornetq server started smoothly but in wildfly while deploying MDB(M2MEventDistributor), it threw error as, JBAS014613: Operation ("deploy") failed - address: ([("deployment" =&gt; "M2MEventDistributor.jar")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" =&gt; ["jboss.deployment.unit.\"M2MEventDistributor.jar\".component.M2MEventDistributorMDB.CREATE is missing [jboss.ra.hornetq-ra]"]} and 2014-04-04 13:32:29,042 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1)JBAS014774: Service status report JBAS014775: New missing/unsatisfied dependencies: service jboss.ra.hornetq-ra (missing) dependents: [service jboss.deployment.unit."M2MEventDistributor.jar".component.M2MEventDistributorMDB.CREATE] I found that the issue is with hornet-ra adapter, I searched in internet about this issue and referred links and followed instructions in them, but hard luck, nothing helped me. Everyone in net, forums, blogs, and communities are saying about deploying hornetq-ra.rar and changing the ra.x…

http://stackoverflow.com/a/22844832
downvote count: 0
score: 1
has body: Don't do like that. Getters and setters are just a convention used not to expose attributes directly. Create a method just to load data that is not a getter or setter.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22844511
has comment: http://stackoverflow.com/comment/34849629
accepted answer of: http://stackoverflow.com/q/22844511
type: Answer

http://stackoverflow.com/q/22933296
has comment: http://stackoverflow.com/comment/35009049
has body: I have the following Java6 and Java8 code: List&lt;ObjectType1&gt; lst1 = // a list of ObjectType1 objects List&lt;ObjectType2&gt; lst2 = // a list of ObjectType1 objects, same size of lst1 List&lt;ObjectType3&gt; lst3 = new ArrayLis&lt;ObjectType3&gt;(lst1.size()); for(int i=0; i &lt; lst1.size(); i++){ lst3.add(new ObjectType3(lst1.get(i).getAVal(), lst2.get(i).getAnotherVal())); } Is there any way in Java8 to handle the previous for in a more concise way using Lambda?
favorite count: 0
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/35008800
has comment: http://stackoverflow.com/comment/35008397
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22933355
tagged with: java-stream
tagged with: java
has comment: http://stackoverflow.com/comment/35019967
score: 17
has answer: http://stackoverflow.com/a/22935970
has comment: http://stackoverflow.com/comment/35008203
upvote count: 17
type: Question
has title: Using Java8 Streams to create a list of objects from another two lists
has comment: http://stackoverflow.com/comment/35008025
has answer: http://stackoverflow.com/a/42104490
possible better answer: http://stackoverflow.com/a/22935970
answer count: 3
has answer: http://stackoverflow.com/a/22933355
downvote count: 0

android-fragments
tags question: http://stackoverflow.com/q/22815022
tags question: http://stackoverflow.com/q/22879410
tags question: http://stackoverflow.com/q/22870210
type: Tag
tags question: http://stackoverflow.com/q/22874312
tags question: http://stackoverflow.com/q/22927585
tags question: http://stackoverflow.com/q/22872579
tags question: http://stackoverflow.com/q/22818444
tags question: http://stackoverflow.com/q/22920323
tags question: http://stackoverflow.com/q/22835482
tags question: http://stackoverflow.com/q/22875805
tags question: http://stackoverflow.com/q/22857417
tags question: http://stackoverflow.com/q/22941269
tags question: http://stackoverflow.com/q/22961290
tags question: http://stackoverflow.com/q/22838323
tags question: http://stackoverflow.com/q/22941998
tags question: http://stackoverflow.com/q/22888022
tags question: http://stackoverflow.com/q/22921485
tags question: http://stackoverflow.com/q/22918671
tags question: http://stackoverflow.com/q/22895279
tags question: http://stackoverflow.com/q/22959931
tags question: http://stackoverflow.com/q/22862767
tags question: http://stackoverflow.com/q/22954036
tags question: http://stackoverflow.com/q/22865994
tag name: android-fragments

http://stackoverflow.com/a/24018090
downvote count: 0
score: 1
has body: // To check the given no is Armstrong number (Java Code) class CheckArmStrong{ public static void main(String str[]){ int n=153,a, b=0, c=n; while(n&gt;0){ a=n%10; n=n/10; b=b+(a*a*a); System.out.println(a+" "+n+" "+b); // to see the logic } if(c==b) System.out.println("Armstrong number"); else System.out.println(" Not Armstrong number"); } }
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22895936

http://stackoverflow.com/comment/35202079
score: 0
type: AnswerComment
has text: I have found the issue let me write a blog and post the same :)
type: Comment
comment on: http://stackoverflow.com/a/22918358

http://stackoverflow.com/q/22818716
tagged with: java
type: Question
has body: I'm writing a game API, and I'd like there to be an enum of controls. I want to define basic controls (JUMP, MOVE_LEFT), but the end developer should be able to add other controls (DANCE, SHOOT). So how would I allow the end programmer to add to my list without having to touch my original enum file?
answer count: 2
tagged with: api
downvote count: 0
has answer: http://stackoverflow.com/a/22820136
has answer: http://stackoverflow.com/a/22820112
linked to: http://stackoverflow.com/q/1414755
possible better answer: http://stackoverflow.com/a/22820136
has title: Allowing end programmer to expand API enum
accepted answer: http://stackoverflow.com/a/22820112
favorite count: 0
has comment: http://stackoverflow.com/comment/34801840
duplicate of: http://stackoverflow.com/q/1414755
upvote count: 1
type: AnsweredQuestion
tagged with: enums
score: 1

http://stackoverflow.com/a/22848780
type: Answer
has comment: http://stackoverflow.com/comment/34859110
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer
has body: Make sure that you turn on Remote Login under System Preferences then File Sharing: In order to check if it runs try jps command from command line. You should get something like: 43730 TaskTracker 43674 JobTracker 43730 NameNode 43582 DataNode 43611 SecondaryNameNode 43821 Jps And now try some of the hadoop examples: $ hadoop jar /usr/local/Cellar/hadoop/2.3.0/libexec/hadoop-examples-*.jar pi 10 100
answers question: http://stackoverflow.com/q/22848674
accepted answer of: http://stackoverflow.com/q/22848674

http://stackoverflow.com/q/22854005
tagged with: classpath
has answer: http://stackoverflow.com/a/22898108
type: Question
tagged with: java
tagged with: noclassdeffounderror
linked to: http://stackoverflow.com/q/34413
score: 0
answer count: 1
has body: I am trying to implement an autocomplete Combo in SWT using AutocompleteComboInput. I have added net.sf.swtaddons_0.1.1_bin_src.jar to the library via "Add External JAR". import net.sf.swtaddons.autocomplete.combo.AutocompleteComboInput; ... subjectCodeCombo = new Combo(tab3Composite, SWT.DROP_DOWN); // other code modifying Combo appearance here... // returns a String[] of items retrieved from database String[] subjectCodeArray = dbQuery.subjectsToArray(); subjectCodeCombo.setItems(subjectCodeArray); subjectCodeCombo.setText("- SELECT -"); new AutocompleteComboInput(subjectCodeCombo); // throws an error However, I am getting a NoClassDefFoundError. As I have read, it seems a class is not found during runtime. I believe I need to do something about the "runtime classpath", but I am lost. Steps on how to resolve this in Eclipse IDE is appreciated.
has title: java.lang.NoClassDefFoundError while using SWT Add-on (AutocompleteComboInput)
tagged with: runtime-error
accepted answer: http://stackoverflow.com/a/22898108
type: AnsweredQuestion
tagged with: swt

http://stackoverflow.com/comment/34876088
score: 0
type: Comment
type: QuestionComment
has text: @Meno More results and more questions. First of all I have looked into the .class files in the libraries (one local Eclipse, the other deployed) to see they have 2 compareTo methods, as expected - one with Object, other with ReadableInstant. At runtime however, when I launch with Eclipse (the working version), I see 141 methods with Reflection and 2 compareTo. When remote-debugging the deployed version I see 132 methods with only 1 compareTo that takes an Object. So it seems that although the .jar is correct, it picks up a different version somewhere.
comment on: http://stackoverflow.com/q/22810331

http://stackoverflow.com/a/22852225
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Try this, String value = "FirstNameLastName yy-mm-ddAddress FirstNameLastName yy-mm-ddAddress FirstNameLastName yy-mm-ddAddress "; for (int i = 0; i &lt; value.length(); i++) { System.out.println("First Name : "+value.substring(i, i + 9)); System.out.println("Last Name : "+value.substring((i + 9), i + 18)); System.out.println("Date : "+value.substring(i + 18, i + 26)); System.out.println("Address : "+value.substring(i + 26, i + 56)); i = i + 55; }
type: Answer
accepted answer of: http://stackoverflow.com/q/22852089
upvote count: 1
answers question: http://stackoverflow.com/q/22852089

http://stackoverflow.com/comment/35014956
comment on: http://stackoverflow.com/a/22935730
type: Comment
has text: If using an InputStream instead of a Reader works my guess is it is a decoding error. A Java char is UTF-16 and InputStreamReader may very well be interpreting the bytes coming in and consolidating certain ones in to pairs. This type of error is fairly common.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34996537
type: AnswerComment
comment on: http://stackoverflow.com/a/22926416
type: Comment
score: 1
has text: @user3482995: but please do check out the [minimal example program link](http://stackoverflow.com/help/mcve) as this will tell you what you need to post next time.

http://stackoverflow.com/comment/34938281
has text: Start by fixing the first one. Read the error message. What does it say? *variable lowerCase is already defined in method shift(String,int)*. And indeed, you're declaring the lowerCase variable twice. So fix the code: either you want a different variable, and it should have another name, or you want to reuse the same, and you shouldn't declare it a second time. Only reassign it. You should never come to a point where you have so many errors. Add as few lines as possible to an already compiling code, then compile again, and fix the errors immediately.
comment on: http://stackoverflow.com/q/22894617
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/136660539
has text: Is there a way to chain these? Instead of making each its own line
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22877637

http://stackoverflow.com/q/22853168
has comment: http://stackoverflow.com/comment/34864424
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22865846
has comment: http://stackoverflow.com/comment/34864335
upvote count: 1
has title: Entitymanager is null spring JPA configuration
has body: I've been currently working on a Maven + Spring + Hibernate project. Actually, this is just a test project just to get familiar on how Spring works with Hibernate (+Maven). I've already setup and prepare the necessary dependencies. i.e. the appcontext.xml for Spring, the persistence.xml for Hibernate, the entity and DAO objects for JPA/Persistence/Hibernate. During debug, it's observed that the EntityManager is always null. I don't know what's causing this. web.xml <?xml version="1.0" encoding="UTF-8"?> org.springframework.web.context.ContextLoaderListener patchConfigLocation /WEB-INF/applicationContext-datasource.xml /WEB-INF/applicationContext.xml /WEB-INF/applicationContext-entity.xml appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/applicationContext-servlet.xml 1 appServlet / application-datasource.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" 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/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"> <jee:jndi-lookup id="datasource" jndi-name="jdbc/web"/> classpath*:META-INF/persistence.xml <tx:annotation-driven transaction-manager="transactionManager"/> </beans> context.xml <?xml version="1.0" encoding="UTF…
type: Question
accepted answer: http://stackoverflow.com/a/22853674
possible better answer: http://stackoverflow.com/a/22865846
answer count: 2
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/34864266
favorite count: 0
has comment: http://stackoverflow.com/comment/34864620
has answer: http://stackoverflow.com/a/22853674
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/34883504
score: 0
type: QuestionComment
has text: check what the value of `getWidth()` is. It might not be getting the width of the screen.
type: Comment
comment on: http://stackoverflow.com/q/22864370

http://stackoverflow.com/comment/34867471
score: 0
type: QuestionComment
has text: @Pokuri So, Do I create separate XML file for every job?
comment on: http://stackoverflow.com/q/22855249
type: Comment

http://stackoverflow.com/comment/34948888
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22899182
has text: In the method getValue of the Person class. Before the line that looks like this: return Integer.valueOf(value); , add this line: value = value.replace(",", "");
score: 0

http://stackoverflow.com/q/22813079
has comment: http://stackoverflow.com/comment/34791327
has answer: http://stackoverflow.com/a/22813379
score: 0
tagged with: java
tagged with: hibernate
has body: My requirement is to get only the availability of records (not getting values). For this scenario,my problem is that what can be the better solution to improve performance between the JDBC query and the HQL Named query. As I think,since named queries are loaded at the time of hibernate factories are loaded and therefore, it can be faster than jdbc. Please not that This is not a normal HQL query, here I am asking about the Named Query. Normal HQL and Named query can have different performance. Most of questions and answers are about normal HQL. My point here is the NAMED QUERY .
has comment: http://stackoverflow.com/comment/34791132
type: UnansweredQuestion
has title: Hibernate Named Query Vs JDBC Query Performance
linked to: http://stackoverflow.com/q/8573636
tagged with: sql
duplicate of: http://stackoverflow.com/q/8573636
tagged with: jdbc
has answer: http://stackoverflow.com/a/22813540
type: Question
answer count: 2

http://stackoverflow.com/comment/136768651
type: AnswerComment
comment on: http://stackoverflow.com/a/76904645
type: Comment
has text: This is regarded as an anti-pattern and impacts performance.
score: 4

http://stackoverflow.com/comment/34801230
has text: how do you create your session? what flush strategy you are using? do you maybe read an instance of ObjectA then modify some fields of it while it's still attached to the session? that unaccepted answer can also give you some clues.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22818306

http://stackoverflow.com/comment/34788464
comment on: http://stackoverflow.com/a/22810987
type: AnswerComment
score: 0
has text: Oh..yeah..did not notice that...edited the answer with the new method.
type: Comment

http://stackoverflow.com/comment/77308071
has text: Possible duplicate of [Does Java strictfp modifier have any effect on modern CPUs?](https://stackoverflow.com/questions/22562510/does-java-strictfp-modifier-have-any-effect-on-modern-cpus)
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22859454
type: QuestionComment

http://stackoverflow.com/comment/34796333
comment on: http://stackoverflow.com/a/22814162
has text: @Cuthbert - Yes, as I said, if the address must match, `BooleanClause.Occur.MUST` is the correct argument. I wasn't aware you were getting no results though. There is nothing inherantly wrong about your usage of BooleanQueries, and changing that `Occur` value will certainly not cause you to get more results. I suspect you are indexing the fields in such a way that you are getting no results. Are you using a `DoubleField` to index the loan amount fields? Are the field names correct (they are case sensitive!)? Is the address analyzed or not?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35002881
type: QuestionComment
has text: @marcin_j If he did not have the permission, he would not even have been able to open the camera to start with.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22929900

http://stackoverflow.com/comment/34952504
score: 1
comment on: http://stackoverflow.com/q/22902389
type: Comment
type: QuestionComment
has text: If you are interested, you might want to look at design patterns such as [Factory](http://en.wikipedia.org/wiki/Factory_method_pattern) to build things for you, and the idea of [separation of concerns](http://en.wikipedia.org/wiki/Separation_of_concerns).

http://stackoverflow.com/comment/34913499
has text: Haha oops. I just learned something new. Ok, so the dowhile is a brain error, which I now understand. I'm not so clued-up with the javax.swing.Timer class. My coding is based on examples on the interwebs. I removed java.util.Timer and replaced it with javax.swing.Timer, but now the IDE is giving me errors. I guess it's back to javadocs with me... Thanks, for pointing out the coding that's right, though :D
type: Comment
comment on: http://stackoverflow.com/a/22880785
score: 0
type: AnswerComment

http://stackoverflow.com/a/22815472
answers question: http://stackoverflow.com/q/22812488
score: 71
has comment: http://stackoverflow.com/comment/34798484
has comment: http://stackoverflow.com/comment/34797707
has comment: http://stackoverflow.com/comment/34799204
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41906388
downvote count: 0
upvote count: 71
accepted answer of: http://stackoverflow.com/q/22812488
has body: From the Eclipse Point of view the error is totally correct because JavaFX is coming from the extension classpath and is not available on ALL Java8 VMs (e.g. ibm!). As outlined you can suppress those warnings by add access-rules or IMHO the best solution is to install e(fx)clipse which does this automatically for you and beside that even provides you tooling for JavaFX CSS and FXML. You can grab an all in one package from http://efxclipse.bestsolution.at/install.html
type: Answer

http://stackoverflow.com/comment/34799140
type: QuestionComment
comment on: http://stackoverflow.com/q/22817358
has text: "should not be able to change it": the receiver can always change the file, but you can make sure with a signature that some other entity does no longer accept the file if it was changed.
score: 2
type: Comment

http://stackoverflow.com/comment/34935955
has text: What happened exactly when you changed your database in the quoted `persitence.properties`?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22893309

http://stackoverflow.com/comment/34870686
has text: The fact that you're having to `@SuppressWarnings("rawtypes")` shows you that you're doing something you shouldn't be. **Never** use rawtypes.
comment on: http://stackoverflow.com/a/22857034
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/22860603
has body: As I now understand, it is not that easy to record a video, processed by OpenCV on android. But is there any possibility to do it parallel: - to record video from camera, using standard android tools (MediaRecorder) and - to process video with OpenCV (mOpenCvCameraView) without saving it? Thank you once again!
favorite count: 0
has title: Record video from camera parallel to OpenCV processing on android
type: UnansweredQuestion
tagged with: opencv
tagged with: video
score: 3
downvote count: 0
tagged with: camera
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/32182729
upvote count: 3
tagged with: android
answer count: 1

http://stackoverflow.com/q/22913796
favorite count: 0
linked to: http://stackoverflow.com/q/6993149
accepted answer: http://stackoverflow.com/a/22934838
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: transactions
tagged with: java
tagged with: apache-camel
has answer: http://stackoverflow.com/a/22934838
type: Question
has body: I have a problem with Camel's transaction management. In my example I extract an XML file out of a ZIP, create an JPA entity out of the xml via JAXB and write it to the database. Then I force a RuntimeException. My expectation is that the inserted entities are rollbacked but they are already committed. I put a transacted call over the ZIP splitter so that all containing files are processed or none. The aggregator is responsible to assemble the metadata from different files before writing it to the database. Could somebody explain what is missing within the code or where my misunderstanding of Camel's transaction management lies? Thank you in advance Adrian ... private final class AggregationStrategyImplementation implements AggregationStrategy { DocumentMetaDataContainer documentMetaDataContainer; public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { if (oldExchange == null) { documentMetaDataContainer = (DocumentMetaDataContainer) newExchange.getIn() .getBody(); oldExchange = newExchange; } else { String header = String.valueOf(newExchange.getIn().getHeader("CamelFileName")); System.out.println("aggregating " + header); documentMetaDataContainer.putFileStreamToSpecificElement(header, newExchange .getIn().getBody(byte[].class)); if (isDone()) { oldExchange.getOut().setHeader(Exchange.AGGREGATION_COMPLETE_ALL_GROUPS, true); } } return oldExchange; } public boolean isDone() { if (documentMetaDataContainer == null) return false; for (DocumentMetaData documentMetaData : documentMetaDataContainer .getListOfDocumentMetaData()) { if (documentMetaData.getDocumentFile() == null) return false; } return true; } } public void processImport() throws Exception { ApplicationContext springContext = new ClassPathXmlApplicationContext( "classpath:spring.xml"); final CamelContext camelContext = SpringCamelContext.springCamelContext(springContext); RouteBuilder routeBuilder = new RouteBuilder() { private static final String inbox = "/Development/ppaFiles"; JAXBContext…
has title: Apache Camel: No rollback after RuntimeException
tagged with: jpa
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/34958196
type: QuestionComment
has text: [Subset sum problem](http://en.wikipedia.org/wiki/Subset_sum_problem).
type: Comment
comment on: http://stackoverflow.com/q/22905617
score: 1

http://stackoverflow.com/q/22914775
possible better answer: http://stackoverflow.com/a/22914897
tagged with: java
has answer: http://stackoverflow.com/a/22914897
type: Question
answer count: 3
tagged with: jtextarea
has body: I have a JTextArea inside a JPanel. The JPanel is set to the default FlowLayout. I assigned to the JTextArea a size through the constructor: new JTextArea(50,50). However, not only the size I specified is ignored once it's out of a certain range (for example, if I set the size to a value larger than 40*40, the program starts to ignore what I say and instead set the JTextArea to some arbitrary size) - the size also changes as I type. The JTextArea resizes itself if I type inside it more than it can contain. I did: textArea.setLineWrap(true); Didn't solve this. How can I set a fixed size for the JTextArea?
downvote count: 0
has answer: http://stackoverflow.com/a/22914880
has answer: http://stackoverflow.com/a/22914944
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/22914880
tagged with: swing
score: 2
type: AnsweredQuestion
has title: How to set JTextArea to fixed size

http://stackoverflow.com/comment/34937458
type: QuestionComment
comment on: http://stackoverflow.com/q/22893924
score: 0
has text: Class names should start with an uppercase character, according to the Java conventions.
type: Comment

http://stackoverflow.com/q/22910611
possible better answer: http://stackoverflow.com/a/22910887
score: 3
has answer: http://stackoverflow.com/a/22911279
accepted answer: http://stackoverflow.com/a/22911279
upvote count: 3
answer count: 2
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22910887
tagged with: java
tagged with: javafx
has title: JavaFX controller is always null
has body: I'll try to get in JavaFX 2 and used a simple demo app. The Project consists of 3 Files, the Main.java, the Controller.java and the sample.fxml. In Sample.fxml i declared the controller: And in my Main.java I try to access the controller FXMLLoader loader = new FXMLLoader(); Parent root = loader.load(getClass().getResource("sample.fxml")); System.out.println(loader.getController()); //prints always null So my first idea was that the mapping doesn't work. So I added a initialize method in the controller. @Override public void initialize(URL url, ResourceBundle resourceBundle) { System.out.println("init"); } The output is now: init null So my Question now is how can i access the controller of a given fxml file?
type: Question

http://stackoverflow.com/q/22857411
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34873618
tagged with: playframework
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34880243
favorite count: 0
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/34872437
tagged with: playframework-2.0
tagged with: sbt
has body: I am currently working on a play application as a front end developer. For reasons that are beyond the scope of this question I have moved development from mac to a windows machine. This is where my problems kick in (surprised?). Most of our systems work well, but there is one very very stubborn issue that I have not been able to solve. it seems that dependency version are never parsed so that versions defined as ${version.org.codehaus.jackson} stays ${version.org.codehaus.jackson} and is never resolved to its version number 1.9.2 Our application has (too?) many dependencies.These dependencies are defines in ivysettings and then the whole thing magically gets build (we use sbt to manage this). Now, I am a humble front end developer, so lots of the magic here are.. well magic. The back end team is starting to give up on me, and so am I, but apparently there is an issue where the versions are not parsed. My end result is: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: org.codehaus.jackson#jackson-mapper-asl;${version.org.codehaus.jackson}: not found [warn] :: commons-configuration#commons-configuration;${version.commons-configuration}: not found [warn] :: org.codehaus.jackson#jackson-core-asl;${version.org.codehaus.jackson}: not found [warn] :: org.hibernate#hibernate-core;${version.org.hibernate}: not found [warn] :: commons-pool#commons-pool;${version.commons-pool}: not found [warn] :: commons-io#commons-io;${version.commons-io}: not found [warn] :: log4j#log4j;${version.log4j}: not found [warn] :: jline#jline;${version.jline}: not found [warn] :: commons-collections#commons-collections;${version.commons-collections}: not found [warn] :: commons-beanutils#commons-beanutils;${version.commons-beanutils}: not found [warn] :: dom4j#dom4j;${version.dom4j}: not found [warn] :: antlr#antlr;${version.antlr}: not found [warn] :: org.hornetq#hornetq-core;${version.org.h…
tagged with: java
has title: play unable to parse dependency versions
tagged with: ivy
has comment: http://stackoverflow.com/comment/34911406
answer count: 0

http://stackoverflow.com/comment/35013084
score: 0
has text: @T0tec yes, it is. You suggested one option (though with JSON you may want to store it as clob and not blob).
comment on: http://stackoverflow.com/q/22934817
type: Comment
type: QuestionComment

hadoop
tags question: http://stackoverflow.com/q/22830059
tags question: http://stackoverflow.com/q/22853574
tags question: http://stackoverflow.com/q/22936176
tags question: http://stackoverflow.com/q/22919013
tags question: http://stackoverflow.com/q/22917190
tags question: http://stackoverflow.com/q/22825888
tags question: http://stackoverflow.com/q/22890303
tags question: http://stackoverflow.com/q/22922864
tag name: hadoop
tags question: http://stackoverflow.com/q/22836865
tags question: http://stackoverflow.com/q/22913958
tags question: http://stackoverflow.com/q/22924613
tags question: http://stackoverflow.com/q/22884474
tags question: http://stackoverflow.com/q/22815277
tags question: http://stackoverflow.com/q/22810981
type: Tag
tags question: http://stackoverflow.com/q/22840269
tags question: http://stackoverflow.com/q/22876869
tags question: http://stackoverflow.com/q/22892130
tags question: http://stackoverflow.com/q/22937814
tags question: http://stackoverflow.com/q/22918851
tags question: http://stackoverflow.com/q/22815357
tags question: http://stackoverflow.com/q/22915311
tags question: http://stackoverflow.com/q/22848674
tags question: http://stackoverflow.com/q/22967008
tags question: http://stackoverflow.com/q/22920651
tags question: http://stackoverflow.com/q/22942597
tags question: http://stackoverflow.com/q/22938076
tags question: http://stackoverflow.com/q/22845120
tags question: http://stackoverflow.com/q/22918720
tags question: http://stackoverflow.com/q/22955199
tags question: http://stackoverflow.com/q/22902210
tags question: http://stackoverflow.com/q/22966488
tags question: http://stackoverflow.com/q/22877063
tags question: http://stackoverflow.com/q/22873975
tags question: http://stackoverflow.com/q/22862184
tags question: http://stackoverflow.com/q/22845376
tags question: http://stackoverflow.com/q/22816009
tags question: http://stackoverflow.com/q/22921799
tags question: http://stackoverflow.com/q/22811227
tags question: http://stackoverflow.com/q/22896338

http://stackoverflow.com/q/22826674
accepted answer: http://stackoverflow.com/a/22826783
type: Question
has comment: http://stackoverflow.com/comment/34815797
answer count: 2
has title: Split a String into array in Java and C#
downvote count: 2
has comment: http://stackoverflow.com/comment/34842352
upvote count: 1
has body: I want to split this String : StringA:StringB!StringC.StringD into: Array [StringA, :, StringB, !, StringC, ., StringD] How can i do it in Java and c#? Thank for your helping!
has comment: http://stackoverflow.com/comment/34842272
has comment: http://stackoverflow.com/comment/34816218
has comment: http://stackoverflow.com/comment/34842590
tagged with: java
linked to: http://stackoverflow.com/q/521146
has comment: http://stackoverflow.com/comment/34842708
has comment: http://stackoverflow.com/comment/34839588
tagged with: c#
has comment: http://stackoverflow.com/comment/34842075
has comment: http://stackoverflow.com/comment/34841689
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22826783
has comment: http://stackoverflow.com/comment/34841978
possible better answer: http://stackoverflow.com/a/22827258
has comment: http://stackoverflow.com/comment/34842425
tagged with: regex
has answer: http://stackoverflow.com/a/22827258
has comment: http://stackoverflow.com/comment/34841867
favorite count: 0
has comment: http://stackoverflow.com/comment/34842482
score: -1

http://stackoverflow.com/comment/34858554
score: 0
type: Comment
has text: So put `numbers[0]` inside of a calculation. `int n = numbers[0] + numbers[1];`.
comment on: http://stackoverflow.com/a/22850292
type: AnswerComment

http://stackoverflow.com/q/22826295
linked to: http://stackoverflow.com/q/13987920
has comment: http://stackoverflow.com/comment/34815157
has comment: http://stackoverflow.com/comment/34815141
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: solr
tagged with: nutch
has comment: http://stackoverflow.com/comment/34848946
type: Question
has title: Apache nutch 1.5 and solr 4.7 indexing
score: 3
tagged with: lucene
upvote count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/34817537
has body: I have crawled websites using apache nutch and want to index the data in solr. I have been following the tutorial mentioned here However the tutorial mentions about indexing as it crawls except in my case I need to index the data that already has been crawled. I am running the below command bin/nutch solrindex http://127.0.0.1:8983/solr/ crawl/crawldb -linkdb crawl/linkdb crawl/segments/* [abc@xyz nutch-crawler]$ bin/nutch index http://abc.xyz:8983/solr/ pryder/crawldb/ -linkdb pryder/linkdb/ pryder/segments/20140330021243/ Indexer: starting at 2014-04-02 20:34:09 Indexer: deleting gone documents: false Indexer: URL filtering: false Indexer: URL normalizing: false Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/solr/client/solrj/impl/CommonsHttpSolrServer at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2398) at java.lang.Class.getConstructor0(Class.java:2708) at java.lang.Class.newInstance0(Class.java:328) at java.lang.Class.newInstance(Class.java:310) at org.apache.nutch.plugin.Extension.getExtensionInstance(Extension.java:157) at org.apache.nutch.indexer.IndexWriters.&lt;init&gt;(IndexWriters.java:57) at org.apache.nutch.indexer.IndexingJob.index(IndexingJob.java:91) at org.apache.nutch.indexer.IndexingJob.run(IndexingJob.java:176) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65) at org.apache.nutch.indexer.IndexingJob.main(IndexingJob.java:186) Caused by: java.lang.ClassNotFoundException: org.apache.solr.client.solrj.impl.CommonsHttpSolrServer at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 11 more What would be going wrong here?
has comment: http://stackoverflow.com/comment/34823417

http://stackoverflow.com/q/22859510
has comment: http://stackoverflow.com/comment/34881878
favorite count: 0
has comment: http://stackoverflow.com/comment/34874584
has comment: http://stackoverflow.com/comment/34880014
tagged with: email
has comment: http://stackoverflow.com/comment/34880054
has comment: http://stackoverflow.com/comment/34882578
has comment: http://stackoverflow.com/comment/34874382
type: UnansweredQuestion
has body: I am able to send mail through standalone application in java.but whenever i embedded the same code in the servlets ,i got exception that "could not connect to smtp.gmail.com port 587 ". But the same code is working very fine when i am using standalone application , not servlets. I am using Mozilla firefox browser for servlets.
downvote count: 1
has title: How to send mail through servlets?
has answer: http://stackoverflow.com/a/22864011
has comment: http://stackoverflow.com/comment/34874338
tagged with: java
score: -1
tagged with: servlets
type: Question
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/34903617
type: AnswerComment
type: Comment
has text: I wasn't referring to that, I just wanted to know why the `StackOverflowError` was saying that it included the package declaration, in this case `package javar.swing;`
comment on: http://stackoverflow.com/a/22874983
score: 0

http://stackoverflow.com/q/22888154
accepted answer: http://stackoverflow.com/a/22888204
favorite count: 0
type: Question
score: 5
tagged with: android
has title: How to get the phone language with libgdx?
answer count: 1
has answer: http://stackoverflow.com/a/22888204
tagged with: libgdx
upvote count: 5
tagged with: java
type: AnsweredQuestion
downvote count: 0
has body: I'm tyring to set a default language for my game and I would like it to be the phone's language, the question is: how can I get the phone's language?

http://stackoverflow.com/q/22868472
tagged with: java
accepted answer: http://stackoverflow.com/a/22872052
has body: I have made a new Ionic / Cordova project and I'm trying to build it on windows 8.1. I installed JDK and JRE 7 as well as android sdk and ant and added them to my path using the following instructions. cordova platform add android not working while listing Android targets When I execute ionic platform add android or cordova I am still getting the following error: C:\Users\BogdanR\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:126 throw e; ^ Error: Failed to run 'java -version', make sure your java environment is set up including JDK and JRE. Your JAVA_HOME variable is C:\Program Files\Java\jdk1.7.0_51 Error: Command failed: 'java' is not recognized as an internal or external command, operable program or batch file. at C:\Users\BogdanR\.cordova\lib\android\cordova\3.4.0\bin\lib\check_reqs.js:62:22 at ChildProcess.exithandler (child_process.js:641:7) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:743:16) at Socket.&lt;anonymous&gt; (child_process.js:956:11) at Socket.EventEmitter.emit (events.js:95:17) at Pipe.close (net.js:466:12) Error: cmd: Command failed with exit code 8 at ChildProcess.whenDone (C:\nodist\bin\node_modules\cordova\src\superspawn.js:112:23) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:743:16) at Process.ChildProcess._handle.onexit (child_process.js:810:5) Unable to add platform android. Please see console for more info. I tried modifying both system variables and user PATH variables. THE WEIRD THING is that I can type in java -version and it works: java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) I am using nodist to manage npm if that is of any relevance.
tagged with: ionic-framework
possible better answer: http://stackoverflow.com/a/24463651
has answer: http://stackoverflow.com/a/29473804
has answer: http://stackoverflow.com/a/24463651
downvote count: 0
favorite count: 0
answer count: 5
tagged with: android
tagged with: windows
has answer: http://stackoverflow.com/a/22872052
type: AnsweredQuestion
tagged with: cordova
has title: Failed to run JAVA even though path is set on Windows 8 Enterprise - Cordova
has answer: http://stackoverflow.com/a/32880399
linked to: http://stackoverflow.com/q/20323787
has answer: http://stackoverflow.com/a/22869468
type: Question
score: 9
upvote count: 9

http://stackoverflow.com/comment/34896862
type: AnswerComment
type: Comment
score: 1
has text: I went with the HashMap because I have to format the values and because I'm modifying an existing system and I don't want to edit other programmers objects.
comment on: http://stackoverflow.com/a/22865974

http://stackoverflow.com/q/22811811
downvote count: 0
has body: Somehow the CTRL+SPACE handling in Eclipse changed twice in the last weeks when existing text stands after positions in which we use it. Let's say I want to create a BufferedReader for a file: BufferedReader reader = new BufferedReader(something.filename); Now I notice this doesn't work and I want to create a FileReader: BufferedReader reader = new BufferedReader(new FileReader[CURSORPOSITION]something.filename); However when I now hit CTRL+SPACE and choose the FileReader constructor from the list and hit ENTER, "something." (the part up to or including the space) gets deleted. Did this behaviour change recently and is it configurable? I remember being amazed that CTRL+SPACE handling somehow got better with a recent update but it seems it didn't last.
answer count: 1
favorite count: 0
has title: Eclipse CTRL+SPACE deletes text
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22812401
score: 2
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34789099
type: Question

http://stackoverflow.com/q/22890819
tagged with: bluej
score: 0
answer count: 1
has body: For some java homework we were told to create a program that makes collages, with one of the methods being that the one of the "fragments"(images) of the collage will be scaled by width and height. The pre-written class "fragment" already has a method to scale the image: public void scaleFragment(int newWidth, int newHeight) { width = newWidth; height = newHeight; } So in the main class I call up this method by doing this: public void makeTiles(int tileWidth, int tileHeight) { for (Fragment sm:collage){ Fragment.scaleFragment(tileWidth, tileHeight); } } When I try to run this however, I come up with this error: "non-static method scaleFragment (int,int) cannot be referencd from a static context" After reading up on this website I found that you needed to crate an instance of the class?so I did this: Fragment fragment = new Fragment(); for (Fragment sm:collage){ Fragment.scaleFragment(tileWidth, tileHeight); } This however comes up with the error "constuctor error in class fragment cannot be applied to given types" The main class has declaces the arraylist collage like this: Fragment fragment = new Fragment(); for (Fragment sm:collage){ Fragment.scaleFragment(tileWidth, tileHeight); } can anyone help me solve this problem? Thanks in advance.
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/290884
has answer: http://stackoverflow.com/a/22890839
tagged with: java
duplicate of: http://stackoverflow.com/q/290884
type: Question
has title: "non-static method cannot be referencd from a static context" - Java

http://stackoverflow.com/comment/34817334
score: 1
comment on: http://stackoverflow.com/q/22827673
has text: what is "almost sorted" array ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35002223
comment on: http://stackoverflow.com/q/22929819
has text: Instead of this create separate method to print value and write scanner code there. then call the method in loop and your data
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22964745
type: AnsweredQuestion
tagged with: conditional-statements
has answer: http://stackoverflow.com/a/22964783
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/8759868
upvote count: 1
possible better answer: http://stackoverflow.com/a/22964781
has body: assume I have something simple like this: if(condition_1 || condition_2) { do something } if condition_1 is true, does java go on and also check condition_2? I'm asking because I know if condition1 is true, condition2 will throw an error and I'm wondering if I need to make two seperate if's.
favorite count: 0
score: 0
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/22965328
has answer: http://stackoverflow.com/a/22964781
accepted answer: http://stackoverflow.com/a/22964783
duplicate of: http://stackoverflow.com/q/8759868
has title: how does java check conditions with logical operators
has comment: http://stackoverflow.com/comment/35065753

rest
tags question: http://stackoverflow.com/q/22868429
tags question: http://stackoverflow.com/q/22866653
tags question: http://stackoverflow.com/q/22808916
tags question: http://stackoverflow.com/q/22830967
tags question: http://stackoverflow.com/q/22880105
tags question: http://stackoverflow.com/q/22958966
tags question: http://stackoverflow.com/q/22946678
tags question: http://stackoverflow.com/q/22953714
tags question: http://stackoverflow.com/q/22918092
tags question: http://stackoverflow.com/q/22932468
tags question: http://stackoverflow.com/q/22892223
tags question: http://stackoverflow.com/q/22920383
tags question: http://stackoverflow.com/q/22834231
tags question: http://stackoverflow.com/q/22948173
tags question: http://stackoverflow.com/q/22943034
tags question: http://stackoverflow.com/q/22936821
tags question: http://stackoverflow.com/q/22872038
tags question: http://stackoverflow.com/q/22932730
tags question: http://stackoverflow.com/q/22854344
tags question: http://stackoverflow.com/q/22906218
tags question: http://stackoverflow.com/q/22837389
tags question: http://stackoverflow.com/q/22836448
tags question: http://stackoverflow.com/q/22908205
tags question: http://stackoverflow.com/q/22939248
tags question: http://stackoverflow.com/q/22957241
tags question: http://stackoverflow.com/q/22941330
tags question: http://stackoverflow.com/q/22840122
tags question: http://stackoverflow.com/q/22871450
tags question: http://stackoverflow.com/q/22860902
type: Tag
tags question: http://stackoverflow.com/q/22918231
tags question: http://stackoverflow.com/q/22819876
tags question: http://stackoverflow.com/q/22908335
tags question: http://stackoverflow.com/q/22890256
tags question: http://stackoverflow.com/q/22965197
tags question: http://stackoverflow.com/q/22899101
tags question: http://stackoverflow.com/q/22910580
tag name: rest
tags question: http://stackoverflow.com/q/22837257
tags question: http://stackoverflow.com/q/22870094
tags question: http://stackoverflow.com/q/22929499
tags question: http://stackoverflow.com/q/22933521
tags question: http://stackoverflow.com/q/22936367
tags question: http://stackoverflow.com/q/22872046
tags question: http://stackoverflow.com/q/22862140
tags question: http://stackoverflow.com/q/22913316

http://stackoverflow.com/q/22841368
has answer: http://stackoverflow.com/a/22841483
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22841442
score: 0
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34842000
has body: Is is okay to synchronize all methods which mutate the state of an object, but not synchronize anything which is atomic? In this case, just returning a field? Consider: public class A { private int a = 5; private static final Object lock = new Object(); public void incrementA() { synchronized(lock) { a += 1; } } public int getA() { return a; } } I've heard people argue that it's possible for getA() and incrementA() to be called at roughly the same time and have getA() return to wrong thing. However it seems like, in the case that they're called at the same time, even if the getter is synchronized you can get the wrong thing. In fact the "right thing" doesn't even seem defined if these are called concurrently. The big thing for me is that the state remains consistent. I've also heard talk about JIT optimizations. Given an instance of the above class and the following code(the code would be depending on a to be set in another thread): while(myA.getA() &lt; 10) { //incrementA is not called here } it is apparently a legal JIT optimization to change this to: int temp = myA.getA(); while(temp &lt; 10) { //incrementA is not called here } which can obviously result in an infinite loop. Why is this a legal optimization? Would this be illegal if a was volatile? Update I did a little bit of testing into this. public class Test { private int a = 5; private static final Object lock = new Object(); public void incrementA() { synchronized(lock) { a += 1; } } public int getA() { return a; } public static void main(String[] args) { final Test myA = new Test(); Thread t = new Thread(new Runnable(){ public void run() { while(true) { try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } myA.incrementA(); } }}); t.start(); while(myA.getA() &lt; 15) { System.out.println(myA.getA()); } } } Using several different sleep times, this worked even when a is not volatile. This of course isn't conclusive, it still may be legal. Does…
type: Question
has answer: http://stackoverflow.com/a/56151268
has title: Are java getters thread-safe?
has answer: http://stackoverflow.com/a/22841442
has comment: http://stackoverflow.com/comment/34842103
possible better answer: http://stackoverflow.com/a/22841416
has answer: http://stackoverflow.com/a/22841416
answer count: 5
has comment: http://stackoverflow.com/comment/34845668
has answer: http://stackoverflow.com/a/22841869

http://stackoverflow.com/comment/35008050
has text: The person is creating a frame into a class extending a frame. that is the wrong way and no comment was said on that
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22882528

multi-gpu
type: Tag
tags question: http://stackoverflow.com/q/22866901
tag name: multi-gpu

http://stackoverflow.com/q/22819319
tagged with: java
has answer: http://stackoverflow.com/a/22819581
type: Question
has body: I am new to run java files through shell script, this may be very basic question for those who are experienced or few knowledge in shell script. I have java file called Main.java under C:\project\Tranmissions\com.abc.files\src\main\java\com\abc\files +Main.java I have shell script called run.sh: #!/bin/bash java -Xmx300m -classpath com.abc.files.Main -mainclass com.abc.files.payroll.f401k.xyz.AdpCwMain -driver org.hsqldb.jdbc.JDBCDriver exit $? This script I have placed under C:\project\Tranmissions\com.abc.files. Now, I have downloaded cygwin to run the script as ./run.sh When I run this, I am getting following basic java error: java.lang.NoClassDefFoundError: com/abc/files/Main Caused by: java.lang.ClassNotFoundException: com.abc.files.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: com.abc.files.Main. Program will exit. Exception in thread "main" I am using STS(Eclipse) with maven command install to run the java files. and able to run my class "Main" java program.
score: 0
tagged with: bash
answer count: 3
tagged with: shell
tagged with: unix
has comment: http://stackoverflow.com/comment/34802753
type: UnansweredQuestion
has title: running java file from shell script
has comment: http://stackoverflow.com/comment/34803729
has comment: http://stackoverflow.com/comment/34802541
has answer: http://stackoverflow.com/a/22819489
has answer: http://stackoverflow.com/a/22819525

http://stackoverflow.com/a/22842201
answers question: http://stackoverflow.com/q/22841911
upvote count: 1
has body: -cp is used to set the classpath for the jar file, this flag is same as importing a jar file to eclipse and then use it. If you want to run without this flag, use should set the classpath first beforing running. export CLASSPATH=path/to/your/jarfile.jar If you already have some classpath set export CLASSPATH=$CLASSPATH:path/to/your/jarfile.jar If you want to include current directory export CLASSPATH=$CLASSPATH:path/to/your/jarfile.jar:.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/40600484
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22880287
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/68436596
has body: public boolean evenlySpaced(int a, int b, int c) { int[] jawn = {a, b, c}; java.util.Arrays.sort(jawn); if(a == b) { if(b == c) return true; } if(Math.abs(jawn[0] - jawn[1]) == Math.abs(jawn[1] - jawn[2])) return true; return false; }
has comment: http://stackoverflow.com/comment/68436653
has comment: http://stackoverflow.com/comment/68436751

http://stackoverflow.com/q/22900477
has answer: http://stackoverflow.com/a/75132808
has answer: http://stackoverflow.com/a/22900519
accepted answer: http://stackoverflow.com/a/22900521
upvote count: 40
possible better answer: http://stackoverflow.com/a/22900535
tagged with: ioexception
has answer: http://stackoverflow.com/a/22900535
tagged with: java
answer count: 5
has comment: http://stackoverflow.com/comment/122826415
has title: java IO Exception: Stream Closed
has body: This is the code I currently have: public class FileStatus extends Status{ FileWriter writer; public FileStatus(){ try { writer = new FileWriter("status.txt",true); } catch (IOException e) { e.printStackTrace(); } } public void writeToFile(){ String file_text= pedStatusText + " " + gatesStatus + " " + DrawBridgeStatusText; try { writer.write(file_text); writer.flush(); writer.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Everything works as expected (The file is written to when the writeToFile method is called). However when the writeToFile method is called a second time I get the following error: java.io.IOException: Stream closed at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder.java:45) at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:118) at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:135) at java.io.OutputStreamWriter.write(OutputStreamWriter.java:220) at java.io.Writer.write(Writer.java:157) at FileStatus.writeToFile(FileStatus.java:19) at MenuBar$9.actionPerformed(MenuBar.java:115) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.AbstractButton.doClick(AbstractButton.java:376) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Co…
has answer: http://stackoverflow.com/a/69490890
type: AnsweredQuestion
downvote count: 0
favorite count: 0
score: 40
has answer: http://stackoverflow.com/a/22900521
type: Question
has comment: http://stackoverflow.com/comment/34949171

http://stackoverflow.com/q/22889517
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22889526
has body: could someone please explain to me how to create a large arraylist of objects currently, this is what i have. public ArrayList particlecollection; public ParticleColl(Particle thorium) { particlecollection = new ArrayList&lt;Particle&gt;(); for(int i=1;i&lt;=100;i++) { particlecollection.add("Thorium",24.07); } System.out.println(particlecollection.get(3)); } The particlecollection.add("Thorium",24.07) is referring to a Particle class, which has 2 paramaters Particle(String name, double halflife) The error that I am being given is "cannot find symbol- method add(java.lang.string,double); maybe you meant add(Particle) or add(int,Particle). Thank you so much for your help in advance.
tagged with: arraylist
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22889526
possible better answer: http://stackoverflow.com/a/22889541
has answer: http://stackoverflow.com/a/22889541
has title: create a large arraylist

http://stackoverflow.com/q/22888694
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22378509
has comment: http://stackoverflow.com/comment/34928242
tagged with: java
downvote count: 2
tagged with: swing
type: Question
score: -2
has title: Unknown amount of pictures added
tagged with: jpanel
upvote count: 0
tagged with: layout
answer count: 1
favorite count: 0
tagged with: jlabel
has body: I'm trying to set up a something where I can display multiple pictures but I don't know the exact amount of photos I'm going to have. I was thinking about just adding a bunch of JLabels to a JPanel but I want them to be laid out nicely. So basically what I'm asking is how can I set up this display since I don't know the exact amount of pictures I'll have until I run the program.
has answer: http://stackoverflow.com/a/22889366

http://stackoverflow.com/a/22967791
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22967635
has comment: http://stackoverflow.com/comment/35070194
answers question: http://stackoverflow.com/q/22967635
type: Answer
has comment: http://stackoverflow.com/comment/35071833
upvote count: 1
has comment: http://stackoverflow.com/comment/35072226
has body: It seems that everytime you want to print the array, you are simply appending the text to whatever is already in the textview. A quick solution is to just set the text of the textview to an empty string before appending your new text. private void printArrayToScreen() { tv.setText(""); //Before printing your data clear the textview for(int i = 0; i &lt; row; i++) { for(int j = 0; j &lt; col; j++) { tv.append(array[i][j]+" "); } tv.append("\n"); } }

http://stackoverflow.com/comment/35000894
type: AnswerComment
comment on: http://stackoverflow.com/a/22911192
type: Comment
has text: edited the answer again. the output filename was your directory + jira number. Now it would put the file into that directory and give it the original name.
score: 1

http://stackoverflow.com/a/22953266
downvote count: 0
has body: As I know normalize() removes any redundant elements from the given path including single dot and double dot. Then why it removes \programs\ element? .. refers to the the parent directory. In other words, /programs brings you forward and /.. brings you back. The Javadoc of Path#normalize() states If a ".." is preceded by a non-".." name then both names are considered redundant (the process to identify such names is repeated until it is no longer applicable). So \\programs\\.. is redundant and removed. I can't answer your second question.
type: Answer
score: 3
answers question: http://stackoverflow.com/q/22953222
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22953222
type: AcceptedAnswer

http://stackoverflow.com/comment/34832037
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22835434
has text: Well, I make a difference between "cannot be done" and "you can do that but success is not guaranteed" ;)

http://stackoverflow.com/a/22904027
has body: As mentioned in the comments you are missing all the logic to determine if someone has won. Personally I think of the main in this case as: print the blank board while (done is false) player makes move check for win if true set done to true print board Then basically you need a function to make moves, someway in there to determine if it is X or O. Then a method to check for a win, this need only check based on last move since it was previously checked, or it probably easier to check all options. Finally print the updated board and upon exit of the loop you could print a win message. I find this breaks the program into a nice simple structure. This link has some code you could probably learn from. http://www3.ntu.edu.sg/home/ehchua/programming/java/JavaGame_TicTacToe.html Good luck
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22903224
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/22819507
has body: i have a error while running java project in netbeans java.io.FileNotFoundException: C:\firemonitor\build\web\images\2.jpg (The system cannot find the path specified) this is a image processing project i think their is problem in ij.jar or comm.jar file is their is any file comm.jar-1
has comment: http://stackoverflow.com/comment/34803051
has answer: http://stackoverflow.com/a/22825642
type: UnansweredQuestion
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/34802932
has comment: http://stackoverflow.com/comment/34803573
type: Question
tagged with: filenotfoundexception
score: 0
tagged with: file-io
answer count: 1
has title: java.io.FileNotFoundException: C:\firemonitor\build\web\images\2.jpg (The system cannot find the path specified)

http://stackoverflow.com/comment/34997012
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22926719
type: QuestionComment
has text: You're error should have been `PascalsTriangle.java:10: error: cannot find symbol`. Since you posted part of a stack trace, I assumed you had fixed the `size` issue already and had gotten the `NullPointerException`.

http://stackoverflow.com/comment/34788975
has text: Depends on the situation? Generally when there are more than 1 options there isn't an approach that is best suited for all situations.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22812104
score: 0

http://stackoverflow.com/comment/34985483
score: 0
has text: Are you using Java 7?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22920498

http://stackoverflow.com/comment/34994484
type: QuestionComment
has text: There's a basic problem here: what if the value was set, but to the default value?
score: 0
comment on: http://stackoverflow.com/q/22922751
type: Comment

http://stackoverflow.com/q/22959740
has comment: http://stackoverflow.com/comment/35054888
linked to: http://stackoverflow.com/q/15324143
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35054844
has answer: http://stackoverflow.com/a/22960673
duplicate of: http://stackoverflow.com/q/3052442
downvote count: 1
has answer: http://stackoverflow.com/a/22960341
has answer: http://stackoverflow.com/a/22960494
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/22959793
has title: difference between two java String assignment types
type: Question
has comment: http://stackoverflow.com/comment/35054793
upvote count: 0
has body: what is the difference between these two implementations : String s1 = "java"; and String s2 = new String("java"); is s1 is able to perform all the functions that s2 will do?? like to uppercase, append etc..
favorite count: 0
linked to: http://stackoverflow.com/q/3297867
linked to: http://stackoverflow.com/q/334518
answer count: 4
duplicate of: http://stackoverflow.com/q/3297867
linked to: http://stackoverflow.com/q/3052442

http://stackoverflow.com/comment/35095832
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22934824
has text: @happy I updated the answer with modified code from your question.
score: 0

http://stackoverflow.com/q/22958077
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: dictionary
upvote count: 4
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/22958268
type: Question
has body: NSDiacriticInsensitiveSearch in Xcode is a function that helps searching without taking care of the accent ex: "e"="é". This function shows the user all the results of the words starting/having "e" and "é" whether the user enters "e" or "é" What is the equivalent of this function on the android platform??
has title: NSDiacriticInsensitiveSearch equivalent in Android
tagged with: search
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/22958987

file
tags question: http://stackoverflow.com/q/22920521
type: Tag
tags question: http://stackoverflow.com/q/22922628
tags question: http://stackoverflow.com/q/22926386
tags question: http://stackoverflow.com/q/22883820
tags question: http://stackoverflow.com/q/22890803
tags question: http://stackoverflow.com/q/22819507
tags question: http://stackoverflow.com/q/22925919
tag name: file
tags question: http://stackoverflow.com/q/22813377
tags question: http://stackoverflow.com/q/22938552
tags question: http://stackoverflow.com/q/22885387
tags question: http://stackoverflow.com/q/22924073
tags question: http://stackoverflow.com/q/22907704
tags question: http://stackoverflow.com/q/22965246
tags question: http://stackoverflow.com/q/22885630
tags question: http://stackoverflow.com/q/22883406
tags question: http://stackoverflow.com/q/22958966
tags question: http://stackoverflow.com/q/22884990
tags question: http://stackoverflow.com/q/22879469
tags question: http://stackoverflow.com/q/22931743
tags question: http://stackoverflow.com/q/22952714
tags question: http://stackoverflow.com/q/22818650
tags question: http://stackoverflow.com/q/22882764
tags question: http://stackoverflow.com/q/22874800
tags question: http://stackoverflow.com/q/22954236
tags question: http://stackoverflow.com/q/22897673
tags question: http://stackoverflow.com/q/22920343
tags question: http://stackoverflow.com/q/22913800
tags question: http://stackoverflow.com/q/22935589
tags question: http://stackoverflow.com/q/22835230
tags question: http://stackoverflow.com/q/22955178
tags question: http://stackoverflow.com/q/22940778
tags question: http://stackoverflow.com/q/22862951
tags question: http://stackoverflow.com/q/22946736
tags question: http://stackoverflow.com/q/22875248
tags question: http://stackoverflow.com/q/22870366
tags question: http://stackoverflow.com/q/22848031
tags question: http://stackoverflow.com/q/22811478
tags question: http://stackoverflow.com/q/22940242
tags question: http://stackoverflow.com/q/22888513
tags question: http://stackoverflow.com/q/22895091
tags question: http://stackoverflow.com/q/22915430
tags question: http://stackoverflow.com/q/22929248
tags question: http://stackoverflow.com/q/22873597
tags question: http://stackoverflow.com/q/22851581
tags question: http://stackoverflow.com/q/22846891
tags question: http://stackoverflow.com/q/22950587
tags question: http://stackoverflow.com/q/22852407
tags question: http://stackoverflow.com/q/22836732
tags question: http://stackoverflow.com/q/22905396
tags question: http://stackoverflow.com/q/22859453
tags question: http://stackoverflow.com/q/22898437

http://stackoverflow.com/comment/35033016
has text: Then I would suggest that you're using a keyboard different from mine. What key does the "@" character reside with?
score: 0
comment on: http://stackoverflow.com/q/22919591
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22856399
has body: Seems the question is kind of vague and it is hard to tell without knowing your intention. If you want to enhance the behavior of your class in runtime, then you may look into something like Javassit or CGLib etc, which allow you to alter the classes and add new feature to it, without need of modifying source code of the original source. If you are developing something, and trying to find a design that will allow you to add functionality without changing source code of existing classes, then you may look into things like Dectorator pattern. If you simply have that three class on hand and you don't want to/not allowed to modify them but you still want to add functionality without updating them. Then it is not possible in Java, sorry. (A lot other languages provide such feature anyway)
score: 0
answers question: http://stackoverflow.com/q/22856229
type: Answer

http://stackoverflow.com/q/22908335
has comment: http://stackoverflow.com/comment/34970326
tagged with: java
has comment: http://stackoverflow.com/comment/34965925
type: Question
has comment: http://stackoverflow.com/comment/34965268
has comment: http://stackoverflow.com/comment/34970451
accepted answer: http://stackoverflow.com/a/22916070
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34966286
has body: I am using JAX-RS client to consume REST API. I didn't want to let JAX-RS throw bunch of exceptions, so I am inspecting Response object myself. Sometimes however, I care only about certain status codes and I would like JAX-RS to fall back to default behavior and throw an actual exception (that will be handled by an AOP advice). Is there a simple way of doing this? public void delete(long id) { Response response = client.delete(id); Response.Status status = Response.Status.fromStatusCode(response.getStatus()); if (status == Response.Status.OK) { return; } if (status == Response.Status.NOT_FOUND) { throw new TeamNotFoundException(); } if (status == Response.Status.CONFLICT) { throw new TeamHasAssignedUsersException(); } // if status was internal server error or something similar, // throw whatever exception you would throw at first place // magic.throwException(response) }
has comment: http://stackoverflow.com/comment/34963166
tagged with: rest
has comment: http://stackoverflow.com/comment/34970564
has comment: http://stackoverflow.com/comment/34969508
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/34965732
favorite count: 0
has title: JAX-RS: Convert Response to Exception
score: 6
has answer: http://stackoverflow.com/a/22916070
upvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/comment/34931444
type: Comment
has text: Check to make sure you have all the parameters set correctly and that the production access is granted to the email address you are using in your Java code. I tried to get access to SES, but they said they were worried about spam and never said why! Good luck.
comment on: http://stackoverflow.com/q/22890702
score: 0
type: QuestionComment

http://stackoverflow.com/q/22942608
type: AnsweredQuestion
has body: After upgrading SonarQube from 4.0 to 4.2, I got a bunch of 'Unused private fields should be removed' errors from the classes with Lombok annotations. I have @SuppressWarnings("PMD.UnusedPrivateField") declared at the beginning of all those classes. It worked fine when I was using SonarQube 3.7 and 4.0. I use mvn sonar:sonar to generate the SonarQube report. And this shows how my class look like: @Data @SuppressWarnings("PMD.UnusedPrivateField") public class MyClass { private String field; } How can I get rid of those errors in version 4.2? Thanks.
upvote count: 3
tagged with: java
type: Question
tagged with: lombok
score: 3
has title: sonarqube 4.2 and lombok
tagged with: sonarqube
has answer: http://stackoverflow.com/a/22946819
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/27196995
favorite count: 0
has answer: http://stackoverflow.com/a/27196995
accepted answer: http://stackoverflow.com/a/22946819

http://stackoverflow.com/q/22920125
has answer: http://stackoverflow.com/a/22920364
upvote count: 1
has comment: http://stackoverflow.com/comment/34986339
linked to: http://stackoverflow.com/q/9230660
has body: How get url from iterator, I'm using jsoup. I tried to do urls.add(ite.next().parentNode().attributes().asList().get(0).toString()); but the value is not what need.
tagged with: java
has answer: http://stackoverflow.com/a/22921094
tagged with: jsoup
has comment: http://stackoverflow.com/comment/34984793
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34984776
type: Question
tagged with: android
score: 1
favorite count: 0
has title: How to get url from iterator?
has comment: http://stackoverflow.com/comment/34984563
has comment: http://stackoverflow.com/comment/34984560
answer count: 2

http://stackoverflow.com/a/22911053
has body: You must create a Message and send by handler, not "share" variables. Message msg = new Message(); msg.what = ...; msg.obj = ...; .... handler.sendMessage(msg);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22901929

http://stackoverflow.com/comment/35009239
type: Comment
type: QuestionComment
has text: @Egor - You're actually answering the question. Write your comment as answer!
comment on: http://stackoverflow.com/q/22922529
score: 0

http://stackoverflow.com/comment/34938725
comment on: http://stackoverflow.com/q/22894748
type: Comment
has text: Show us the stack trace ...
type: QuestionComment
score: 0

http://stackoverflow.com/a/22895498
answers question: http://stackoverflow.com/q/22895177
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34940703
upvote count: 1
type: AcceptedAnswer
has body: I can't understand your code, but here's how to achieve your stated intention with just 3 lines: String document; // read from somewhere List&lt;List&lt;String&gt;&gt; words = new ArrayList&lt;&gt;(); for (String sentence : document.split("[.?!]\\s*")) words.add(Arrays.asList(sentence.split("[ ,;:]+"))); If you want to convert the Lists to arrays, use List.asArray(), but I wouldn't recommend it. Lists are far easier to deal with than arrays. For one, they expand automatically (one reason why the above code is so dense). Addendum: (most) characters don't need escaping inside a character class.
accepted answer of: http://stackoverflow.com/q/22895177
has comment: http://stackoverflow.com/comment/34940420

http://stackoverflow.com/a/43712420
has comment: http://stackoverflow.com/comment/80047333
downvote count: 2
upvote count: 1
answers question: http://stackoverflow.com/q/22938689
type: Answer
has body: org.apache.maven.plugins maven-compiler-plugin 1.8 1.8 This is the important plugin that should be in pom.xml. I spent my two days debugging and researching. This was the solution. This is Apache plugin to tell maven to use the the given Compiler.
score: -1

http://stackoverflow.com/comment/35059897
type: QuestionComment
comment on: http://stackoverflow.com/q/22961067
score: 1
has text: as I said, I just want to fetch some result from another sevlet and react to it
type: Comment

http://stackoverflow.com/comment/34878371
score: 0
type: QuestionComment
type: Comment
has text: @shayanpourvatan by which method? There is no rootView.addView().
comment on: http://stackoverflow.com/q/22861627

http://stackoverflow.com/a/22871371
answers question: http://stackoverflow.com/q/22869740
has body: The next code starts an executor and schedule the tasks to acomplish your framerate. Running this on Windows for 3 seconds the last trace I have indicates 179 tasks so almost the 60 tasks per second that you want to acomplish. Try this code and let me know if improves your performance: package com.nosolojava.test; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import java.util.logging.Logger; public class FrameRateExecutor { private final Logger logger = Logger.getLogger(this.getClass().getCanonicalName()); final static long framerate = 1000 / 60; // number of frames counted this second AtomicInteger frameCount = new AtomicInteger(0); ScheduledExecutorService executor; private volatile AtomicBoolean running = new AtomicBoolean(false); class Task implements Runnable { private final long lastTaskTimeStamp; public Task() { super(); //get creation time so we can calculate delay after this.lastTaskTimeStamp = System.currentTimeMillis(); } public void run() { // TODO implement logic logger.log( Level.INFO, String.format("Do something, framecount: %02d %d", frameCount.addAndGet(1), System.currentTimeMillis())); //calculate when to execute next task and submit long currentTime = System.currentTimeMillis(); long elapsed = currentTime - lastTaskTimeStamp; long delay = (framerate - elapsed) +framerate; logger.log(Level.INFO, String.format("elapsed %04d delay %04d", elapsed, delay)); //check finish condition if (running.get()) { executor.schedule(new Task(), delay, TimeUnit.MILLISECONDS); } } }; public void stop() { running.set(false); executor.shutdown(); try { executor.awaitTermination(3, TimeUnit.SECONDS); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Error stopping executor", e); } } public void start() { //check if is already up…
has comment: http://stackoverflow.com/comment/34896153
has comment: http://stackoverflow.com/comment/34900912
downvote count: 0
has comment: http://stackoverflow.com/comment/34897063
has comment: http://stackoverflow.com/comment/34896922
has comment: http://stackoverflow.com/comment/34900811
score: 1
has comment: http://stackoverflow.com/comment/34896957
upvote count: 1
has comment: http://stackoverflow.com/comment/34896279
type: Answer

http://stackoverflow.com/comment/34993959
has text: I don't think just zipping the project will work because of the library pointers to places outside the project folder
type: Comment
comment on: http://stackoverflow.com/q/22919220
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34997357
score: 0
has text: I want to send a synchronous request to server from a little piece of JSP page, as it was a call to a simple method of a class, but I do not want to use 'scriptlets'. For example, in JSF is possible make this calls separately to Managed Beans methods like this: #{class.method}, and It returns some value. But in my case I'm using JSP-servlets structure and I do not want to reload the whole JSP page for each separate request. I want to know if is it possible?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22926847

http://stackoverflow.com/a/22852103
answers question: http://stackoverflow.com/q/22851792
type: Answer
has body: Honestly there is no regulation that says we have to use code blocks. Syntax typically says that after we read the if we are looking for only one statement if your condition contains multiple statements then we do have to block that code up, another thing is try to keep that indentation whenever you enter methods conditions and then statements. Id love to write the easy route to get the output you desire. Think about this why are you sending these methods arrays? What is stopping you from simply looping in your main method and passing each iteration to these methods sum lucky, even...Your variables should usually be initialized at top or at the beginning of a method to have those around the life of a methods execution.Below is clearly not compile ready code, however this will edge you in the right place to understand this problem more than use brackets. boolean isLucky; int[] IntegerArray; Scanner scan; //Final for constant values Typically these would be in all uppercase to indicate to //other that this is a final anywhere //in this class those will stick out. final int luckyOne = 7; final int luckyTwo = 13; final int luckyThree = 18; for(int i=0;i&lt;IntegerArray.length;i++){ //snag me Boolean value for this number isLucky(); if(isLucky)//example of completely legal if statement adding a system.out statement //means yes i have to block this sum(i); else even(i); }
score: 0

http://stackoverflow.com/comment/35073715
score: 0
type: Comment
has text: Hi Alexey thanks for the procedure. PDF its working fine and i could able to use images as well with the above solution, but DocFlavor dont have options to specify word document. Is there a way for printing Doc or Docx with any open source API's. I am checking Apache POI but couldn't figure out exactly how to print word document.
type: AnswerComment
comment on: http://stackoverflow.com/a/22873246

http://stackoverflow.com/comment/35010710
type: AnswerComment
score: 0
type: Comment
has text: At this point, why not to write `{@literal <myemail@gmail.com>}`?
comment on: http://stackoverflow.com/a/22934674

http://stackoverflow.com/a/22910887
downvote count: 0
has comment: http://stackoverflow.com/comment/34967538
has comment: http://stackoverflow.com/comment/34967762
type: Answer
has comment: http://stackoverflow.com/comment/34967689
answers question: http://stackoverflow.com/q/22910611
upvote count: 2
has comment: http://stackoverflow.com/comment/34968012
has body: In addition to James_D's answer, I recommend to use the fx:root construct. Then you can inject the custom control (implemented by a controller) in another controller using the @FXML annotation.
score: 2

http://stackoverflow.com/q/22870488
has title: How do you set an ObjectCodec on a JsonParser when not going through an ObjectMapper?
has answer: http://stackoverflow.com/a/22871701
type: Question
score: 3
tagged with: java
upvote count: 3
answer count: 2
has body: Note: this is using Jackson 2.3.2 For the needs of one of my projects, I am writing a custom JsonParser which records a Map where keys are JsonPointers and values are Integers (line numbers where the pointer points to). The class is named LineRecorderJsonParser. It is produced by a LineRecorderJsonFactory which is a simple delegate: public final class LineRecorderJsonFactory extends JsonFactory { @Override protected JsonParser _createParser(final InputStream in, final IOContext ctxt) throws IOException, JsonParseException { final JsonParser parser = super._createParser(in, ctxt); return new LineRecorderJsonParser(parser); } @Override protected JsonParser _createParser(final Reader r, final IOContext ctxt) throws IOException, JsonParseException { final JsonParser parser = super._createParser(r, ctxt); return new LineRecorderJsonParser(parser); } @Override protected JsonParser _createParser(final byte[] data, final int offset, final int len, final IOContext ctxt) throws IOException, JsonParseException { final JsonParser parser = super._createParser(data, offset, len, ctxt); return new LineRecorderJsonParser(parser); } } I have tested that the code works using the following code: public static void main(final String... args) throws IOException { final JsonFactory factory = new LineRecorderJsonFactory(); final ObjectMapper mapper = new ObjectMapper(factory); final Closer closer = Closer.create(); final InputStream in; try { in = closer.register(LineTesting.class.getResourceAsStream ("/testfile.json")); mapper.readTree(in); } finally { closer.close(); } } But now I want to test it; so I wrote the following test code: public final class LineRecorderJsonParserTest { private static final String INCORRECT_LINE_INFO = "generated line info is incorrect; expected: %s, actual: %s"; private JsonFactory factory; private ObjectMapper mapper; @BeforeMethod public void initFactory() { factory = new LineRecorderJsonFactory(); mapper = new ObjectMapper(); } @DataProvider public Iterato…
tagged with: jackson
favorite count: 0
has answer: http://stackoverflow.com/a/22870763
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22965738
has comment: http://stackoverflow.com/comment/35109878
has answer: http://stackoverflow.com/a/48320459
has comment: http://stackoverflow.com/comment/35110469
has comment: http://stackoverflow.com/comment/35066731
has comment: http://stackoverflow.com/comment/35066597
has answer: http://stackoverflow.com/a/22966568
has comment: http://stackoverflow.com/comment/35066903
has comment: http://stackoverflow.com/comment/35110132
favorite count: 0
upvote count: 20
has comment: http://stackoverflow.com/comment/35067299
answer count: 5
has comment: http://stackoverflow.com/comment/35110994
has body: I have this servlet based web application project in eclipse and want to append some html tags like &lt;script src="Chart.js"&gt;. The folder structure is: C:/apache-tomcat-7.0.53/ my workspace is in D:/../../workplace/CpdApplication/src/cpd/MyServlet.java cpd contains: MyServlet.java, Chart.js and other files. CpdApplication/WebContent/META-INF/web.xml I have some path problems, and I can't resolve them, I searched over and over again and still not working, I get a 404 (Not Found) for http://localhost:8080/CpdApplication/Chart.js. The problem is when I want to append &lt;script src='Chart.js'&gt;&lt;/script&gt;, Tomcat cannot resolve the Chart.js static file.
has comment: http://stackoverflow.com/comment/35110005
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/48320459
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35066492
has answer: http://stackoverflow.com/a/22990817
has comment: http://stackoverflow.com/comment/35067060
tagged with: servlets
type: Question
score: 20
has comment: http://stackoverflow.com/comment/35110640
has comment: http://stackoverflow.com/comment/35097511
has answer: http://stackoverflow.com/a/58952782
has answer: http://stackoverflow.com/a/22983174
accepted answer: http://stackoverflow.com/a/22983174
tagged with: tomcat
has title: How to serve static files in my web application on Tomcat

http://stackoverflow.com/comment/34837662
type: Comment
comment on: http://stackoverflow.com/a/22837145
has text: That's not the reason or the crux of this question and has nothing to do with it.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35061476
type: Comment
has text: This above mentioned jsp has 'policydocumentsetform' as its command name,which is related to the parent form containing the arraylist. The form bean structures whcih u have mentioned earlier is similar to that of mine.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22936209

infinite-loop
tags question: http://stackoverflow.com/q/22874439
tags question: http://stackoverflow.com/q/22875743
tags question: http://stackoverflow.com/q/22900587
type: Tag
tag name: infinite-loop

http://stackoverflow.com/q/22907559
has title: Editable to string Crash
has comment: http://stackoverflow.com/comment/34961563
type: Question
has comment: http://stackoverflow.com/comment/34961522
score: 0
tagged with: crash
has comment: http://stackoverflow.com/comment/34961494
has answer: http://stackoverflow.com/a/22907792
has answer: http://stackoverflow.com/a/22907650
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/22907719
has body: I made this code and the program crashes when I try to convert the editable's value to an integer since the texted it type is decimal, and I suspect it's at the point when the application must change the editable to string, due to the fact when the edit text is empty after editing the text it crashes. EditText Y = (EditText) findViewById(R.id.y); Y.addTextChangedListener(new TextWatcher(){ @Override public void afterTextChanged(Editable s) { if(s != null){ int Yvalue = Integer.parseInt(s.toString()); } }
tagged with: android-edittext
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34961507
tagged with: java

http://stackoverflow.com/a/22878169
answers question: http://stackoverflow.com/q/22876460
score: 0
has body: I suggest h2 http://www.h2database.com/html/main.html It's java, it can load sql, it will create a db file if you use file mode
type: Answer

http://stackoverflow.com/q/22887615
tagged with: weblogic
has title: Weblogic setting for proxy
has comment: http://stackoverflow.com/comment/34935272
tagged with: proxy
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/120797
possible better answer: http://stackoverflow.com/a/31728987
tagged with: proxyselector
has answer: http://stackoverflow.com/a/31728987
has comment: http://stackoverflow.com/comment/34929301
accepted answer: http://stackoverflow.com/a/22918713
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22918713
type: Question
has body: I have a problem with configuration of proxy to connect to WebService on Weblogic 10.3.5. I cannot use System.setProperty() because it has to be per connection aproach. Proxy which I have to use has to have "UserAgent" header. I have tried two options: ClientProxyFeature but it doesn't work because it generate request to proxy without "UserAgent header". ProxySelector: this approach work great on JUnit test but when I run it on Weblogic I receive following error error: java.net.SocketException: Unknown proxy type : HTTP at... Is there any way to work this around? Many Thanks in advance Adam

lock-free
tag name: lock-free
type: Tag
tags question: http://stackoverflow.com/q/22923370

http://stackoverflow.com/a/22940035
has comment: http://stackoverflow.com/comment/35022965
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35020526
has comment: http://stackoverflow.com/comment/35020309
has body: First thing I see is how you're retrieving the group of &lt;li&gt; nodes. Just looking at your @class attribute, you can't really tell how many spaces are in "featured block twoblock boxshadow", but that XPath will only return a result if it is exactly equal to it. In that regard, try using something more flexible like contains(), i.e. //li[contains(@class, 'featured block')]. Without seeing what source you're targeting I can't suggest much more, but will update the answer when it's added to the question. I've tried your XPath (just the /div part, since that's what was provided) on the given snippet and got back &lt;span class="tel" itemprop="telephone"/&gt; as a result. Looks like an issue with how you're retrieving the &lt;li&gt; company nodes. Update 2: From your updated XML snippet, your first XPath //li[@class='featured block twoblock boxshadow']" doesn't look like it will match the parent &lt;li&gt; node, based on what I mentioned with the spaces before. Secondly if it did, you are checking the &lt;li&gt; node's attributes twice on separate queries, and assuming that the index you're giving the data-pvd-p value (starts at 3 in the snippet) will always match the list index (starts at 0, with your +1 added). I'd suggest removing this portion //li[@data-pvd-p='"+j+1+"'] and beginning with the //div. So something like this: List&lt;DomNode&gt; companies = (List&lt;DomNode&gt;) page.getByXPath("//li[contains(@class, 'featured block']"); for (DomNode node : companies) { // retrieve telephone number DomNode telephone = (DomNode) node.getByXPath( "div[@class='listingWrapper']/div[@class='itemInfo']/span[@class='tel']").get(0);
has comment: http://stackoverflow.com/comment/35022134
has comment: http://stackoverflow.com/comment/35022631
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35021345
has comment: http://stackoverflow.com/comment/35020750
accepted answer of: http://stackoverflow.com/q/22939721
answers question: http://stackoverflow.com/q/22939721
type: Answer
has comment: http://stackoverflow.com/comment/35053462
has comment: http://stackoverflow.com/comment/35033193
has comment: http://stackoverflow.com/comment/35021856

http://stackoverflow.com/a/22928347
type: Answer
has comment: http://stackoverflow.com/comment/35000184
accepted answer of: http://stackoverflow.com/q/22928247
answers question: http://stackoverflow.com/q/22928247
has comment: http://stackoverflow.com/comment/35000421
has comment: http://stackoverflow.com/comment/35001265
has comment: http://stackoverflow.com/comment/38903316
has comment: http://stackoverflow.com/comment/35000793
score: 0
has comment: http://stackoverflow.com/comment/35000272
has comment: http://stackoverflow.com/comment/35000365
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35000690
has comment: http://stackoverflow.com/comment/35000170
has comment: http://stackoverflow.com/comment/35000962
has body: Try this: Date inputDate = new Date(); LocalDate date = inputDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); I found this duplicated post after answer: Convert java.util.Date to java.time.LocalDate

http://stackoverflow.com/comment/34922553
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22882430
type: QuestionComment
has text: The missing 8kB are always at the start of the file.

http://stackoverflow.com/a/22812460
type: Answer
has body: Use an external bean holding data you want to pass between step; this external bean is not persisted and you need to wire into your SB artifacts or listeners.
has comment: http://stackoverflow.com/comment/60227412
upvote count: 1
has comment: http://stackoverflow.com/comment/60229939
answers question: http://stackoverflow.com/q/22810776
has comment: http://stackoverflow.com/comment/35045946
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35045770

http://stackoverflow.com/a/22879457
accepted answer of: http://stackoverflow.com/q/22879412
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34911118
has comment: http://stackoverflow.com/comment/34911347
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22879412
has body: Checkout https://github.com/frakbot/GlowPadBackport Example on Google Play: https://play.google.com/store/apps/details?id=net.sebastianopoggi.samples.ui.GlowPadSample
has comment: http://stackoverflow.com/comment/34911418

http://stackoverflow.com/q/22898996
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/22908743
has answer: http://stackoverflow.com/a/22908743
type: Question
has comment: http://stackoverflow.com/comment/34963263
downvote count: 0
has title: how to remove unwanted lines/noise in OpenCV?
accepted answer: http://stackoverflow.com/a/22924421
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23299330
score: 3
tagged with: android
tagged with: c++
has body: i am developing an OCR app for android(building as java Application). i want to detect text from an image captured from camera and for pre-processing i am using OpenCV,but i am getting some extra lines which are being read as text,i have followed this approach: 1-RGB to GreyScale 2-Threshold 3-Gaussian Blur 4-Median Blur 5-Dilation 6-Erosion results are atleast better than before but still not getting the right results. how can i remove this noise,what is a general sequence of filters like these that can be applied to any image to improve result for OCR. i am new to OpenCV so please guide me through. Thanks. old Image Updated Image from the above image i am able to find result from no 3,but only when all contours are drawn which is somthing that i dont want as there is noise also.what am i missing here.dont know what to do further. Revised Code: package simple_contours; import java.util.ArrayList; import java.util.List; import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.core.MatOfPoint; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.core.Size; import org.opencv.highgui.Highgui; import org.opencv.imgproc.Imgproc; public class Main { public static void main(String[] args) { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); Mat src_img,src_grey,src_blur,src_thresh,src_dilate,dest_img; src_img=Highgui.imread("n_num.jpg",Imgproc.COLOR_BGR2GRAY); src_grey=new Mat(src_img.size(), Core.DEPTH_MASK_8U); src_blur=new Mat(src_img.size(), Core.DEPTH_MASK_8U); src_thresh=new Mat(src_img.size(), Core.DEPTH_MASK_8U); src_dilate=new Mat(src_img.size(), Core.DEPTH_MASK_8U); dest_img=Mat.zeros(640,480, CvType.CV_8UC3); Core.bitwise_not(dest_img, dest_img); Highgui.imwrite("dest.jpg", dest_img); Imgproc.cvtColor(src_img, src_grey, Imgproc.COLOR_BGR2GRAY); Imgproc.GaussianBlur(src_grey, src_blur, new Size(3, 3), 0); Imgproc.threshold(src_blur, src_thresh, 80, 255, Imgproc.THRE…
has answer: http://stackoverflow.com/a/22924421
tagged with: opencv
type: AnsweredQuestion

http://stackoverflow.com/q/22867286
linked to: http://stackoverflow.com/q/7255592
has answer: http://stackoverflow.com/a/69036682
answer count: 5
accepted answer: http://stackoverflow.com/a/22868706
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
has answer: http://stackoverflow.com/a/41542026
tagged with: java
linked to: http://stackoverflow.com/q/23220542
tagged with: nio
type: Question
possible better answer: http://stackoverflow.com/a/41542026
has answer: http://stackoverflow.com/a/24757556
downvote count: 0
has answer: http://stackoverflow.com/a/22868706
has answer: http://stackoverflow.com/a/22868789
has title: Files.walk(), calculate total size
upvote count: 28
has body: I'm trying to calculate the size of the files on my disc. In java-7 this could be done using Files.walkFileTree as shown in my answer here. However if i wanted to do this using java-8 streams it will work for some folders, but not for all. public static void main(String[] args) throws IOException { long size = Files.walk(Paths.get("c:/")).mapToLong(MyMain::count).sum(); System.out.println("size=" + size); } static long count(Path path) { try { return Files.size(path); } catch (IOException | UncheckedIOException e) { return 0; } } Above code will work well for path a:/files/ but for c:/ it will throw below exception Exception in thread "main" java.io.UncheckedIOException: java.nio.file.AccessDeniedException: c:\$Recycle.Bin\S-1-5-20 at java.nio.file.FileTreeIterator.fetchNextIfNeeded(Unknown Source) at java.nio.file.FileTreeIterator.hasNext(Unknown Source) at java.util.Iterator.forEachRemaining(Unknown Source) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) at java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) at java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.util.stream.LongPipeline.reduce(Unknown Source) at java.util.stream.LongPipeline.sum(Unknown Source) at MyMain.main(MyMain.java:16) I understand where it is coming from and how to avoid it using Files.walkFileTree API. But how can this exception be avoided using Files.walk() API?
favorite count: 0
score: 28

http://stackoverflow.com/comment/34881040
type: Comment
has text: is onSubmit a java function or a javascript function?
comment on: http://stackoverflow.com/q/22863165
type: QuestionComment
score: 0

http://stackoverflow.com/q/22851509
has answer: http://stackoverflow.com/a/22854827
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
tagged with: cucumber
tagged with: gherkin
answer count: 1
downvote count: 0
favorite count: 0
has title: Test Framework - Cucumber with JSON instead of Gherkin Feature file
type: UnansweredQuestion
has body: I have a Test Automation Framework project where I have to use a JSON file instead of a Gherkin Feature file integrated with Cucumber and Java. Instead of reading from feature file, Cucumber should read test cases from JSON. I am doing some research for the best possible approach in this scenario. Please share any experience, thoughts or peace of information.

http://stackoverflow.com/q/22820394
tagged with: java
has answer: http://stackoverflow.com/a/22820480
has body: I need to get the console output of a JAR file in my GUI application. Im running the JAR calling the command line from my GUI application, as you can see below: String cmdLine = "java -jar myjar.jar"; myProcess = Runtime.getRuntime().exec(cmdLine); BufferedReader input = new BufferedReader(new InputStreamReader(myProcess.getInputStream())); while ((line = input.readLine()) != null) { //do something } In myjar.JAR, I created a CustomPrintStream in order to log everything to a txt file AND the console. Here it is: public class CustomPrintStream extends PrintStream { static private FileHandler fileTxt; Logger logger; public CustomPrintStream() { super(new ByteArrayOutputStream()); try { this.logger = Logger.getLogger("LOGGER"); this.logger.setLevel(Level.INFO); fileTxt = new FileHandler("Logging.txt"); } catch (Exception ex) { // do nothing! } CustomRecordFormatter formatter = new CustomRecordFormatter(); this.fileTxt.setFormatter(formatter); this.logger.addHandler(fileTxt); ConsoleHandler ch = new ConsoleHandler(); ch.setFormatter(formatter); logger.addHandler(ch); logger.setUseParentHandlers(false); } @Override public void print(String s) { super.print(s); logger.info(s); } } Also, I set the standard output of myjar.JAR to the custom stream: System.setOut(CustomPrintStream); Running the JAR file in windows command line works fine, but when I try to get console output programmatically in my GUI application it just doesn't work. Does anyone know the solution?
downvote count: 1
answer count: 1
has title: Standard Output in Java
accepted answer: http://stackoverflow.com/a/22820480
type: AnsweredQuestion
upvote count: 0
tagged with: outputstream
favorite count: 0
type: Question
tagged with: logging
score: -1

http://stackoverflow.com/comment/34998843
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22927676
has text: Yes, it's confusing. Despite that, my answer is correct, so if you downvoted, please undo it. **Also**, you say *"value mean, copy of the data inside the variable..."*, but note that an object's value is a *reference*.
type: Comment

http://stackoverflow.com/comment/34955974
type: Comment
comment on: http://stackoverflow.com/a/22899147
score: 0
type: AnswerComment
has text: @fluffy: I have updated the answer with references too SeekableDevice concept.

http://stackoverflow.com/comment/34783707
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22808853
type: Comment
has text: Or you could just notice that each digit is a multiple of 3... :P 6336/3 = 2112

http://stackoverflow.com/q/22849611
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34857239
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34885939
type: Question
has body: I finally got to compile the android sample of the cardreader without errors (SDK 4.4.2), but when I run it on my Samsung S4 (Android 4.4.2) it immediately crashes! Does anybody knows the reason and a solution? That's the cardreader: https://developer.android.com/samples/CardReader/index.html I also got a Nexus 7 and there the app crashes too! Here's the logcat: 04-03 23:38:23.280: D/AndroidRuntime(2493): Shutting down VM 04-03 23:38:23.280: W/dalvikvm(2493): threadid=1: thread exiting with uncaught exception (group=0x41f07ba8) 04-03 23:38:23.280: E/AndroidRuntime(2493): FATAL EXCEPTION: main 04-03 23:38:23.280: E/AndroidRuntime(2493): Process: com.example.nfctest, PID: 2493 04-03 23:38:23.280: E/AndroidRuntime(2493): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.nfctest/com.example.nfctest.MainActivity}: android.view.InflateException: Binary XML file line #45: Error inflating class fragment 04-03 23:38:23.280: E/AndroidRuntime(2493): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 04-03 23:38:23.280: E/AndroidRuntime(2493): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 04-03 23:38:23.280: E/AndroidRuntime(2493): at android.app.ActivityThread.access$800(ActivityThread.java:135) 04-03 23:38:23.280: E/AndroidRuntime(2493): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 04-03 23:38:23.280: E/AndroidRuntime(2493): at android.os.Handler.dispatchMessage(Handler.java:102) 04-03 23:38:23.280: E/AndroidRuntime(2493): at android.os.Looper.loop(Looper.java:136) 04-03 23:38:23.280: E/AndroidRuntime(2493): at android.app.ActivityThread.main(ActivityThread.java:5017) 04-03 23:38:23.280: E/AndroidRuntime(2493): at java.lang.reflect.Method.invokeNative(Native Method) 04-03 23:38:23.280: E/AndroidRuntime(2493): at java.lang.reflect.Method.invoke(Method.java:515) 04-03 23:38:23.280: E/AndroidRuntime(2493): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run…
has comment: http://stackoverflow.com/comment/34866202
score: 0
has title: Android Sample CardReader crashes

http://stackoverflow.com/comment/34884086
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22864131
type: Comment
has text: Thanks Meno, that would be great if I could edit the beans/entities, which I'm not allowed to. However I've found a way to write the automatically generated Database schema to a file, so from there I should be able to edit the VARBINARY and force Hibernate to use that one... I hope :)

http://stackoverflow.com/comment/35045857
score: 2
has text: YES!!! i will try to restart eclipse.After a restart all works already fine thank you.
type: AnswerComment
comment on: http://stackoverflow.com/a/22953119
type: Comment

http://stackoverflow.com/comment/35010813
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22932060
has text: See this posts: http://stackoverflow.com/questions/11213160/sending-utf-8-values-in-http-headers-results-in-mojibake http://stackoverflow.com/questions/1432233/asp-net-download-file-with-japanese-file-name

http://stackoverflow.com/comment/92489943
score: 0
has text: Unfortunately I don't think you can inject an instance of UserRepo into UserRepoImpl because UserRepoImpl is used by UserRepo so at time of bean creation of UserRepoImpl, UserRepo isn't fully-created/registered yet. At least I found that to be true with spring data starter 2.0.5.RELEASE
type: Comment
comment on: http://stackoverflow.com/a/22867393
type: AnswerComment

http://stackoverflow.com/a/22904506
answers question: http://stackoverflow.com/q/22904438
has body: The way you check for a row's existence is wrong. Take a look at your query: "SELECT * FROM tokens WHERE PlayerName = '" + name + "' If a player does not exist in the table, this query will return 0 rows, not a row with null for the player's name, like you're checking now. Instead, you should check if the ResultSet has a row: ResultSet res = statement.executeQuery("SELECT * FROM tokens WHERE PlayerName = '" + name + "';"); int tokens = 0; if (res.next()) { Statement statement = connection.createStatement(); statement.executeUpdate("INSERT INTO tokens (`PlayerName`, `tokens`) VALUES ('" + name + "', '0');"); tokens = 1000; } else { tokens = res.getInt("tokens"); }
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22904438
type: Answer

http://stackoverflow.com/a/22967040
type: Answer
has comment: http://stackoverflow.com/comment/35068525
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35069837
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22966973
has body: Each object has an implicit lock associated with it. When entering a synchronized block, the process must acquire the object's lock before continuing. The lock is returned upon exiting the synchronized block. public class SomeClass { private Object mutex = new Object(); public static synchronized void method1() { // static methods aquire the class level lock for SomeClass } public synchronized void method2() { // aquire the lock associated with 'this' instance (of SomeClass) } public void method3() { synchronized (mutex) { // aquire the lock of the mutex object } } }
answers question: http://stackoverflow.com/q/22966973
has comment: http://stackoverflow.com/comment/35068881

http://stackoverflow.com/a/22902303
answers question: http://stackoverflow.com/q/22902286
score: 0
type: Answer
has body: You would have to cast it to a PayCust (assuming you know for a fact that it's a PayCust): PayCust example = (PayCust) custList.get(0); String accountType = example.getAccountType (); ...

http://stackoverflow.com/q/22910343
accepted answer: http://stackoverflow.com/a/22910415
type: Question
has answer: http://stackoverflow.com/a/22910502
has answer: http://stackoverflow.com/a/22910423
tagged with: compilation
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34966258
favorite count: 0
has title: Java: float, long local initialision
has answer: http://stackoverflow.com/a/22910415
has body: I had been under the assumption, and indeed I believe that I have had experience, that initialising long or float local primitives in Java with raw numbers will generate compiler errors. E.g. float f = 10; long l = 5; And that the correct way to write the above would be float f = 10f; long l = 5l; Yet I am finding right at this moment the compiler happily compiling without the f and l disclaimers. Am I missing something?
has comment: http://stackoverflow.com/comment/34966206
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: local-variables
tagged with: primitive
possible better answer: http://stackoverflow.com/a/22910502

jpa
tags question: http://stackoverflow.com/q/22949086
tags question: http://stackoverflow.com/q/22844002
tags question: http://stackoverflow.com/q/22820869
tags question: http://stackoverflow.com/q/22899706
tags question: http://stackoverflow.com/q/22938574
tags question: http://stackoverflow.com/q/22900464
tags question: http://stackoverflow.com/q/22863426
tags question: http://stackoverflow.com/q/22877562
tags question: http://stackoverflow.com/q/22917421
tags question: http://stackoverflow.com/q/22929925
tags question: http://stackoverflow.com/q/22872362
tags question: http://stackoverflow.com/q/22837389
tags question: http://stackoverflow.com/q/22956170
tags question: http://stackoverflow.com/q/22843408
tags question: http://stackoverflow.com/q/22850236
tags question: http://stackoverflow.com/q/22910018
tags question: http://stackoverflow.com/q/22906718
tags question: http://stackoverflow.com/q/22810041
tags question: http://stackoverflow.com/q/22816817
tags question: http://stackoverflow.com/q/22901925
tags question: http://stackoverflow.com/q/22849268
tags question: http://stackoverflow.com/q/22960268
tags question: http://stackoverflow.com/q/22967097
tags question: http://stackoverflow.com/q/22881058
type: Tag
tags question: http://stackoverflow.com/q/22921687
tags question: http://stackoverflow.com/q/22940608
tags question: http://stackoverflow.com/q/22880012
tags question: http://stackoverflow.com/q/22892744
tags question: http://stackoverflow.com/q/22827161
tags question: http://stackoverflow.com/q/22845221
tags question: http://stackoverflow.com/q/22954213
tags question: http://stackoverflow.com/q/22897324
tags question: http://stackoverflow.com/q/22894727
tags question: http://stackoverflow.com/q/22867822
tags question: http://stackoverflow.com/q/22932015
tag name: jpa
tags question: http://stackoverflow.com/q/22938677
tags question: http://stackoverflow.com/q/22913796
tags question: http://stackoverflow.com/q/22895067
tags question: http://stackoverflow.com/q/22919153
tags question: http://stackoverflow.com/q/22964829
tags question: http://stackoverflow.com/q/22932537
tags question: http://stackoverflow.com/q/22909298
tags question: http://stackoverflow.com/q/22899339
tags question: http://stackoverflow.com/q/22917585
tags question: http://stackoverflow.com/q/22860114
tags question: http://stackoverflow.com/q/22894430
tags question: http://stackoverflow.com/q/22951752
tags question: http://stackoverflow.com/q/22890578
tags question: http://stackoverflow.com/q/22822891
tags question: http://stackoverflow.com/q/22881448
tags question: http://stackoverflow.com/q/22875803
tags question: http://stackoverflow.com/q/22862183
tags question: http://stackoverflow.com/q/22908201
tags question: http://stackoverflow.com/q/22966928
tags question: http://stackoverflow.com/q/22918978
tags question: http://stackoverflow.com/q/22961992
tags question: http://stackoverflow.com/q/22867069
tags question: http://stackoverflow.com/q/22919459
tags question: http://stackoverflow.com/q/22853168
tags question: http://stackoverflow.com/q/22845543
tags question: http://stackoverflow.com/q/22823061
tags question: http://stackoverflow.com/q/22965178
tags question: http://stackoverflow.com/q/22887698
tags question: http://stackoverflow.com/q/22861103
tags question: http://stackoverflow.com/q/22924000

http://stackoverflow.com/q/22821299
has answer: http://stackoverflow.com/a/25529241
has title: Wildfly SSO Logout Not Working - Session is Still Valid
favorite count: 0
has comment: http://stackoverflow.com/comment/127743409
has answer: http://stackoverflow.com/a/25419067
has comment: http://stackoverflow.com/comment/34808145
linked to: http://stackoverflow.com/q/21931637
upvote count: 3
has comment: http://stackoverflow.com/comment/38271631
type: UnansweredQuestion
tagged with: wildfly
has comment: http://stackoverflow.com/comment/34845502
type: Question
score: 3
has answer: http://stackoverflow.com/a/27550858
tagged with: java
tagged with: jboss
has body: I am running Wildfly and am having issues with the invalidating the session upon user logout. I have set up a custom database login module and that works, but the logout functionality does not. I have pasted the relevant standalone.xml, jboss-web.xml and my servlet logout code. The issue is that the session does not get invalidated after logout. Using the same JSESSIONIDSSO cookie, the user can still access pages that require roles even after logging out. I have tested that the roles are working properly - prior to login, pages requiring roles are inaccessible. After login, they are accessible. After logout, they are still accessible. Has anyone else experienced these issues or do you know what has been misconfigured on my end? standalone.xml <module-option name="securityDomain" value="jsse-myname"/> <module-option name="verifier" value="com.myname.X509Verifier"/> <module-option name="dsJndiName" value="java:/jdbc/myds"/> <module-option name="rolesQuery" value="exec h_Get_UserRoles ?, 1"/> <module-option name="fieldToSearchMap" value="CN=TEST"/> <module-option name="logQuery" value="exec h_Log_login_Attempt ?,?"/> <module-option name="certLogDir" value="C:\tools\wildfly\standalone\log\failedcerts"/> jboss-web.xml myname-form org.apache.catalina.authenticator.SingleSignOn /myname-form ServletLogout.java public class LogoutServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setHeader("Cache-Control", "no-cache, no-store"); response.setHeader("Pragma", "no-cache"); response.setHeader("Expires", new java.util.Date().toString()); if (request.getSession(false) != null) { request.getSession(false).invalidate(); } if (request.getSession() != null) { request.getSession().invalidate(); } request.logout(); response.sendRedirect(request.getScheme()+"://"+request.getServerName()); } }
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/34974878
has text: @BoristheSpider: I meant that I'm trying to avoid relying on 3rd party APIs. I am relatively new to this language, so apologies if I've annoyed you by not knowing everything that you do. I have edited my original post to reflect your previous comment.
type: QuestionComment
comment on: http://stackoverflow.com/q/22909370
score: 0
type: Comment

http://stackoverflow.com/comment/35027114
score: 0
has text: gwt converts my java code to javascript , i guess that in order to use more than two columns , it has to be specified in a different way.
type: Comment
comment on: http://stackoverflow.com/a/22943455
type: AnswerComment

http://stackoverflow.com/comment/34972750
comment on: http://stackoverflow.com/a/22911513
score: 0
type: AnswerComment
type: Comment
has text: yes, `while(true)` loop will pause until synchronized object `pauseObject` gets notification by `notify` method, which you invoke in `trigger` method. This technique is based on Java thread synchronization

http://stackoverflow.com/a/22963791
has body: You can run jar file in case its manifest contains proper reference to class with main() function using command java -jar jarfile.jar. If you need Windows executable, you can use launch4j. For Android AFAIK you need to build apk file.
has comment: http://stackoverflow.com/comment/35063033
has comment: http://stackoverflow.com/comment/35062906
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35062840
answers question: http://stackoverflow.com/q/22963706
type: Answer

http://stackoverflow.com/a/26479233
downvote count: 2
answers question: http://stackoverflow.com/q/22867491
has comment: http://stackoverflow.com/comment/44289998
upvote count: 5
type: Answer
score: 3
has body: Check out Chronon Debugger plugin which actually allows you to step back, not just drop the frame http://blog.jetbrains.com/idea/2014/03/try-chronon-debugger-with-intellij-idea-13-1-eap/

http://stackoverflow.com/comment/80564730
has text: @yegor256 your comment doesn't make much sense to me. Why don't you ask your own question instead of commenting on a very old one?
comment on: http://stackoverflow.com/a/22929420
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/q/22906966
has answer: http://stackoverflow.com/a/22907257
has answer: http://stackoverflow.com/a/22907635
score: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/34960644
has body: Im new to JSP and I am using a flag in my application like the URL below: http://localhost/MyApp/result.jsp?params How do I get that flag in the landing page?
answer count: 4
has answer: http://stackoverflow.com/a/22907054
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34960620
has answer: http://stackoverflow.com/a/22907224
accepted answer: http://stackoverflow.com/a/22907635
tagged with: java
possible better answer: http://stackoverflow.com/a/22907054
has comment: http://stackoverflow.com/comment/34960481
has title: Querystring without values
type: Question

http://stackoverflow.com/q/22897992
linked to: http://stackoverflow.com/q/2939218
type: Question
linked to: http://stackoverflow.com/q/9481865
downvote count: 6
upvote count: 2
has body: I use this code to get my current IP: public String getIpAddress() throws NullPointerException, MalformedURLException, IOException { URL whatismyip = new URL("http://checkip.amazonaws.com"); BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader( whatismyip.openStream())); String ip = in.readLine(); return ip; } finally { if (in != null) { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } } } but the return value is incorrect. how to get the IP properly
answer count: 1
has comment: http://stackoverflow.com/comment/34944417
favorite count: 0
has answer: http://stackoverflow.com/a/22898109
accepted answer: http://stackoverflow.com/a/22898109
has comment: http://stackoverflow.com/comment/39260651
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34944442
tagged with: java
score: -4
has title: How to get IP address in windows machine using java
has comment: http://stackoverflow.com/comment/40473662

http://stackoverflow.com/comment/34853813
type: Comment
comment on: http://stackoverflow.com/a/22847363
has text: thx, however, that seems to work for handling unicode points and marks but it breaks other test cases where meta characters are used. also "." (period) is treated as a literal instead of it's meta equivalent (especially for multi-line and doitall).
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34807668
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22821606
score: 0
has text: `temp.substring(0)` is the entire string, `i < chars.length - 1` is going to leave off the last letter so you'll never find words beginning with Z, temp is a terrible name for a variable, you never use `j` so you could just do `for (String word : words)`, and you should use a StringBuilder to assemble the results.

http://stackoverflow.com/q/22896321
has answer: http://stackoverflow.com/a/22896329
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22896380
has title: Usage of new Class<?>[]{} at getMethod
favorite count: 0
possible better answer: http://stackoverflow.com/a/22896380
has body: Is there any difference between: Method getIDMethod = MyInterface.class.getMethod("getId"); and Method getIDMethod = MyInterface.class.getMethod("getId", new Class&lt;?&gt;[]{}); MyInterface is as follows: public interface MyInterface { AnotherInterface getId(); }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22896329
downvote count: 0
tagged with: reflection
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/22902275
has answer: http://stackoverflow.com/a/22902355
type: Question
has comment: http://stackoverflow.com/comment/34952259
type: AnsweredQuestion
score: 3
tagged with: stack
tagged with: java
has comment: http://stackoverflow.com/comment/34952304
answer count: 2
accepted answer: http://stackoverflow.com/a/22902358
has comment: http://stackoverflow.com/comment/34952330
has comment: http://stackoverflow.com/comment/34952270
downvote count: 0
has comment: http://stackoverflow.com/comment/34952290
has body: Stack initial capacity: 5 Object[0] = 'H' Object[1] = 'a' Object[2] = 'p' Object[3] = 'p' Object[4] = 'y' What happens if you try these executions: s.push('i'); s.push('s'); Also does a stack implementation using an array have a peek method? PS. I don't have a computer and i'm merely on my phone asking this. I was just reading a book and this came up as a question...
has comment: http://stackoverflow.com/comment/34952354
has comment: http://stackoverflow.com/comment/34952439
favorite count: 0
has title: What happens if you push an item into a stack but the initial capacity has already been met?
possible better answer: http://stackoverflow.com/a/22902355
upvote count: 3
has comment: http://stackoverflow.com/comment/34952319
has answer: http://stackoverflow.com/a/22902358

http://stackoverflow.com/q/22955482
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22957014
upvote count: 1
has answer: http://stackoverflow.com/a/22956470
tagged with: c++
tagged with: opencv
has body: I am new to image processing and to opencv in particular. I am working on an OCR project in which i need to identify numbers. This is my image to process: Lets say i already optimized the image, my questions are: In the image the number are always apeared several times, lets say i found the contours, so how can i know which one if the the best one to process? How can I know in what angle I need to rotate each contour to make It stright?
score: 1
tagged with: java
type: Question
has title: Image processing - OpenCV, Identifying digits
linked to: http://stackoverflow.com/q/15956124
tagged with: image
has comment: http://stackoverflow.com/comment/35227525
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/22958002
has answer: http://stackoverflow.com/a/22958389
accepted answer: http://stackoverflow.com/a/22958389
score: 1
tagged with: java
has title: JavaFX8 TableView with custom control
tagged with: custom-controls
answer count: 2
tagged with: tableview
upvote count: 1
possible better answer: http://stackoverflow.com/a/22986805
downvote count: 0
has body: I want to use a custom control (ClientControl in the code) in my TableView. Therefore I created a class ClientCell: public class NewClientCell extends TableCell&lt;Client, Client&gt; { private final ClientControl cc; public NewClientCell(ObservableList&lt;Client&gt; suggestions) { cc = new ClientControl(this.getItem(), suggestions); this.setAlignment(Pos.CENTER_LEFT); this.setGraphic(cc); this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } @Override protected void updateItem(Client c, boolean empty) { super.updateItem(c, empty); if(!empty){ setGraphic(cc); } } } In the main program I use the following code to fill the table: TableColumn&lt;Client, Client&gt; clmClients = new TableColumn&lt;&gt;("Klient"); clmClients.setCellFactory(new Callback&lt;TableColumn&lt;Client, Client&gt;, TableCell&lt;Client, Client&gt;&gt;() { @Override public TableCell&lt;Client, Client&gt; call(TableColumn&lt;Client, Client&gt; p) { return new NewClientCell(suggestions); }; }); clmClients.setCellValueFactory(new Callback&lt;TableColumn.CellDataFeatures&lt;Client, Client&gt;, ObservableValue&lt;Client&gt;&gt;() { @Override public ObservableValue&lt;Client&gt; call(TableColumn.CellDataFeatures&lt;Client, Client&gt; p) { return new SimpleObjectProperty&lt;Client&gt;(p.getValue()); } }); getColumns().add(clmClients); The data in the table comes from an ObservableList and is initialized correct. My problem now is that the custom control needs an Client-Object which it should get out of the ObservableList, but "this.getItem()" always returns null. How do I get the Client objects correctly into the custom control? Thanks! EDIT Here's the constructor of ClientControl: public ClientControl(Client client, ObservableList&lt;Client&gt; suggestions) { setClient(client); setSuggestions(suggestions); FXMLLoader loader = new FXMLLoader(getClass().getResource("ClientControl.fxml")); loader.setRoot(this); loader.setController(this); try { loader.load(); } catch (IOException e) { throw new RuntimeExcept…
favorite count: 0
tagged with: javafx-8
has answer: http://stackoverflow.com/a/22986805
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/34990140
score: 0
has text: single threaded only. I just need to stop execution after some time and kill all the resources it is using, and move to the next file.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22922833

http://stackoverflow.com/a/22852181
answers question: http://stackoverflow.com/q/22852113
has body: Here's something for you to get head started. Create a map for prize money => line as key/value pair Read each line in the file, parse it and put key/value pair in the above map Once your map is ready, convert the keys entry set into the collections like list Sort the collections, using Collections.sort() Iterate over the created map, and for each value in the collection get the corresponding value from the map. Hope this helps you to get the workflow.
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/35003402
has text: The convention is still valid for your needs.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22929851

http://stackoverflow.com/q/22947596
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22948141
accepted answer: http://stackoverflow.com/a/22948141
has title: How to retrieve chosen date from JDatechooser?
has comment: http://stackoverflow.com/comment/35034730
has body: I am using Eclipse to do a college project on Java. I realized that java does not have a built in date selector like C#, so I downloaded and added JDateChooser. I tried to retrieve the chosen date but it failed: String Date = dateChooser.getDate(); //I want to the date to be retrieved as string Any ideas? Is there some kind of initialization that I must do?
has comment: http://stackoverflow.com/comment/35034614
has comment: http://stackoverflow.com/comment/35034295
has comment: http://stackoverflow.com/comment/35034595
has answer: http://stackoverflow.com/a/71875198
linked to: http://stackoverflow.com/q/5683728
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22947725
tagged with: java
has comment: http://stackoverflow.com/comment/35034425
type: Question
tagged with: jdatechooser
has comment: http://stackoverflow.com/comment/35034680
has comment: http://stackoverflow.com/comment/35034477
possible better answer: http://stackoverflow.com/a/22947725

http://stackoverflow.com/a/22822659
score: 5
has comment: http://stackoverflow.com/comment/56646335
downvote count: 0
type: Answer
has body: The @Index annotation only works with hibernate.hbm2ddl.auto=create-drop, see this entry in the Hibernate forums. Just one word of caution is that this option drops the tables, but in general hibernate.hbm2ddl.auto is meant for development purposes only.
answers question: http://stackoverflow.com/q/22816817
upvote count: 5

http://stackoverflow.com/comment/35074532
type: Comment
comment on: http://stackoverflow.com/q/22950226
has text: All the KeyStore and truststore steps and settings described there apply to both SSLSockets and HttpsURLConnection.
score: 0
type: QuestionComment

http://stackoverflow.com/q/22916151
has body: If I use Spring (or another Java web application framework), do I need to build a plugin system for my application on top of that? Isn't the part of the purpose of using a framework so that programmer doesn't have to build the architecture, it's there and I merely need to hook into it (via Dependency Injection, xml configuration, or some other way)? I asked a similar question on the Programming StackExchange, but I don't think I should have put it there. I worded my question a little different here for specificity on SO. EDIT: I may not be wording this correctly. To me web application, for this question's context, meant the back end of the system, not the UI, Javascript, etc. Only switching out classes in the application (mock database for testing, logger, etc.). EDIT: Thanks to Aaron for the website, but it looks like my answer is no. I don't have to build another plugin framework on top of Spring, http://deepeshdarshan.wordpress.com/2013/03/20/learn-spring-by-example-constructor-injection/. It does seems the xml file would be unbelievable difficult to maintain, so Aaron's link looks promising. http://deepeshdarshan.wordpress.com/2013/03/24/learn-spring-by-example-autodiscovery/ The dependencies have to be kept up with somewhere.
tagged with: plugins
tagged with: spring
type: AnsweredQuestion
has title: Will Spring allow me to build a Java application with Dependency Injection testing and a plugin architecture?
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: web-frameworks
has answer: http://stackoverflow.com/a/22916432
accepted answer: http://stackoverflow.com/a/22916432

http://stackoverflow.com/q/22849545
tagged with: uimanager
has body: I have a jar that is loaded into a large Java platform. There appears to be a custom LookAndFeel, which any Panels etc I create picks up. Now I need to create a new jFrame, however, it doess NOT inherit the current lookandfeel. How may I specify that it does this? I tried this but it change all look and feels to something not too stable (visual glitches etc) try { // Set cross-platform Java L&amp;F (also called "Metal") UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException e) { // handle exception } catch (ClassNotFoundException e) { // handle exception } catch (InstantiationException e) { // handle exception } catch (IllegalAccessException e) { // handle exception } and when I look here: UIManager.LookAndFeelInfo[] x = UIManager.getInstalledLookAndFeels(); it does NOT appear to have a custon LookAndFell in the list. The main question is WHY does new jFrame NOT inherit the existing L&amp;F?
has title: How to get new frame to inherit existing lookandfeel
has comment: http://stackoverflow.com/comment/34858442
has comment: http://stackoverflow.com/comment/34857432
has comment: http://stackoverflow.com/comment/34857093
type: UnansweredQuestion
type: Question
answer count: 0
tagged with: jframe
score: 0
tagged with: java
tagged with: look-and-feel

http://stackoverflow.com/q/22913535
has title: My app getting crashed when i restart my Mobile
has body: Am developing an GPS tracking Application. It's getting crashed when we restart mobile phone. And also please help me to make app compatible with all android devices. This is My Manifest.xml: <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.SEND_SMS"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-feature android:glEsVersion="0x00020000" android:required="true" android:exported="true"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34972204
has answer: http://stackoverflow.com/a/22914213
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34973488

http://stackoverflow.com/comment/35068111
comment on: http://stackoverflow.com/a/22966424
type: Comment
has text: and last question: what true way for splitting(m<n or m bit length < n bit length)?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34806988
comment on: http://stackoverflow.com/q/22820564
type: Comment
type: QuestionComment
score: 0
has text: OK, that worked. Thank you. But that's the reason I don't really like implementing my own subclass. Even NetBeans' developers made mistake here.

http://stackoverflow.com/comment/34856313
type: QuestionComment
has text: [Try to ask Short, Self Contained, Correct (Compilable) questions](http://www.sscce.org/)
score: 3
comment on: http://stackoverflow.com/q/22849193
type: Comment

http://stackoverflow.com/q/22853936
has title: how to create json image and text list view? Please explain the correct format for onitemclicklistener with example?
has comment: http://stackoverflow.com/comment/34865653
type: Question
has comment: http://stackoverflow.com/comment/34876882
has comment: http://stackoverflow.com/comment/34867440
upvote count: 1
has comment: http://stackoverflow.com/comment/34877322
has comment: http://stackoverflow.com/comment/34911135
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/34864864
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34872549
tagged with: android
has body: I am tring to onitemclicklistener is working but content is not displayed. Here is my code: MainActivity.java public class MainActivity extends Activity { private static final String TAG_details = "details"; ListView mListView; String tv_country_details; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // URL to the JSON data String strUrl = "http://http://192.168.0.200/android/count.php"; // Creating a new non-ui thread task to download json data DownloadTask downloadTask = new DownloadTask(); // Starting the download process downloadTask.execute(strUrl); // Getting a reference to ListView of activity_main mListView = (ListView) findViewById(R.id.lv_countries); } /** A method to download json data from url */ private String downloadUrl(String strUrl) throws IOException{ { String data = ""; InputStream iStream = null; try{ URL url = new URL(strUrl); // Creating an http connection to communicate with url HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); // Connecting to url urlConnection.connect(); // Reading data from url iStream = urlConnection.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(iStream)); StringBuffer sb = new StringBuffer(); String line = ""; while( ( line = br.readLine()) != null) { sb.append(line); } data = sb.toString(); br.close(); } catch(Exception e) { Log.d("Exception while downloading url", e.toString()); } finally { iStream.close(); } return data; } } /** AsyncTask to download json data */ private class DownloadTask extends AsyncTask&lt;String, Integer, String&gt;{ String data = null; @Override protected String doInBackground(String... url) { try{ data = downloadUrl(url[0]); }catch(Exception e){ Log.d("Background Task",e.toString()); } return data; } @Override protected void onPostExecute(String result) { // The parsing of the xml data is done in a non-ui thread ListViewLoaderTask listViewLoaderTask …
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/34882596
comment on: http://stackoverflow.com/a/22863887
has text: There's nothing obvious about anything here. If you don't know how compiler optimizations and runtime optimizations work (let's ignore the CPU caches for now), I wouldn't recommend that you think anything is "obvious".
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/34900100
type: QuestionComment
comment on: http://stackoverflow.com/q/22873026
score: 0
type: Comment
has text: Eh? That refers to `HashMap`, and in any event, the Java _language_ has no concept of freeing references; you only dereference an object and the GC picks up after you. Alternately, you might want `ConcurrentSkipListMap` for a properly concurrent sorted map implementation.

http://stackoverflow.com/q/22879625
answer count: 1
has body: I would like to count how many if statements are in code. The problem is that: an if word can be inside(and it should not count as if statement) the comment and I have to detect if I am inside the comment? Can it be done using java's regex? How to detect if only outside the comment?
favorite count: 0
has title: Java regex to detect if statements - detecting comments
type: UnansweredQuestion
tagged with: regex
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34911490
has comment: http://stackoverflow.com/comment/34911335
has comment: http://stackoverflow.com/comment/34962713
has answer: http://stackoverflow.com/a/22879767
has comment: http://stackoverflow.com/comment/34911425

http://stackoverflow.com/q/22846063
downvote count: 0
tagged with: base64
favorite count: 0
has body: I'm using the following code to encode a java.awt.Image in Base64: private String asBase64(Image image) throws IOException { BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(bufferedImage, "PNG", out); byte[] bytes = out.toByteArray(); return Base64.encodeBytes(bytes); } But the returned String is somehow wrong: It seems to be too small (only 308 chars on a 20KB-file) and contains a big amount of repetitive characters in the middle (~200 A chars). I did some debugging and found out that bufferedImage at least has correct dimensions, but out only contains 308 bytes after executing ImageIO.write(...). This number increases with bigger images, but the characters keep being repetitive and too few. Am I missing something?
type: Question
has comment: http://stackoverflow.com/comment/34850851
has answer: http://stackoverflow.com/a/22847055
has comment: http://stackoverflow.com/comment/34857578
upvote count: 2
tagged with: imaging
answer count: 1
has comment: http://stackoverflow.com/comment/34857367
tagged with: java
accepted answer: http://stackoverflow.com/a/22847055
has title: Base64 encoding not working
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/22873832
has comment: http://stackoverflow.com/comment/34902425
has comment: http://stackoverflow.com/comment/34902132
has body: First create a jar of B project, install it in maven repository and then add a new dependency in war B project's pom.xml. a.b.c B-core 1.0 --EDIT-- By removing test will solve your problem. For more information read about Introduction to the Dependency Mechanism
has comment: http://stackoverflow.com/comment/34902471
has comment: http://stackoverflow.com/comment/34902458
answers question: http://stackoverflow.com/q/22873798
has comment: http://stackoverflow.com/comment/34901986
score: 0
accepted answer of: http://stackoverflow.com/q/22873798
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34902033
type: Answer

http://stackoverflow.com/a/43711296
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22895936
has body: For 'N' digit amstrong number package jjtest; public class Amstrong { public static void main(String[] args) { // TODO Auto-generated method stub int num=54748; int c=0; int temp=num; int b=1; int length = (int)(Math.log10(num)+1); while(num&gt;0){ int r = num%10; num=num/10; int a =1; for(int i=1;i&lt;=length;++i){ b=b*r; } c = c + b; b=1; } System.out.println(c); if(c==temp){ System.out.println("its an amstrong number"); }else{ System.out.println("its not an amstrong number"); } } }

http://stackoverflow.com/a/22897328
answers question: http://stackoverflow.com/q/22897145
score: 1
has comment: http://stackoverflow.com/comment/34943368
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22897145
has comment: http://stackoverflow.com/comment/34943336
has comment: http://stackoverflow.com/comment/34943419
type: Answer
has comment: http://stackoverflow.com/comment/34943246
has comment: http://stackoverflow.com/comment/34943191
has body: Your question is a specific example of a general question: how do two objects communicate? Your consideration of using a public field as you know is wrong. You mention saving data to a file, but isn't that over-kill, and won't that add needless time and resource overhead when a much simpler solution is available? Better to just use the same technique that you'd use if this were not a Swing GUI: public methods including getter and setter methods if need be. e.g., private void goSettingsActionPerformed(java.awt.event.ActionEvent evt) { Settings settings = new Settings(); int result = JOptionPane.showOptionDialog(null, settings, "Settings", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, new String[]{"Save", "Cancel"}, "default"); if (result == JOptionPane.OK_OPTION) { // **** give your Settings class this method: username = settings.getUserName(); usernameInputedLabel.setText(username); } } Edit You state in comment: I would have used getters and setters but from the books that I've read and the forums that I frequent I know that the general consensus is that having getters and setters is even worse than public fields. Sorry, but that's hogwash. Please consider your code vs. my code. In my code above, I suggest givng Settings a method, something like: // in declarations: // don't name this jTextField1 private JTextField userNameField = new JTextField(); // public getter method public String getUserName() { return jTextField1.getText(); // this should be named userNameField } Whereas your suggestion is to make the JTextField public, fully exposing it to all comers. Which is riskier? Which could allow the calling code to change the state of the Settings object without your knowing about it?
has comment: http://stackoverflow.com/comment/34943200
has comment: http://stackoverflow.com/comment/34943306
upvote count: 1

http://stackoverflow.com/comment/34941329
type: AnswerComment
comment on: http://stackoverflow.com/a/22893903
type: Comment
has text: SecureRandom is the platform standard way of generating secure random information. It *has* a provider architecture and it *uses* hardware security if available.
score: 0

http://stackoverflow.com/a/22900024
score: 1
type: Answer
upvote count: 1
has body: When System.out.println("Mult:" + test1(4)); is run, test1(4) must be evaluated before it can be System.out.println'd. So, the JVM will run the following: evalate result of test1(4) { print ("N:" + 4); return 2*4; } evalate result of "Mult:" + returnedValue { print("Multi:" + returnedValue); } The JVM cannot print something before it knows its value. In this case, test1(4) get evaluated first so the JVM knows what to print out (the return value). You could also complete the task this way>> int result = test1(4); //This prints out 4 and evaluates to 8 System.out.println("Mult: " + result); //This concats "Mult: " and 8 after converting it to of type String
answers question: http://stackoverflow.com/q/22899934
downvote count: 0
has comment: http://stackoverflow.com/comment/34948728

http://stackoverflow.com/comment/34862664
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22852425
has text: Hello @bmargulies Thanks for the reply. this is just a sample application that i am trying out. I wanted to Learn SOAP Web Services and this is just a starting point.
score: 0

http://stackoverflow.com/a/22962670
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22962415
upvote count: 1
has body: If you write: SimpleDoc mydoc = new SimpleDoc(); all the further code may depend on details exposed by the implementing class SimpleDoc. But if you write: Doc mydoc = new SimpleDoc(); the further code my only depend on aspects exposed by Doc, which make the code even work if you decide in the future to write: Doc mydoc = new ComplexDoc(); A good example for the differences is List, which has at least two implementations: ArrayList LinkedList If you write: List list = new ArrayList(); you are free to replace it later with: List list = new LinkedList(); without breaking the code relying on the variable list (assuming you did not used casts or reflection to access implementation specific features of list).

http://stackoverflow.com/q/22930503
has answer: http://stackoverflow.com/a/22930678
has comment: http://stackoverflow.com/comment/35003546
has comment: http://stackoverflow.com/comment/35003443
favorite count: 0
has answer: http://stackoverflow.com/a/22930670
tagged with: static
linked to: http://stackoverflow.com/q/2002288
tagged with: android
has title: android context in static method is undefined
accepted answer: http://stackoverflow.com/a/22930670
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22930543
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22930543
has body: I tried to put context in my static method as below : public class Menu_SPPAJ extends Activity { public static void onRefreshList() { model.requery(); list_terbaru.setAdapter(new Adapter_Spaj_Terbaru(Menu_SPPAJ.this,model)); } } but Menu_SPPAJ.this is undefined in static method, is there anyway how to call my context in static method?
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22930833
has answer: http://stackoverflow.com/a/22930648
answer count: 6
has answer: http://stackoverflow.com/a/22930849
has comment: http://stackoverflow.com/comment/35003430
downvote count: 0

http://stackoverflow.com/comment/34899432
comment on: http://stackoverflow.com/q/22872980
has text: Where is you stack trace? From which line it is coming?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34864078
score: 6
comment on: http://stackoverflow.com/q/22853520
type: Comment
type: QuestionComment
has text: It means the current working directory.

http://stackoverflow.com/a/22900664
has comment: http://stackoverflow.com/comment/34984116
accepted answer of: http://stackoverflow.com/q/22900548
has comment: http://stackoverflow.com/comment/35008181
answers question: http://stackoverflow.com/q/22900548
has comment: http://stackoverflow.com/comment/34999943
type: AcceptedAnswer
has body: The Java driver for SQLite does not support true concurrent multithreaded access. It's only "thread safe" in the sense that use from multiple threads should not corrupt the data. I think the best you can do is to open a single connection, and then have each thread lock the connection while using it, giving the lock up when it's done. I'm not familiar with Android programming specifically, but something like the following might work: public class MySQL{ private static MySQL myInstance; private SQLiteOpenHelper mHelper; private SQLiteDatabase myDatabase; ... //initialize public synchronized static void initialize(Context context){ if(myInstance == null){ myInstance = new MySQL(context); } } public synchronized static void createSomeEntry() { myInstance.myDatabase = myInstance.mHelper.getWritableDatabase(); myInstance.myDatabase.query(...); ... myInstance.mHelper.close(); } public synchronized static void getSomeEntry() { myInstance.myDatabase = myInstance.mHelper.getReadableDatabase(); Cursor c = myInstance.myDatabase.query(...); ...//use cursor in a loop myInstance.mHelper.close(); } } Note the replacement of getInstance() with an initialize function that doesn't return anything, and the elimination of all other public functions except createSomeEntry() and getSomeEntry(). Since all public methods are synchronized on the class, only one thread can use the database at a time, which should resolve the issue of SQLite not supporting concurrent access. If you truly need concurrent access, I think your choices are either to figure out how to access the SQLite database from multiple processes rather than multiple threads, which was the approach that worked for my needs, or to switch to another database. I suppose you could also make driver changes yourself to make the driver truly multithreaded.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35004724
has comment: http://stackoverflow.com/comment/34950769
has comment: http://stackoverflow.com/comment/35003676
score: 1
has comment: http://stackoverflow.com/comment/34951529
has comment: http://stackoverflow.com/comment/35003551
has comment: http://stackoverflow.com/comment/35004605
upvote count: 1
has comment: http://stackoverflow.com/comment/35007694
has comment: http://stackoverflow.com/comment/34951581
has comment: http://stackoverflow.com/comment/34951596
has comment: http://stackoverflow.com/comment/35078283

http://stackoverflow.com/comment/101829259
score: 0
comment on: http://stackoverflow.com/q/22883069
type: Comment
type: QuestionComment
has text: while(c1=g1.pop()) will not work, because for equality you should check like while(c1 == g1.pop()) . The one you used is assignment not comparison operator.

http://stackoverflow.com/a/22857778
score: 0
type: Answer
has body: The 1382828400000 value is a long (time in milliseconds). You are telling GSON that the field is a Date, and it cannot automatically convert a long into a Date. You have to specify your fields as long values private long dateParution; private long heureParution; private long dateLimite; private long heureLimite; and after GSON casts the JSON string to the desired Appel class instance, construct another object with those fields as Dates and convert them while assigning the values to the new object. Another alternative is to implement your own Custom Deserializer: public class CustomDateDeserializer extends DateDeserializer { @Override public Date deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException { // get the value from the JSON long timeInMilliseconds = Long.parseLong(jsonParser.getText()); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(timeInMilliseconds); return calendar.getTime(); } } You have to set this custom deserializer on your desired fields, on the setter methods, like: @JsonDeserialize(using=CustomDateDeserializer.class) public void setDateParution(Date dateParution) { this.dateParution = dateParution; }
answers question: http://stackoverflow.com/q/22841306

http://stackoverflow.com/comment/35062014
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22963339
has text: Try the `String[] split(String regex)` method it should help you in this.
score: 0

http://stackoverflow.com/comment/34794497
has text: Try to add a convention plugin it will handle such situation.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22814580

http://stackoverflow.com/a/22815191
accepted answer of: http://stackoverflow.com/q/22815047
answers question: http://stackoverflow.com/q/22815047
type: AcceptedAnswer
score: 0
type: Answer
has body: Try comparing your strings in this way to avoid NPE if ("".equals(naam) || "".equals(straat) || ...) { allesoke = false; foutmelding += "\n"; } then verify that klantenBindingRef is instantiated before access to his variables //klantenBindingRef is null klantenBindingRef = new Klantenbinding(); klantenBindingRef.alleKlanten ...

http://stackoverflow.com/comment/34966523
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22910465
has text: What object.equals() return false? What objects are your comparing? Are you able to post the BitmapFactory.decodeByteArray() method?

http://stackoverflow.com/comment/34950400
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22900547
has text: @Ruturaj That cannot possibly be correct. A timeout is manifested as an exception. What was it? You should have posted the entire stack trace in your question.
score: 0

http://stackoverflow.com/comment/34874654
type: Comment
has text: So here I am, asking an experienced java developer ;) As far as I can tell, [pom.xml](https://github.com/aaronshaver/2048_Bot_2.0/blob/master/pom.xml) doesn't contain enough information. [2048_Bot.iml](https://github.com/aaronshaver/2048_Bot_2.0/blob/master/2048_Bot.iml) seems more like it, but it's `IDEA`'s file which `maven` wouldn't read, I take it. By inspecting `2048_Bot.iml` I can run it manually, downloading and specifying all the dependencies. But I wonder if `maven` can simplify the task.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22857661

http://stackoverflow.com/q/22899635
favorite count: 0
tagged with: c++
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: swing
type: Question
possible better answer: http://stackoverflow.com/a/22899710
has answer: http://stackoverflow.com/a/22899710
answer count: 2
has answer: http://stackoverflow.com/a/23041435
accepted answer: http://stackoverflow.com/a/23041435
upvote count: 1
tagged with: user-interface
has title: capture output from c++ in java without returning
linked to: http://stackoverflow.com/q/10735619
has body: i'm working on java SWING to make GUI for c++ programming . i need the c++ program to be executed in a loop without returning to the java. During this loop i want to capture some output without stepping through return 0; in c++ program can i capture output from the c++ file without returning to the java GUI ?? this is my out and in process in my code try { int out = 0; String line; OutputStream stdin = null; InputStream stderr = null; InputStream stdout = null; // calling the exe file Process process = new ProcessBuilder("unpattern.exe").start(); stdin = process.getOutputStream(); stderr = process.getErrorStream(); stdout = process.getInputStream(); // input process // "write" the parms into stdin line = "1"; stdin.write(line.getBytes()); stdin.flush(); //line = "tx.getText()" + "\n"; // stdin.write(line.getBytes()); // stdin.flush(); stdin.close(); // output process // clean up if any output in stdout BufferedReader brCleanUp = new BufferedReader(new InputStreamReader(stdout)); while ((line = brCleanUp.readLine()) != null) { // counter of the defects System.out.println(line); } catch (IOException ex) { Logger.getLogger(QeyeGui3.class.getName()).log(Level.SEVERE, null, ex); }

http://stackoverflow.com/a/22918492
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Okay that worked, I had to: Run "Add and Remove...", "Clean..." on The server Maven > Update Project (with clean enabled) on the project.
answers question: http://stackoverflow.com/q/22910257

http://stackoverflow.com/a/22937619
answers question: http://stackoverflow.com/q/22937573
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35016333
has comment: http://stackoverflow.com/comment/35016000
upvote count: 2
has body: Use substring: str.substring(0, str.length() - " sec".length()); or str.substring(0, str.indexOf(" ")); Tutorial JavaDoc
has comment: http://stackoverflow.com/comment/35015950
type: Answer

http://stackoverflow.com/comment/42626554
type: AnswerComment
comment on: http://stackoverflow.com/a/22887996
has text: Same problem but this is not working for me. check this link where logs and more details regarding the problem is mentioned : https://groups.google.com/forum/#!topic/adt-dev/C3qWxrS1xrY
type: Comment
score: 0

http://stackoverflow.com/comment/54754559
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22824843
has text: A reference implementation is basically an example implementation written by the creators of the API that showcases how they intended it to be used.

http://stackoverflow.com/comment/34933591
score: 0
has text: sorting is done before truncation or after truncation?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22891916

http://stackoverflow.com/q/22888008
upvote count: 1
answer count: 1
has body: I thought by casting the value to float it would show the seconds to the tenths place. long startTime = System.currentTimeMillis(); while (RUNNING) { track.repaint(); // varying the x position movement horse.setX(xpos += (int) (Math.random() * 10 + 0)); // Sleeping the thread try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } if (xpos &gt;= FINISH_LINE) { RUNNING = false; long endTime = System.currentTimeMillis(); JOptionPane.showMessageDialog(new JFrame(), id + " Won and took " +(float)(startTime - endTime)/1000*-1.0+ " seconds"); } } instead, it is giving me way too much precision. I would like to cut it off a bit.
linked to: http://stackoverflow.com/q/433958
tagged with: java
has title: How to round seconds to tenths place?
has answer: http://stackoverflow.com/a/22888101
duplicate of: http://stackoverflow.com/q/433958
downvote count: 0
type: Question
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/22888101
favorite count: 0

http://stackoverflow.com/comment/34853056
comment on: http://stackoverflow.com/q/22846816
score: 0
type: QuestionComment
has text: @RichardChambers There is no 'Java UDP stack'. Java just provides a thin layer over the C sockets API. The UDP stack is in the kernel.
type: Comment

http://stackoverflow.com/comment/35058256
has text: there's an error in the servlet at line 9 based from your answer, it states "incompatible types: void cannot be converted to int" do i have to change something in my DAOInterface as well?
type: Comment
comment on: http://stackoverflow.com/a/22960864
score: 0
type: AnswerComment

http://stackoverflow.com/a/57965962
type: Answer
has comment: http://stackoverflow.com/comment/126469034
upvote count: 1
downvote count: 1
score: 0
has body: Flatmap maps observables to observables. Map maps items to items. Flatmap is more flexible but Map is more lightweight and direct, so it kind of depends on your usecase. If you are doing ANYTHING async (including switching threads), you should be using Flatmap, as Map will not check if the consumer is disposed (part of the lightweight-ness)
answers question: http://stackoverflow.com/q/22847105

http://stackoverflow.com/comment/34908805
type: Comment
has text: What do I do when I call this function in the adapter?
comment on: http://stackoverflow.com/a/22878157
type: AnswerComment
score: 0

http://stackoverflow.com/a/54125277
has body: I chose this approach const val heightWebViewJSScript = "(function() {var pageHeight = 0;function findHighestNode(nodesList) { for (var i = nodesList.length - 1; i &gt;= 0; i--) {if (nodesList[i].scrollHeight &amp;&amp; nodesList[i].clientHeight) {var elHeight = Math.max(nodesList[i].scrollHeight, nodesList[i].clientHeight);pageHeight = Math.max(elHeight, pageHeight);}if (nodesList[i].childNodes.length) findHighestNode(nodesList[i].childNodes);}}findHighestNode(document.documentElement.childNodes); return pageHeight;})()" webView.webViewClient = object : WebViewClient() { override fun onPageFinished(view: WebView, url: String) { webView.evaluateJavascript(heightWebViewJSScript ) { height -&gt; val params = itemView.layoutParams // params.height } } }
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22878069

http://stackoverflow.com/a/22905777
downvote count: 2
has comment: http://stackoverflow.com/comment/65084090
has comment: http://stackoverflow.com/comment/34959072
score: 1
has comment: http://stackoverflow.com/comment/34959863
answers question: http://stackoverflow.com/q/22905617
has body: This is similar to Subset Sum Problem, which is NP-Complete. But limiting the subset length to 3, it is possible to find a fast solution. Your problem is equivalent to the 3SUM problem. r = K as in your question . Pseudocode : O(N^2) for (i in 1..n-2) { j = i+1 // Start right after i. k = n // Start at the end of the array. while (k &gt;= j) { // done. if (A[i] + A[j] + A[k] == r) return (A[i], A[j], A[k]) // We didn't match. Let's try to get a little closer: // If the sum was too big, decrement k. // If the sum was too small, increment j. (A[i] + A[j] + A[k] &gt; r) ? k-- : j++ } // When the while-loop finishes, j and k have passed each other and there's // no more useful combinations that we can try with this i. }
type: Answer
upvote count: 3

http://stackoverflow.com/comment/34916594
score: 0
type: Comment
has text: Oh right ok I see my problem, even when I deleted the equals it was only calculating to the power of 1 and 2 when I changed the i=1 to i=0 it fixed it and is now printing perfectly :) Thanks for all your help :D
comment on: http://stackoverflow.com/a/22881998
type: AnswerComment

http://stackoverflow.com/a/22823098
score: 1
upvote count: 1
has body: Seems that something try to get a persistence context before the spring context was set up or after it was disposed. Don't you have some junit @before or @after annotated method which accesses the persistence ?
has comment: http://stackoverflow.com/comment/34815137
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22822891

http://stackoverflow.com/q/22883406
tagged with: arrays
has title: Using split to store information from .txt file into array
has answer: http://stackoverflow.com/a/22883491
accepted answer: http://stackoverflow.com/a/22883491
has comment: http://stackoverflow.com/comment/34918203
score: 0
answer count: 1
has body: I have a file called log.txt (in same directory as the program), and it contains data which I want to split based on . and store it into String[] plan. e.g., The log.txt contains a string like 332 445.114 554.963 342. and so on... What I want is to split it in such a way so that: plan[0]=332 445; plan[1]=114 554; plan[2]=963 342; And so on...
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/34940506
downvote count: 2
has comment: http://stackoverflow.com/comment/34918226
type: AnsweredQuestion
tagged with: java
tagged with: file
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/34968839

http://stackoverflow.com/comment/35045032
comment on: http://stackoverflow.com/q/22953822
score: 0
type: Comment
type: QuestionComment
has text: You could also use a `List<Arc2D>` created _outside_ of the `paintComponent` method an just loop through it to paint them.

notifications
tags question: http://stackoverflow.com/q/22879751
tags question: http://stackoverflow.com/q/22933263
tags question: http://stackoverflow.com/q/22952606
tag name: notifications
type: Tag

http://stackoverflow.com/q/22896404
has comment: http://stackoverflow.com/comment/34941839
has comment: http://stackoverflow.com/comment/34941485
has title: Parsing CSV file with BufferedReader vs Scanner
has comment: http://stackoverflow.com/comment/34941471
has comment: http://stackoverflow.com/comment/34941843
score: 0
has comment: http://stackoverflow.com/comment/34941411
has comment: http://stackoverflow.com/comment/34941740
has comment: http://stackoverflow.com/comment/34941783
has comment: http://stackoverflow.com/comment/34941384
answer count: 0
has comment: http://stackoverflow.com/comment/34941547
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34941904
has comment: http://stackoverflow.com/comment/34941667
tagged with: java
has comment: http://stackoverflow.com/comment/34941970
has body: Team, i have to parse file line by line and in single line i have split by ",". First String would be Name and Second would be count. Finaly i have to display the Key and Count For example Peter,2 Smith,3 Peter,3 Smith,5 I should display as Peter 5 and Smith 8. So i was in confusion to choose between BufferedReader vs Scanner. Went through link . I came up with these two approach. i would like to get your concerns. Approach 1 : use buffered Reader. private HashMap&lt;String, MutableLong&gt; readFile(File file) throws IOException { final HashMap&lt;String, MutableLong&gt; keyHolder = new HashMap&lt;&gt;(); try (BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(file), "UTF-8"))) { for (String line; (line = br.readLine()) != null;) { // processing the line. final String[] keyContents = line .split(KeyCountExam.COMMA_DELIMETER); if (keyContents.length == 2) { final String keyName = keyContents[0]; final long count = Long.parseLong(keyContents[1]); final MutableLong keyCount = keyHolder.get(keyName); if (keyCount != null) { keyCount.add(count); keyHolder.put(keyName, keyCount); } else { keyHolder.put(keyName, new MutableLong(count)); } } } } return keyHolder; } private static final String COMMA_DELIMETER = ","; private static volatile Pattern commaPattern = Pattern .compile(COMMA_DELIMETER); I have used MutableLong ( , since i dont want to create BigInteger for each time . And again it may be very big file and i don't have control on how max a key can occur Another Approach : use Scanner and use two Delimiter private static final String LINE_SEPARATOR_PATTERN = "\r\n|[\n\r\u2028\u2029\u0085]"; private static final String LINE_PATTERN = ".*(" + LINE_SEPARATOR_PATTERN + ")|.+$"; private static volatile Pattern linePattern = Pattern.compile(LINE_PATTERN); My Question is . i have went through the hasNext in Scanner and to me there is no harm to switch the Pattern . And i belive from Java 7, Scanner do has limited buffer can be enough for this …
linked to: http://stackoverflow.com/q/2231369
has comment: http://stackoverflow.com/comment/34941604
type: Question

http://stackoverflow.com/q/22901720
accepted answer: http://stackoverflow.com/a/22901753
tagged with: arrays
has body: I am trying to copy a 2d character array into another 2d character array via a constructor of a class. The original array is read in from a an external text file and then converted into a 2d array. However I can't seem to read in this 2d array from another class. The code that I am trying is listed below, it is the constructor of the search class. Thank You. char[][] arraytwo; public search(char[][] inarray) { for(int i = 0; i &lt; inarray.length; i++) { String row = inarray.; for(int j = 0; j &lt; inarray[i].length; j++) { arraytwo[i][j] = inarray.charAt(c); } } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22901753
possible better answer: http://stackoverflow.com/a/22901762
type: Question
tagged with: 2d
has title: Copying a 2d character array int another 2d character array
has answer: http://stackoverflow.com/a/22901762
tagged with: java
tagged with: charat
score: 0
answer count: 2
tagged with: for-loop

http://stackoverflow.com/comment/63250779
type: AnswerComment
has text: Above, @ScottBoring asks where the setting should be added. It goes in the configuration block and there is an example of that block within the plugin definition on [the maven shade plugin usage page](https://maven.apache.org/plugins/maven-shade-plugin/usage.html).
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26961161

http://stackoverflow.com/a/22917235
has comment: http://stackoverflow.com/comment/34979235
has comment: http://stackoverflow.com/comment/34979751
has comment: http://stackoverflow.com/comment/34979113
has comment: http://stackoverflow.com/comment/34979731
has comment: http://stackoverflow.com/comment/34979892
has body: You question is really unclear. Ask your teacher what it is you are trying to achieve and then maybe we can help doing so. Here are some elements that can help you. Get red, green and blue for an RGB number You got the first part almost right. Remember the colors returned by getRGB() are on 8 bits each, so here is how to get them: int red = (rgb[i][j] &gt;&gt; 16) &amp; 0xFF; int green = (rgb[i][j] &gt;&gt; 8) &amp; 0xFF; int blue = rgb[i][j] &amp; 0xFF; Build an RGB number from red, green and blue values If your problem is how to recombine rgb colors into one number, here is how to do that: pixelColor = (red &lt;&lt; 16) + (green &lt;&lt; 8) + blue Doing what you want with it The average of red and blue is really obvious, this is the formula you pointed out: int average = (red + blue) / 2; If what you want is a purple pixel using the average of red and green, then you just have to set red and blue to the average value, and green to 0: int pixelColor = (average &lt;&lt; 16) + average // using average for red and blue, and 0 for green EDIT: Seems that you don't want to take out the green after all. int pixelColor = (average &lt;&lt; 16) + (green &lt;&lt; 8) + average // using average for red and blue, and keep the green unchanged EDIT: Or maybe you want the green to take the average of red and blue? int pixelColor = (red &lt;&lt; 16) + (average &lt;&lt; 8) + blue; // keep red and bllue, and put their average as the green color
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34979963
has comment: http://stackoverflow.com/comment/34978984
has comment: http://stackoverflow.com/comment/35002729
type: Answer
accepted answer of: http://stackoverflow.com/q/22917147
answers question: http://stackoverflow.com/q/22917147
has comment: http://stackoverflow.com/comment/34979513

http://stackoverflow.com/comment/34803946
type: Comment
type: QuestionComment
has text: What does **$** mean in Java? I'm curious. I come from another language (VB.NET and VB6 and Basic in all flavour before)... In 4 years of Android programming I never met this **$** in Java code for Android. Today, for the second time, I saw it in two different questions... But I really have no clue of what should it mean. So, I really can't read your code.
comment on: http://stackoverflow.com/q/22819623
score: 0

http://stackoverflow.com/a/22870507
has body: What you're quoting is in the JLS section on Determining Accessibility with Names All members of interfaces lacking access modifiers are implicitly public What you really need to be looking at is the section on interface field declarations which states ConstantDeclaration: {ConstantModifier} UnannType VariableDeclaratorList ; ConstantModifier: Annotation public static final and Every field declaration in the body of an interface is implicitly public, static, and final. It is permitted to redundantly specify any or all of these modifiers for such fields. So those are the modifiers you can use. The section you quoted above refers to when you don't use any access modifier, in which case it would be implicitly public.
answers question: http://stackoverflow.com/q/22870346
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34894733
type: Answer
score: 7
accepted answer of: http://stackoverflow.com/q/22870346
upvote count: 7
has comment: http://stackoverflow.com/comment/34894759

http://stackoverflow.com/q/22901131
score: 1
has answer: http://stackoverflow.com/a/22904479
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/34950422
has body: Hi Every JAVA Developper, I have juste a simple Question about JVM, i want to know how long the JVM will wait for a thread ? For Example, take a look at this code : public static void main(String[] args) { p = Runtime.getRuntime().exec("myShellCommand -p1 v1 -p2 v2"); p.waitFor(); System.out.println("End ....:)"); } Suppose that "myShellCommand" running for ever, whats happen then ? the JVM still also waiting for ever ?
type: UnansweredQuestion
upvote count: 1
has title: How long does the JVM wait for a thread
has answer: http://stackoverflow.com/a/22904603
tagged with: java
type: Question
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/22901303

http://stackoverflow.com/comment/34977001
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22915311
has text: Yeah but that code is not mine, it's from the release.

http://stackoverflow.com/comment/34882142
has text: Do you know JVM will change your code and it won't look the same?
score: 3
comment on: http://stackoverflow.com/q/22863844
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34824791
score: 0
comment on: http://stackoverflow.com/a/22831277
has text: i used this but i am getting output like my posted output
type: Comment
type: AnswerComment

http://stackoverflow.com/q/22912888
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/22913909
answer count: 3
tagged with: java-6
accepted answer: http://stackoverflow.com/a/22914424
tagged with: localization
has title: Java Norwegian decimal separator different in Java 6 and 7
has answer: http://stackoverflow.com/a/53623792
has answer: http://stackoverflow.com/a/22914424
has comment: http://stackoverflow.com/comment/34971576
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34971104
has answer: http://stackoverflow.com/a/22913909
has body: The following snippet behaves different in Java 6 than Java 7: final Locale locale = new Locale("nb", "NO"); System.out.println(locale.getDisplayLanguage()); // Norwegian Bokmål final DecimalFormatSymbols dfs = new DecimalFormatSymbols(locale); System.out.println(dfs.getDecimalSeparator()); // Java 6: . // Java 7: , Why is that? Is this change documented somewhere?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34972152
type: Question
upvote count: 1
tagged with: locale
tagged with: java-7

http://stackoverflow.com/comment/35006600
type: QuestionComment
comment on: http://stackoverflow.com/q/22932207
has text: what do you want to achieve?
score: 0
type: Comment

http://stackoverflow.com/a/22929171
has body: The answer by Jon Skeet is correct. Joda-Time Assuming you could specify a pair of beginning and ending points on a time line, here is some example code using the Joda-Time 2.3 library. This code grabs the current moment, adjusts to first of the month, and adjusts to first moment of that day. Then it adds 6 months. Joda-Time is smart about adding the months, taking into account leap year and various lengths of months. This span of 6 months is then represented as an Interval instance. From that we calculate the number of milliseconds. Note that count of milliseconds needs to be a long (64-bit) rather than an int (32-bit) we Java programmers more commonly use. Lastly, for fun, we see what this span of time looks like when formatted in the ISO 8601 standard’s "Duration" format. DateTimeZone dateTimeZone = DateTimeZone.forID( "Europe/Paris" ); // Better to specify a time zone than rely on JVM’s default. DateTime start = new DateTime( dateTimeZone ).withDayOfMonth( 1 ).withTimeAtStartOfDay(); DateTime stop = start.plusMonths( 6 ); Interval interval = new Interval( start, stop ); long milliseconds = interval.toDurationMillis(); // A long, not an int. Period period = interval.toPeriod(); // For fun… ISO 8601 standard's Duration format. Dump to console… System.out.println("start: " + start ); System.out.println("stop: " + stop ); System.out.println("interval: " + interval ); System.out.println("milliseconds: " + milliseconds ); System.out.println("period: " + period ); When run… start: 2014-04-01T00:00:00.000+02:00 stop: 2014-10-01T00:00:00.000+02:00 interval: 2014-04-01T00:00:00.000+02:00/2014-10-01T00:00:00.000+02:00 milliseconds: 15811200000 period: P6M
answers question: http://stackoverflow.com/q/22878468
type: Answer
score: 0

http://stackoverflow.com/comment/34933889
comment on: http://stackoverflow.com/a/22892065
score: 0
has text: i ll just try dat once
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34884909
has text: It's fairly straightforward once you follow the steps plus a number of advantages, updates for new jars, Javascript interaction, more professional
comment on: http://stackoverflow.com/a/22865206
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34863555
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22852893
has text: I tried that but had a compile time error as `aspectOf()` is undefined. "The method aspectOf() is undefined for the type Profiler". I presumed I was doing it wrong.
type: AnswerComment

http://stackoverflow.com/q/22864095
tagged with: swing
has body: About this question: Reading data from CSV file and displaying it in a JTable I tried to adapt the program of this question to make it fit to my need but it is making mistakes. I want the program to display a file located in the root of my project (so I have to write File DataFile = new File("res.csv");) that's all. The problem is that it displays only 2 lines, when 4 lines are supposed to be displayed. Here is the code : import java.util.*; import java.awt.event.*; import javax.swing.*; import java.awt.BorderLayout; import java.awt.*; import javax.swing.border.EmptyBorder; import java.io.*; import javax.swing.table.*; public class T1Data extends JPanel { private final JTable table; public T1Data() { super(new BorderLayout(3, 3)); this.table = new JTable(new MyModel()); this.table.setPreferredScrollableViewportSize(new Dimension(700, 70)); this.table.setFillsViewportHeight(true); JPanel ButtonOpen = new JPanel(new FlowLayout(FlowLayout.CENTER)); add(ButtonOpen, BorderLayout.SOUTH); // Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); // Add the scroll pane to this panel. add(scrollPane, BorderLayout.CENTER); // add a nice border setBorder(new EmptyBorder(5, 5, 5, 5)); CSVFile Rd = new CSVFile(); MyModel NewModel = new MyModel(); this.table.setModel(NewModel); File DataFile = new File("res.csv"); ArrayList&lt;String[]&gt; Rs2 = Rd.ReadCSVfile(DataFile); NewModel.AddCSVData(Rs2); System.out.println("Rows: " + NewModel.getRowCount()); System.out.println("Cols: " + NewModel.getColumnCount()); } // Method for reading CSV file public class CSVFile { private ArrayList&lt;String[]&gt; Rs = new ArrayList&lt;&gt;(); private String[] OneRow; public ArrayList&lt;String[]&gt; ReadCSVfile(File DataFile) { try { BufferedReader brd = new BufferedReader( new FileReader(DataFile)); while (brd.readLine() != null) { String st = brd.readLine(); OneRow = st.split(",|\\s|;"); Rs.add(OneRow); System.out.println(Arrays.toString(OneRow)); } // e…
type: Question
has answer: http://stackoverflow.com/a/22864643
tagged with: java
score: 4
linked to: http://stackoverflow.com/q/11353875
tagged with: jtable
possible better answer: http://stackoverflow.com/a/22864650
answer count: 2
has answer: http://stackoverflow.com/a/22864650
has title: Reading data from a specific CSV file and displaying it in a JTable
favorite count: 0
tagged with: file-io
tagged with: http://stackoverflow.com/tag/csv
upvote count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22864643
downvote count: 0

http://stackoverflow.com/comment/35064364
comment on: http://stackoverflow.com/a/22964667
type: AnswerComment
has text: @Moh-Aw +1 nice link with explanations
score: 0
type: Comment

http://stackoverflow.com/comment/35245710
score: 1
comment on: http://stackoverflow.com/a/22879571
type: AnswerComment
type: Comment
has text: Thanks Lukas, first option didn't work. I was missing the schema I guess.

http://stackoverflow.com/q/22866058
linked to: http://stackoverflow.com/q/4818699
tagged with: multithreading
has body: This program runs 4 threads and searches for prime numbers from 1 to 100. Sometimes 2 threads are simultaneously attacking and numbers are repeated. I tried to synchronize the thread but I do not know how to do it well. Can I you can help? Sorry for my bad English import java.util.ArrayList; public class EjemploThread1 extends Thread{ static int numero=1; static ArrayList&lt;Integer&gt; primos = new ArrayList&lt;Integer&gt;() ; public synchronized void run() { //try { while (numero &lt; 100){ numero++; if (!primos.contains(numero) &amp;&amp; esPrimo(numero)) { primos.add(numero); } notifyAll(); //yield(); try { sleep(1); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } //MAIN public static void main(String[] args) throws InterruptedException { EjemploThread1 hilos = null; int n_hilos=4; //Crear los 4 Hilos for (int i=0;i&lt;=n_hilos;i++) { hilos = new EjemploThread1(); hilos.start(); } for (int i=0;i&lt;=n_hilos;i++) { hilos.join(); } //cuando finalizen los hilos(join) continuara y mostrara el vector: System.out.println("\nVECTOR NUMEROS PRIMOS: "); for(int i=0; i &lt; primos.size(); i++) { System.out.print(primos.get(i) + " "); } } //FUNCION SABER SI ES PRIMO public static boolean esPrimo(int numero) { for(int i=2; i&lt;numero; i++) { if(numero % i == 0) return false; //no es primo } return true; //es primo } }
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22866331
accepted answer: http://stackoverflow.com/a/22866163
has title: Java Thread Synchronized
answer count: 3
has answer: http://stackoverflow.com/a/22866163
has answer: http://stackoverflow.com/a/22866495
downvote count: 0
tagged with: synchronization
favorite count: 0
possible better answer: http://stackoverflow.com/a/22866331
upvote count: 2

http://stackoverflow.com/comment/34869588
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22810526
has text: As usual, "it doesn't work" is a very vague description of a problem. You should also provide a minimal example, in 99% of cases you can replicate the problem without posting the whole wall of code, which is a noise for readers.

http://stackoverflow.com/q/22826397
type: AnsweredQuestion
has title: why do void sort methods return the paramater changed?
tagged with: java
downvote count: 2
tagged with: methods
type: Question
tagged with: sorting
has answer: http://stackoverflow.com/a/22827139
possible better answer: http://stackoverflow.com/a/22849439
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22849439
has body: I have been writing various methods with return statements, but I recently was told to just leave the methods void and your parameter will be changed simply mergeSort(a); System.out.println(Arrays.toString(a)); will print a sorted array a. Why is this true? How does the parameter get changed without return. I am used to scripting languages, maybe this is the confusion.
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/22826442
accepted answer: http://stackoverflow.com/a/22827139

http://stackoverflow.com/a/22859110
answers question: http://stackoverflow.com/q/22858965
has body: If you really want a generic method, you can write: public static &lt;T extends MyObject&gt; Response sendResponse(T object){ return response; } There is no practical difference between this and the obvious non-generic solution.
has comment: http://stackoverflow.com/comment/34909693
type: Answer
score: 2
upvote count: 3
downvote count: 1

http://stackoverflow.com/comment/133228869
has text: this is wrong solution because SimpleDateFormat is not thread safe
type: Comment
comment on: http://stackoverflow.com/a/29188014
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35066967
type: QuestionComment
comment on: http://stackoverflow.com/q/22965928
score: 1
has text: check now i have updated code
type: Comment

http://stackoverflow.com/comment/34985270
type: Comment
has text: Thank you for clarification. May be you add them to your answer and Users will find them better as in the comments.
type: AnswerComment
comment on: http://stackoverflow.com/a/22917218
score: 0

http://stackoverflow.com/q/22957717
accepted answer: http://stackoverflow.com/a/22958521
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35052712
has answer: http://stackoverflow.com/a/22958521
possible better answer: http://stackoverflow.com/a/22958468
tagged with: jtable
score: 0
answer count: 2
has body: I want to add some data to a JTable and write to some file. The data is not being added to the table but is bring written to the file correctly. Here is the piece of code I'm referring to: import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.GridLayout; import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Vector; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.table.DefaultTableModel; public class Layout extends JFrame { DefaultTableModel dtm; public Layout() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); p1 = new JPanel(new BorderLayout()); p2 = new JPanel(new BorderLayout()); p3 = new JPanel(new GridLayout(4, 2)); p4 = new JPanel(new FlowLayout()); p5 = new JPanel(new BorderLayout()); l1 = new JLabel("Item"); l2 = new JLabel("Price"); l3 = new JLabel("Quantity"); l4 = new JLabel("ReorderLevel"); tf1 = new JTextField(); tf2 = new JTextField(); tf3 = new JTextField(); tf4 = new JTextField(); p3.add(l1); p3.add(tf1); p3.add(l2); p3.add(tf2); p3.add(l3); p3.add(tf3); p3.add(l4); p3.add(tf4); b1 = new JButton("Add"); b2 = new JButton("Update"); b3 = new JButton("Delete"); b4 = new JButton("List"); p4.add(b1); p4.add(b2); p4.add(b3); p4.add(b4); t = new JTable(); t.setModel(new javax.swing.table.DefaultTableModel( new Object[][]{ //{null, null, null, null}, //{null, null, null, null}, //{null, null, null, null} }, new String[]{ "Item", "Price", "Quantity", "Reorder" } )); sc = new JScrollPane(t); p5.add(sc, BorderLayout.CENTER); p2.add(p3, BorderLayout.NORTH); p2.add(p4, BorderLayout.SOUTH); p1.add(p2, BorderLayout.NORTH); p1.add(p5, BorderLayout.CENTER); add(p1); pack(); b1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.Acti…
has title: Displaying data in JTable
has answer: http://stackoverflow.com/a/22958468
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/q/22906343
type: Question
has comment: http://stackoverflow.com/comment/34959745
has title: Convert time in milisec in android
has comment: http://stackoverflow.com/comment/34959551
has comment: http://stackoverflow.com/comment/34959664
has body: Log.d("Time", String.valueOf(calendarSelected.get(Calendar.DAY_OF_MONTH) + "/" + (monthNumber+1) + "/" + year+ ", " + hour12 + ":" + min+ " " + AM_PM)); it returns date like 7/4/2014, 1:44 PM I tried with this Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH, calendarSelected.get(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.MONTH, (monthNumber)); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.HOUR, hour24); calendar.set(Calendar.MINUTE, min); calendar.set(Calendar.SECOND, 1); But it gives me this Tue Apr 08 01:44:01 GMT+06:00 2014 in milisec 1396899841127.Which is wrong. How can I covert that in MiliSec?
has comment: http://stackoverflow.com/comment/34959721
score: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/34959822
has answer: http://stackoverflow.com/a/22906704
has comment: http://stackoverflow.com/comment/34959596
has comment: http://stackoverflow.com/comment/34960463
type: UnansweredQuestion
tagged with: time
has comment: http://stackoverflow.com/comment/34959707
has comment: http://stackoverflow.com/comment/34959669
tagged with: java

http://stackoverflow.com/q/22905330
score: 0
has body: I know what the errors are. I want to know if its possible to do something like this. (Basically looking for an alternative way of doing this but is actually correct.) Class: private String[] names = {"Player 1", "Player 2"}; public void setName(Object[] objectName, String name) for(int x = 0; x &lt; objectName.length; x++){ //Problem is below here, "name can not be resolved or is not a field" is doing something like this not possible? objectName[x].name = names[x]; } } Edited to show how it would be used. Class 2: Public static void methodName(){ String name; ClassName2[] c2 = new ClassName2[2]; c2[0] = new ClassName2(); c2[1] = new ClassName2(); c2[0].setName(c2, name); }
has comment: http://stackoverflow.com/comment/34957685
has answer: http://stackoverflow.com/a/22905998
tagged with: object
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34958303
tagged with: java
tagged with: methods
type: Question
answer count: 2
has title: Using an object array inside a method
has answer: http://stackoverflow.com/a/22905683
accepted answer: http://stackoverflow.com/a/22905683
tagged with: arrays
has comment: http://stackoverflow.com/comment/34957912
tagged with: string
possible better answer: http://stackoverflow.com/a/22905998
has comment: http://stackoverflow.com/comment/34957704

http://stackoverflow.com/comment/34817319
score: 0
type: QuestionComment
has text: I would be surprised if your proposed solution for sorted array were to be accepted.
comment on: http://stackoverflow.com/q/22827673
type: Comment

http://stackoverflow.com/q/22896967
has answer: http://stackoverflow.com/a/22897071
type: Question
accepted answer: http://stackoverflow.com/a/22898298
answer count: 2
has comment: http://stackoverflow.com/comment/34943186
has body: I am trying to create a jar file for the .java program followed the steps as Step 1. Create a 'mywork' folder Step 2: Put the XYZ.java and the gson.jar file under the mywork folder Step 3. Use javac -cp .:gson.jar XYZ.class Step 4. Create Jar File -&gt; jar cf XYZ.jar XYZ.class Step 5. Create a Manifest.txt and modify it to include MainClass:XYZ Step 6. Modify Manifest.txt to include classpath for gson.jar Step 7. Then run the command-&gt; jar cfm XYZ.jar Manifest.txt XYZ.class argument1 argument2 when I am doing step 7 I am getting "java.io.IOException: invalid header field" error Where am I going wrong, please help me to solve the problem. My Manifest.txt is like Manifest-Version: 1.0 Class-Path:gson.jar Created-By: 1.7.0_06 (Oracle Corporation) Main-Class: XYZ main method: public static void main(String[] args) throws Exception { // Enter the values for the arguments String dirstr = args[0]; String logfiledirstr = args[1]; XYZ data = new XYZ(); data.method1(dirstr,logfiledirstr); }
has comment: http://stackoverflow.com/comment/34943082
has title: how to create jar file?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34942657
has comment: http://stackoverflow.com/comment/34942622
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34942518
has answer: http://stackoverflow.com/a/22898298
tagged with: jar
possible better answer: http://stackoverflow.com/a/22897071

http://stackoverflow.com/comment/35006906
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22929904
has text: thanks, i try to modify the c++ code to use serializeToArray on c++. but how to receive it on java? updated my question for the code. and im using wire library from square which not implementing all method from protobuf.

http://stackoverflow.com/comment/34953528
type: QuestionComment
has text: Oh, so what you're saying is that b/c an ArrayList instance is of a class, then it is able to bypass this requirement in that it can store an internal array of objects w/o having a requirement on the type of the object?
comment on: http://stackoverflow.com/q/22902935
score: 0
type: Comment

http://stackoverflow.com/a/22836410
upvote count: 5
has comment: http://stackoverflow.com/comment/34834838
has comment: http://stackoverflow.com/comment/34834801
downvote count: 0
has comment: http://stackoverflow.com/comment/34834981
type: Answer
has comment: http://stackoverflow.com/comment/34834522
has body: You are mixing two different things up. In the How to serialize a lambda? question &amp; answer there is a lambda expression being cast to an intersection type. Runnable r = (Runnable &amp; Serializable)() -&gt; System.out.println("Serializable!"); This tells the compiler to generate a type compatible to the intersection type. Therefore the generated class for the lambda expression will be both, Runnable and Serializable. Here you are casting an instance of a concrete class to an intersection type: (List&lt;Integer&gt; &amp; RandomAccess)linkedList This requests a runtime-check whether the concrete instance’s class implements an appropriate type, i.e. fulfills all interfaces. This runtime-check fails as LinkedList does not implement RandomAccess.
answers question: http://stackoverflow.com/q/22819804
score: 5

http://stackoverflow.com/q/22931720
has comment: http://stackoverflow.com/comment/93520878
has answer: http://stackoverflow.com/a/60336658
tagged with: apache
linked to: http://stackoverflow.com/q/28775123
has comment: http://stackoverflow.com/comment/110428644
tagged with: tomcat
favorite count: 0
score: 64
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/60566256
has answer: http://stackoverflow.com/a/61076792
has title: Is there a way to modify an HTTP request in Chrome or Firefox?
has answer: http://stackoverflow.com/a/78083470
answer count: 4
linked to: http://stackoverflow.com/q/1680381
downvote count: 0
tagged with: java
has body: Is there a way to modify an HTTP request using Chrome dev tools or Firebug? For example when developing locally and testing in Chrome, I have a page that needs an HTTP request to fill some data. Because it's local, that service isn't available. Currently the only way of getting around the problem is configuring a proxy pass in Apache so it hits a QA environment for that call. I'm looking or a simpler way to achieve this because I use Jetty to test the app and can't configure a proxy pass (or that I know of). In other words, is there a way to create a temporary proxy pass for the current session when testing an app locally?
tagged with: google-chrome
tagged with: http
type: Question
upvote count: 64
has answer: http://stackoverflow.com/a/76773731

http://stackoverflow.com/comment/34851821
type: QuestionComment
comment on: http://stackoverflow.com/q/22846816
has text: This stackoverflow http://stackoverflow.com/questions/8314174/datagramsocket-temporarily-stops-receiving-packets-java saw a similar problem. Is there an issue with Java UDP stack?
score: 0
type: Comment

http://stackoverflow.com/q/22835176
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/22855671
has title: What is best practice to call any other servlet in other JVM from some other JVM
has body: i was going through the difference between servlet context and servlet config and there is one question that came to my mind that suppose if one of my servlet in JVM1 want to call any other servlet in JVM2 than how could we do it. Say i am login into one appliaction in JVM1's web server and in between it want to access another apllication in some other JVM2's web server and i do not want user to pop for login again than what could be the best solution for this. Someone told me load balancing clustering is one solution.
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34830969
score: 1
tagged with: java
tagged with: jboss
has comment: http://stackoverflow.com/comment/34830682
accepted answer: http://stackoverflow.com/a/22855671
type: Question
has comment: http://stackoverflow.com/comment/34831522
tagged with: servlets
answer count: 1
downvote count: 0

http://stackoverflow.com/q/22903565
tagged with: polymorphic-associations
score: 0
possible better answer: http://stackoverflow.com/a/22903621
has title: Creating a method which receives polymorphic input
has body: I want to call a specific method named "center" which I use to print the centres of the objects as a string. I want this method to accept any object from these classes. The centres of the object are the first two int values (x,y). All of these classes share this method as it is inherited from the Circle2 class. I call this method (namely the center() method) in the main method of this class. The method I intend to create is supposed to output (replacing the println methods in the main) the values for centres of these objects (which I will eventually place within an ArrayList, whose process I'll have to review, as I can't recall by what means I would go about this). Any insight on either of these would be highly helpful. In short--I mean to create a method in this class that will accept any of the objects constructed in this main (as they presently are) as input and then output the result of calling the center() method that they all have in common. Apologies if my explanation isn't completely clear--if it isn't totally apparent what I mean to do, I would be happy to attempt to give further clarity on the issue. public class TestPoly2 { /** * Constructor for objects of class TestPoly2 */ public TestPoly2() { } public String showCenter() { return "This method is supposed to output (replacing the println methods in the main) the values for centres of these objects (which I will eventually place within an ArrayList (whose process I'll have to review, as I can't recall by what means I would go about this) "; } public static void main(String []args) { Circle2 one = new Circle2(5, 10, 4); Cylinder2 two = new Cylinder2(8, 7, 4, 12); Oval2 three = new Oval2(3, 4, 9, 14); OvalCylinder2 four = new OvalCylinder2(11, 14, 15, 10, 12); System.out.println(one.center()); System.out.println(two.center()); System.out.println(three.center()); System.out.println(four.center()); } } The method (center()) that I've been referencing is as follows: public String center() { return "center is …
type: AnsweredQuestion
tagged with: call
has comment: http://stackoverflow.com/comment/34955623
has answer: http://stackoverflow.com/a/22904433
accepted answer: http://stackoverflow.com/a/22904433
has comment: http://stackoverflow.com/comment/34955173
tagged with: java
has answer: http://stackoverflow.com/a/22903621
tagged with: methods
has comment: http://stackoverflow.com/comment/34955976
has comment: http://stackoverflow.com/comment/34954572
type: Question
answer count: 2
tagged with: syntax-error

http://stackoverflow.com/comment/34959601
type: AnswerComment
has text: My fault, it's `(load "Physics/core")`.
type: Comment
comment on: http://stackoverflow.com/a/22906389
score: 0

http://stackoverflow.com/comment/34846994
type: QuestionComment
has text: Yes sir, that is exactly what i meant. I opened deploytool to use the functionality of both. But i dont think there is any problem with any of those things.
comment on: http://stackoverflow.com/q/22843869
score: 0
type: Comment

http://stackoverflow.com/comment/34784394
type: Comment
comment on: http://stackoverflow.com/a/22808933
has text: @MarounMaroun From where do you get those → ?
score: 0
type: AnswerComment

http://stackoverflow.com/q/22910080
tagged with: java
has answer: http://stackoverflow.com/a/22910207
type: Question
has body: I am prompting my app users for email credentials. After the user insert email and pass I want to validate the account. I am using javax.mail. Is there any way to validate the account? only make sure that the credentials are indeed valid - else I want to show an invalid user and pass message. Maybe some way to perform: Transport.send(message); And check for authentication exceptions while not sending anything.
has title: Validating user email authentication
score: 0
tagged with: jakarta-mail
has answer: http://stackoverflow.com/a/22947885
has answer: http://stackoverflow.com/a/22910424
type: UnansweredQuestion
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/22910360

http://stackoverflow.com/comment/34998058
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22927379
has text: @Numeron, I have edited it to match his top-level description of what he's trying to do.

http://stackoverflow.com/q/22847767
has comment: http://stackoverflow.com/comment/34854451
has comment: http://stackoverflow.com/comment/34856806
has comment: http://stackoverflow.com/comment/34856306
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34853622
tagged with: user-interface
has comment: http://stackoverflow.com/comment/34897694
has comment: http://stackoverflow.com/comment/34854298
score: 0
tagged with: freeze
has body: I'm programming an Abalone game in java and my AI freeze the UI 2-3 sec on each move. public GameState doMove(Move move) { Color current = this.game.getTurn(); if (current == Color.NONE) { return GameState.OUTOFTURNS; } else if (this.game.over()) { System.out.println("Partie terminé"); return GameState.WON; } System.out.println("Application du mouvement de " + current); this.game.getBoard().apply(move); AI ai = AI.getInstance(); System.out.println("On passe au tour suivant"); Color next = this.game.getNextTurn(); System.out.println("On met à jour la board"); this.window.updateBoard(this.game.getTurn()); if (next.equals(ai.getColor())) { System.out.print("L'IA joue... c'est long..."); doMove(ai.getBestMove(next)); System.out.println("fini"); } return GameState.RUNNING; } What should I use ? Thread, SwinWorker, Callable ? Here's the complete source code : https://github.com/melkir/Abalone/blob/master/src/main/java/com/github/abalone/controller/GameController.java
has comment: http://stackoverflow.com/comment/34856929
has comment: http://stackoverflow.com/comment/34856403
has comment: http://stackoverflow.com/comment/34888816
answer count: 0
has title: Java GUI blocked by long treatment
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34854521

http://stackoverflow.com/q/22881297
score: 1
tagged with: java
type: Question
has title: How to display values in grids(Struts 2.x)?
has comment: http://stackoverflow.com/comment/34922298
downvote count: 0
answer count: 1
tagged with: jsp
has body: When run on tomcat server(local server) values are getting in grid(Strusts 2.x),but when i deploy on server(10.x.x.x) grid values are not getting.
tagged with: javascript
linked to: http://stackoverflow.com/q/22880555
tagged with: struts2
tagged with: struts2-jquery
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23380908
type: UnansweredQuestion

http://stackoverflow.com/comment/34919909
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22883637
has text: above in the question i post how i open old saves can that be the problem ? and no the methode isnt called truth the lists are cleared

http://stackoverflow.com/a/22812780
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/22812746
has body: because j is never reset back to 0. the 1st inner loop iteration runs j from 0 to 4 (incrementing u 5 times in total making it 5) and then never runs again as j remains at 4 - so the rest of the outer loop iterations (i=1 to i=4) do nothing.
answers question: http://stackoverflow.com/q/22812746
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/34790186
downvote count: 0

relative-path
type: Tag
tags question: http://stackoverflow.com/q/22902084
tag name: relative-path

http://stackoverflow.com/a/22877250
accepted answer of: http://stackoverflow.com/q/22873937
has comment: http://stackoverflow.com/comment/34932789
has comment: http://stackoverflow.com/comment/34923945
has comment: http://stackoverflow.com/comment/34921722
has comment: http://stackoverflow.com/comment/34919560
has body: Either you need to draw portions (see the second and third parameter of glDrawArrays) of your vertex buffer where after each part you can perform a state switch (such as adjusting the bound textures, adjusting the shader), or you have to program your shader so it can render without ‘state switches’. The extend that this is possible entirely depends on the type of state switches and current possibilities of the ‘programmable pipeline’. For example, if the only state switch you currently have, are textures. You could put the textures in a texture array (or an array of samplers); in your objects geometry you need to add an attribute that determines which ‘texture layer’ is used for sampling. Since the attribute has to be stored in your vertex buffer, it also becomes a complex issues of how much space it consumes to make it batchable versus the net performance gain. Original: sampler2d texture; varying vec2 uv; void main() { vec4 color = texture2D(texture, uv); } Array of samplers: sampler2d texture[32]; varying vec2 uv; varying float layer; void main() { vec4 color = texture2D(texture[layer], uv); } Texture Array version: sampler2dArray texture; varying vec2 uv; varying float layer; void main() { vec4 color = texture3D(texture, vec3(uv, layer)); } Please note that the code above is just rough pseudocode.
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34921987
type: Answer
has comment: http://stackoverflow.com/comment/34922924
upvote count: 2
answers question: http://stackoverflow.com/q/22873937

http://stackoverflow.com/a/22878264
has body: You need to scape the period (.): s.useDelimiter("\\."); and then use next() which returns the next complete token, since hasNext() returns a boolean representinf if the scanner has another token in its input: String first = s.next(); String second = s.next();
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22878200
has comment: http://stackoverflow.com/comment/34909342
answers question: http://stackoverflow.com/q/22878200

http://stackoverflow.com/comment/34918200
type: Comment
comment on: http://stackoverflow.com/q/22883256
has text: Actually, you can modify a collection you are working on, *if* you use an Iterator instead of a foreach loop, using iter.remove(). But that still won't let you do a removeAll().
score: 0
type: QuestionComment

http://stackoverflow.com/a/22932852
answers question: http://stackoverflow.com/q/22932251
downvote count: 0
has body: So what is the size of the element if the element type is Object. ?? The size of an Object[] array element is the size of a reference. On a 32 bit JVM, a reference is 32 bits (4 bytes) On a 64 bit JVM, a reference is 64 bits (8 bytes), or 32 bits if the "compressed oop" optimization is enabled and the heap size is less than 32Gb. So your array allocation will allocate a heap object containing roughly 4 x 10 or 8 x 10 bytes ... plus about 12 bytes of object header overhead. Just tried this line in my machine List&lt;String&gt; s = new ArrayList&lt;String&gt;(Integer.MAX_VALUE); Under the covers, you are attempting to allocate attempting to allocate an array containing between 233 and 234 bytes. With a 32bit JVM, that is guaranteed to not work. With a 64 bit JVM, you'd need a heap of at least 8Gb (compressed oop) or 16Gb for that to work.
has comment: http://stackoverflow.com/comment/35008058
type: Answer
has comment: http://stackoverflow.com/comment/35008177
has comment: http://stackoverflow.com/comment/35008576
has comment: http://stackoverflow.com/comment/35008689
score: 4
has comment: http://stackoverflow.com/comment/35008429
upvote count: 4

http://stackoverflow.com/comment/35078620
type: QuestionComment
has text: What did make it clear was experimenting with it and then realizing it was like protected internal in C#, where within a derived class in the same assembly as the base class you can call a protected member on an instance of the base class, but not within a derived class within a different assembly than the base class.
comment on: http://stackoverflow.com/q/22968085
score: 0
type: Comment

http://stackoverflow.com/comment/34893600
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22849607
has text: I write exception e to logcat and it says: 04-04 20:08:57.540: D/bład(3162): android.os.NetworkOnMainThreadException
score: 0

http://stackoverflow.com/comment/35001565
type: QuestionComment
has text: Perhaps [PowerMock](https://code.google.com/p/powermock/) is your friend here. It has the ability to mock out calls to static methods, so you could mock the LoginController object and add expectations the calls to the static methods.
score: 0
comment on: http://stackoverflow.com/q/22895293
type: Comment

http://stackoverflow.com/comment/35011460
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22935106
has text: delete the `content.setText(SetServerString);` from the method `doInBackground()`. the UI cannot be modified or touched from this method, if you want to update your UI, you can do that on the `onPostExecute()` method. here an example of using asynctask while downloading an image from server : http://www.android-ios-tutorials.com/182/show-progressbar-while-downloading-image-using-asynctask-in-android/

http://stackoverflow.com/a/23138508
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22885896
upvote count: 1
type: Answer
has body: may be useful for somebody: So, I understand this difference. XYSplineRenderer builds Natural Cubic Spline interpolation. Grapher 10 builds monotone cubic spline interpolation. This is difference, nice example of it is here. new code of spline renderer here: package splinedemo; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.util.Vector; import java.lang.Math; import static java.lang.Math.sqrt; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.event.RendererChangeEvent; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYItemRendererState; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.xy.XYDataset; import org.jfree.ui.RectangleEdge; public class SplineRenderer extends XYLineAndShapeRenderer { private Vector points; private int precision; public SplineRenderer() { this(5); } public SplineRenderer(int precision) { super(); if (precision &lt;= 0) { throw new IllegalArgumentException("Requires precision &gt; 0."); } this.precision = precision; } public int getPrecision() { return this.precision; } public void setPrecision(int p) { if (p &lt;= 0) { throw new IllegalArgumentException("Requires p &gt; 0."); } this.precision = p; fireChangeEvent(); } public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info) { State state = (State) super.initialise(g2, dataArea, plot, data, info); state.setProcessVisibleItemsOnly(false); this.points = new Vector(); setDrawSeriesLineAsPath(true); return state; } protected void drawPrimaryLineAsPath(XYItemRendererState state, Graphics2D g2, XYPlot plot, XYDataset dataset, int pass, int series, int item, ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea) { RectangleEdge xAxisLocation = plot.getDomainAxisEdge(); RectangleEdge yAxisLocation = plot.getRangeAxisEdge(); double x1 = da…

http://stackoverflow.com/comment/35048032
comment on: http://stackoverflow.com/q/22955621
has text: You're importing the wrong `List`. It's supposed to be `java.util.List`.
score: 13
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23054379
has body: go to debug perspective veiw select java file and right cilck: select Edit source lookup... and select checkbox search for duplicates source file on the path Every time when eclipse will met duplicates files in your workspace you can choose needed file.
accepted answer of: http://stackoverflow.com/q/22967497
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22967497
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/22869970
tagged with: spring-roo
answer count: 1
has body: I bumped into this problem today, and can't solve it. I have a project which contains class Domain. @DiscriminatorColumn(name = "type_abrv", columnDefinition = "type_abrv", discriminatorType = DiscriminatorType.STRING) @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public class Domain { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; @Size(max = 100) private String description; @Size(max = 10) @Column(name = "ABRV") private String abbreviation; @ManyToOne(targetEntity = Domain.class, optional = true, fetch = FetchType.LAZY) @JoinColumn(name = "id_parent", nullable = true, insertable = false) @Cascade({ CascadeType.PERSIST }) private Domain parent = null; @ManyToOne(targetEntity = DomainType.class, fetch = FetchType.LAZY) @JoinColumn(name = "id_type", nullable = true, insertable = false, referencedColumnName = "id") @Cascade({ CascadeType.ALL }) private DomainType type; @Column(name = "ACTIVE") private Boolean active; } In other projects, I want to extend Domain, for instance: @Entity @RooJpaEntity @DiscriminatorValue(value="MSGST") public class MessageStatus extends Domain { public static String TYPE_ABRV = "MSGST"; public static String PENDING = "PEND"; public static String PROCESSING = "IN_PROCESS"; public static String PROCESSED = "DONE"; } The thing is, Roo is generating a MessageStatus_Roo_Jpa_Entity containing Long id, causing a conflict when I try to compile the project. error at br\com\g4it\util\model\domain\Domain.java::0 can't override java.lang.Integer ~.model.domain.Domain.getId() with java.lang.Long ~.model.queueout.MessageStatus.getId() return types don't match privileged aspect MessageType_Roo_Jpa_Entity { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long MessageType.id; public Long MessageType.getId() { return this.id; } public void MessageType.setId(Long id) { this.id = id; } ... } So, my question is: Is it that it's not possible to do what I'm trying, or I'm doing it wrong? What w…
has comment: http://stackoverflow.com/comment/34896027
favorite count: 0
tagged with: maven
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22980620
tagged with: java
downvote count: 1
type: Question
upvote count: 0
score: -1
tagged with: sts-springsourcetoolsuite
has title: Replace Roo @Id Long id with @Id Integer id on superclass doesn't affect child classes
has answer: http://stackoverflow.com/a/22980620

http://stackoverflow.com/comment/34929162
has text: @ErwinBolwidt The 0 character is not a printable character so it would not be expected to be displayed.
type: Comment
comment on: http://stackoverflow.com/a/22889415
score: 0
type: AnswerComment

http://stackoverflow.com/q/22876139
possible better answer: http://stackoverflow.com/a/22876606
has comment: http://stackoverflow.com/comment/34905633
has comment: http://stackoverflow.com/comment/34905696
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22876606
has comment: http://stackoverflow.com/comment/34905654
type: Question
answer count: 2
has title: Class VS HashMap for more than 50 fields from file
tagged with: performance
tagged with: oop
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22878923
has comment: http://stackoverflow.com/comment/34905691
has body: I have a huge file which has around 60 columns separated by a delimiter. It has more than 1000 records. I have another file which has only two columns of which has one common column between two files. I want to do a inner join kind of manipulation in java between two files based on the column and combine the records. Class object with 60 fields(POJO for each file) or HashMap for each file. which would be the best design decision to load the information from these two files for manipulation? or any other suggestion?
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34905485
has answer: http://stackoverflow.com/a/22878923

http://stackoverflow.com/a/22890744
type: Answer
has comment: http://stackoverflow.com/comment/64355151
score: 3
has body: The JVM runtime can be restricted by providing a policy file. Java unfortunately is not fullproof, so you would be wise to restrict the account running the JVM at the OS level. If you are allowing the end user to compile scala code on your server then the compiler might execute macro code which is an additional attack surface. Scalac has probably not been designed to protect against malicious macros. Scalac runs within a JVM itself and could be similarly sandboxed. This question is very close to yours.
upvote count: 3
answers question: http://stackoverflow.com/q/22888436
downvote count: 0

http://stackoverflow.com/comment/34942029
type: QuestionComment
comment on: http://stackoverflow.com/q/22896743
has text: Can you post the stack trace?
score: 0
type: Comment

http://stackoverflow.com/a/22949775
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35038059
has body: The obj variable in abc is not the same as the obj parameter in xyz. When you call xyz, xyz works with a copy of the reference (NOTE: this is not a copy of the object, but it's a copy of the reference). So when obj = new Abc() is executed in xyz, it modifies only the copy in xyz. It has no effect on the obj in abc(), because the reference is passed by value.
has comment: http://stackoverflow.com/comment/35038019
has comment: http://stackoverflow.com/comment/35038052
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22949718
type: Answer
answers question: http://stackoverflow.com/q/22949718

http://stackoverflow.com/comment/34836539
comment on: http://stackoverflow.com/q/22838512
score: 0
type: Comment
type: QuestionComment
has text: @Starscream1984 I'm saying that if I keep all of those things constant how do I know when to change languages. I can simply change languages after every 10 "tr" that I write but then I get things like pages with mixed Portuguese and English.

http://stackoverflow.com/comment/35137826
type: Comment
has text: Hi Stanley Can you Please tell me Instead of File f = new File(System.getenv("CATALINA_HOME") + "/temp"); we can use other Thing so that It will support for all server not only for Tomcat server. Thanks In Advance
comment on: http://stackoverflow.com/a/22959648
score: 0
type: AnswerComment

http://stackoverflow.com/q/22840723
tagged with: dictionary
has comment: http://stackoverflow.com/comment/34840447
has comment: http://stackoverflow.com/comment/34841311
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34841407
has answer: http://stackoverflow.com/a/22840864
has comment: http://stackoverflow.com/comment/34841258
accepted answer: http://stackoverflow.com/a/22842072
possible better answer: http://stackoverflow.com/a/22840864
has comment: http://stackoverflow.com/comment/34841535
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/34841763
downvote count: 0
favorite count: 0
has body: I am writing a small application to be used for testing purposes that accepts SOAP calls, generated UID's for each call, and returns this UID. The UID's need to be stored on the server so I thought I'd use a simple static Map to store them. I created a new class: MemoryMap.java public class MemoryMap { static Map&lt;String, String&gt; memoryMap = new ConcurrentHashMap&lt;String, String&gt;(); static void printMapContents() { for (Entry&lt;String, String&gt; pair : memoryMap.entrySet()) { System.out.println("Key = [" + pair.getKey() + "]"); System.out.println("Value = [" + pair.getValue() + "]"); } } } This is then used with the calls: MemoryMap.memoryMap.put(UID, "testString"); MemoryMap.printMapContents(); and... MemoryMap.memoryMap.remove(parameters.getUID()); MemoryMap.printMapContents(); This works fine, but I can't think whether this is the recommended way to implement a single Map for this purpose.
tagged with: static
type: Question
answer count: 2
has title: Implementing a static "memory" Map
has answer: http://stackoverflow.com/a/22842072

http://stackoverflow.com/q/22926719
has comment: http://stackoverflow.com/comment/34996874
accepted answer: http://stackoverflow.com/a/22926826
has answer: http://stackoverflow.com/a/22926798
has comment: http://stackoverflow.com/comment/34997015
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34996851
has comment: http://stackoverflow.com/comment/34997012
has comment: http://stackoverflow.com/comment/34996858
has answer: http://stackoverflow.com/a/22926826
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34996992
tagged with: java
possible better answer: http://stackoverflow.com/a/22926798
has title: Two dimensional array bug (can't find it)
upvote count: 2
has comment: http://stackoverflow.com/comment/34996906
answer count: 2
tagged with: arrays
has body: I am doing this homework project that produces the pascals triangle but I'm getting an error and I can't find it. I looked it over many times but to me it seems okay, Can someone help me find the bug? public class PascalsTriangle { public static void main(String[] args) { int[][] triangle = new int[11][]; fillIn(triangle); print(triangle); } public static void fillIn(int[][] triangle) { for (int i = 0; i &lt; triangle.size(); i++) { triangle[i] = new int[i++]; triangle[i][0] = 1; triangle[i][i] = 1; for (int j = 1; j &lt; i; j++) { triangle[i][j] = triangle[i-1][j-1] + triangle[i-1][j]; } } } public static void print(int[][] triangle) { for (int i = 0; i &lt; triangle.length; i++) { for (int j = 0; j &lt; triangle[i].length; j++) { System.out.print(triangle[i][j] + " "); } System.out.println(); } }
favorite count: 0

http://stackoverflow.com/a/22855697
upvote count: 1
has comment: http://stackoverflow.com/comment/34890710
type: Answer
downvote count: 0
score: 1
has body: After obtaining a Configuration (sConfig) instance you are trying to add XML mapping documents incorrectly. As you are using XML-based mapping files (.hbm),so to add xml mapping files you need to use addResource() method, not the addClass() method. addClass() method used to add the annotation based mappings. So replace sConfig.addClass(FooTbl.class); with sConfig.addResource("com/corp/dept/proj/FooTbl.hbm.xml"); Hope this will resolve your issue.
answers question: http://stackoverflow.com/q/22846410

http://stackoverflow.com/comment/35041298
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22951585
has text: Line 24 is the "pickedf = scan.nextLine();"

http://stackoverflow.com/comment/34890983
type: Comment
has text: Why will it return invalid month : 13 if its 13 but not 14 if the input is 14?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22868442

http://stackoverflow.com/q/22930620
tagged with: java
has comment: http://stackoverflow.com/comment/35004941
score: 0
has comment: http://stackoverflow.com/comment/35004350
has comment: http://stackoverflow.com/comment/35004736
has comment: http://stackoverflow.com/comment/35004991
type: UnansweredQuestion
tagged with: rollingfileappender
tagged with: consoleappender
has body: I'm migrating from log4j 1.2 to log4j 2.0. Earlier all my console logs and logs were printed in specific log files. But after migrating, Console logs are printed in tomcat7-stderr.logs and other logs are printed in specific log file. Is there a way I can print console logs also to the file I specified in log4j2.xml? &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;configuration status="all"&gt; &lt;appenders&gt; &lt;Console name="STDOUT"&gt; &lt;PatternLayout pattern="&amp;lt;%X{UOWID}&amp;gt; [%t] %d{yyyy/MMM/dd HH:mm:ss} %-5p [%c{1}] %m%n"/&gt; &lt;/Console&gt; &lt;RollingFile name="fileAppender" fileName="${sys:catalina.base}/logs/omp-web-services.log" filePattern="${sys:catalina.base}/logs/omp-web-services.log"&gt; &lt;PatternLayout pattern="&amp;lt;%X{UOWID}&amp;gt; [%t] %d{yyyy/MMM/dd HH:mm:ss} %-5p [%c{1}] %m%n" /&gt; &lt;Policies&gt; &lt;SizeBasedTriggeringPolicy size="250 MB"/&gt; &lt;/Policies&gt; &lt;/RollingFile&gt; &lt;/appenders&gt; &lt;loggers&gt; &lt;root level="INFO"&gt; &lt;appenderRef ref="STDOUT" level="info"/&gt; &lt;appenderRef ref="fileAppender" level="info"/&gt; &lt;/root&gt; &lt;/loggers&gt;
has title: Can I print the console logs to specific file in Log4j 2?
answer count: 0
has comment: http://stackoverflow.com/comment/35003779
tagged with: log4j2
tagged with: logging
type: Question

http://stackoverflow.com/comment/34982783
score: 1
has text: What JDK versions are used on your app server and local machine?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22919337

http://stackoverflow.com/comment/34951592
comment on: http://stackoverflow.com/a/22901844
type: Comment
has text: Right, I just saw the logcat you posted. It looks like your Button `calculate` is null. Make sure it's in your layout xml file correctly, i.e. with the exact id you have in the code.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22864122
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/22864046
has body: array[index] accesses the indexth element of array, so first = tokens[0]; // Array indices start at zero, not 1. second = tokens[1]; third = tokens[2]; You should really check the length first, and if the string you're splitting is user input, tell the user what went wrong. if (tokens.length != 3) { System.err.println( "I expected a phrase with 3 words separated by spaces," + " not `" + phrase + "`"); return; }
downvote count: 0
score: 3

http://stackoverflow.com/comment/34902047
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22874338
has text: Today i had same question in my MIND!!! :)
score: 0

http://stackoverflow.com/comment/34917553
has text: `ortaPanel.add(six).setBounds(..)` Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556), along with layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556).
type: Comment
comment on: http://stackoverflow.com/q/22882576
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34896341
has text: Thanks for the reply. By "Upload jar I meant deploy the jar file in Cloubbees". Anyways now I could deploy my jar in Cloudbees. When I tested, `System.getProperty("java.io.tempDir")` is returning `null` when I run the jar file in cloudbees. So, do we have to set this path to any cloudbees specific file system?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22855650

http://stackoverflow.com/q/22925908
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/22926587
score: 0
has title: Passing a blank / non-null VARIABLE in MYSQL Query (using Java)
tagged with: sql
answer count: 1
accepted answer: http://stackoverflow.com/a/22926587
has comment: http://stackoverflow.com/comment/34996351
has body: So I am working on a small program in Java. Basically I want the user to search a database with one or 1-3 search query and they can use any combination. A search query example would be: Book Name, ISBN, Author Name The user can search with any combination (Search by book name only, or book name and author name, or all 3 etc...). I want to basically write one master SQL statement (MYSQL), that would pull the results from the database. The problem is, I don't know what to do with a blank input. So say user enters: Book name = Harry Potter and the Chamber of Secrets ISBN = &lt;&lt; left blank>> Author Name = JK Rowling An example SQL query would be: SELECT * FROM booklist WHERE book_name = "Harry Potter and the Chamber of Secrets" AND ISBN = "" AND Author = "JK Rowling"; In Java code I am using PreparedStatement, and the String would be: String temp = " SELECT * " + " FROM booklist " + " WHERE Title = " + title + " AND Author = \"" + author + "\"" + " AND ISBN = \"" + isbn + "\""; Because the user did not enter ISBN, the SQL query fails (hence code fails). If I use null instead of "", then the query will still fail. By fail meaning that it will not find the correct book in database (even though its present), as it is still looking for "" or null in the column. Is there any way to pass kind of like a 'ghost' or invisible variable to get the SQL query to work like I am intending it to? Or do I have to go the long way and make a SQL query for each possible combination?

http://stackoverflow.com/comment/35054741
comment on: http://stackoverflow.com/q/22959427
type: Comment
type: QuestionComment
has text: @skiwi Of course there are reasons. The question is whether those reasons are accessible here. Unless someone in the JSR expert group shows up, which isn't likely, and unless they divulge the reason, which may not even be legally possible, the answer is 'no', and the result is only going to be more or less uninformed opinion.
score: 0

http://stackoverflow.com/comment/34810595
type: QuestionComment
comment on: http://stackoverflow.com/q/22823634
has text: Gut reaction is that there's some other kind of character at the start or end of the line ... Javadoc says, "By default, the regular expressions ^ and $ ignore line terminators and only match at the beginning and the end, respectively, of the entire input sequence. If MULTILINE mode is activated then ^ matches at the beginning of input and after any line terminator except at the end of input. When in MULTILINE mode $ matches just before a line terminator or the end of the input sequence. " So maybe some other line terminator sneaks in there when string is escaped.
score: 0
type: Comment

http://stackoverflow.com/comment/35060706
comment on: http://stackoverflow.com/q/22962484
has text: [Guys.. This **DOESN'T** compile...](https://ideone.com/UyjYuF)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22909542
answers question: http://stackoverflow.com/q/22909160
has body: NodeList lastNameList = firstPersonElement.getElementsByTagName("last"); finds all the descendant elements (children, grandchildren, etc.) under firstPersonElement that are named last, and returns them as a NodeList in document order. lastNameList.item(0) will be the first element from that list (think of it as an array index, so item(0) is the first node in the list, item(1) is the second, etc.). And lastNameList.item(0).getTextContent() will be a String (not a long) value containing the concatenation of all the descendant text nodes under this last element. So your code shouldn't compile, because it's not possible to cast from String to long.
accepted answer of: http://stackoverflow.com/q/22909160
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/22912072
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/22912179
has comment: http://stackoverflow.com/comment/34970624
tagged with: android-drawable
tagged with: java
possible better answer: http://stackoverflow.com/a/22912179
accepted answer: http://stackoverflow.com/a/22912422
type: AnsweredQuestion
upvote count: 0
favorite count: 0
type: Question
tagged with: android
has body: I am using the drawable menu. I have this code: public class KeretaApiFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setContentView(R.layout.fragment_kereta_api); super.onCreate(savedInstanceState); Button pilihka = (Button) getView().findViewById(id.btnpilihdgnka); View rootView = inflater.inflate(R.layout.fragment_kereta_api, container, false); pilihka.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(KeretaApiFragment.this.getActivity(), PilihDenganKA.class); startActivity(i); } }); return rootView; } and this error from Logcat: 04-07 19:00:43.539: E/AndroidRuntime(2008): FATAL EXCEPTION: main 04-07 19:00:43.539: E/AndroidRuntime(2008): java.lang.NullPointerException 04-07 19:00:43.539: E/AndroidRuntime(2008): at com.example.taapps.KeretaApiFragment.onCreateView(KeretaApiFragment.java:25) 04-07 19:00:43.539: E/AndroidRuntime(2008): at android.app.Fragment.performCreateView(Fragment.java:1695) 04-07 19:00:43.539: E/AndroidRuntime(2008): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:885) 04-07 19:00:43.539: E/AndroidRuntime(2008): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057) 04-07 19:00:43.539: E/AndroidRuntime(2008): at android.app.BackStackRecord.run(BackStackRecord.java:682) 04-07 19:00:43.539: E/AndroidRuntime(2008): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1435) 04-07 19:00:43.539: E/AndroidRuntime(2008): at android.app.FragmentManagerImpl$1.run(FragmentManager.java:441) 04-07 19:00:43.539: E/AndroidRuntime(2008): at android.os.Handler.handleCallback(Handler.java:725) 04-07 19:00:43.539: E/AndroidRuntime(2008): at android.os.Handler.dispatchMessage(Handler.java:92) 04-07 19:00:43.539: E/AndroidRuntime(2008): at android.os.Looper.loop(Looper.java:137) 04-07 19:00:43.539: E/AndroidRuntime(2008): at android.app.ActivityThread.main(Activ…
score: -2
has answer: http://stackoverflow.com/a/22912422
has title: ClickListener for Slide Menu items error FATAL Exception Main

http://stackoverflow.com/q/22895126
tagged with: date
has comment: http://stackoverflow.com/comment/34939228
type: Question
has body: I am writing a Java program using selenium. I need a function that returns a unique date (mm/dd/yyyy) each time it is called. The conditions though are that It can never return a date it returned before Is must return a date between 01/01/2071 and 12/31/9999 The program will run many times so all program memory will be lost upon termination. It must remember the dates it has returned before. See next item The easiest way to do this is just keep incrementing the date by 1 day each time, so it needs to remember only 1 date. Unfortunately I cannot write the last date returned to a file in the system to read it next time the program runs because I do not have that ability. The program will be reading data from an Excel spreadsheet so could theoretically store the latest date in a cell, but the spreadsheet will be open and it does not seem to have the ability to write to an open file. Any thoughts? One thing I thought about doing was using a base date like 1/1/2014 at 00:00:00 and then taking the current date, calculating the number of minutes between the two, and adding this as a number of days to 11/31/2070. Unfortunately this would work only a couple of years because then there would be more minutes between the two dates than there are days from 1/1/2017 to 12/31/9999 Any help is appreciated. Thanks
has comment: http://stackoverflow.com/comment/34977323
score: 0
has comment: http://stackoverflow.com/comment/35030404
has title: Creating a unique date each time between calls
tagged with: unique
answer count: 0
type: UnansweredQuestion
tagged with: selenium-webdriver
tagged with: java

http://stackoverflow.com/a/23043462
downvote count: 0
answers question: http://stackoverflow.com/q/22896124
type: Answer
score: 1
upvote count: 1
has body: I found one way to deal with my problem that can be yours. I was debugin my code, and found inside in these entities lojaMaster, seguradora and tabelaSeguro one method called handler. My problem is, the system is been developed in a older database. So Envers would not find these entities in their aud table, and didn´t find. In this picture you can see, the handler is a proxy object and has the id of the object. So I started to try to find a way to get this Id. So when I understand this is a proxy object I found in Google the solution Hibernate, and Hibernate make this like a strategy to no get all content of the object. So I got the code, and got the id. public Serializable getIdentifier(Object object) { if (!(object instanceof HibernateProxy) || Hibernate.isInitialized(object)) { return ((Persistent)object).getId(); } HibernateProxy proxy = (HibernateProxy) object; LazyInitializer initializer = proxy.getHibernateLazyInitializer(); return initializer.getIdentifier(); } So I got and check if my entity Id is null. I got the id, and findById the object. I created one hashmap to don´t every time access the database because ids can repeat. So these methods were in this way @Override public List&lt;Pojo&gt; getLog(Pojo pojo) { Map&lt;Long, Loja&gt; mapLoja = new HashMap&lt;&gt;(); Map&lt;Long, Seguradora&gt; mapSeguradora = new HashMap&lt;&gt;(); Map&lt;Long, TabelaSeguro&gt; mapTabelaSeguro = new HashMap&lt;&gt;(); List&lt;Pojo&gt; auditedList = super.getLog(pojo); if (!NullUtil.isNull(auditedList)) { for (Pojo pojoAudited : auditedList) { Long id = null; if (NullUtil.isNull(pojoAudited.getLojaMaster().getId())) { id = (Long) this.getIdentifier(pojoAudited.getLojaMaster()); this.getLojaRegister(mapLoja, id); pojoAudited.setLojaMaster(mapLoja.get(id)); } if (NullUtil.isNull(pojoAudited.getSeguradora().getId())) { id = (Long) this.getIdentifier(pojoAudited.getSeguradora()); this.getSeguradoraRegister(mapSeguradora, id); pojoAudited.setSeguradora(mapSeguradora.get(id)); } i…
accepted answer of: http://stackoverflow.com/q/22896124
type: AcceptedAnswer

http://stackoverflow.com/comment/34903483
type: Comment
comment on: http://stackoverflow.com/a/22875042
has text: @ajb Very true, but given that the OP specifically said "non static", who am I to contradict?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34983763
type: Comment
has text: Regarding the source warning. If I understand it (http://goo.gl/mSB2Vt) correctly with Gradle you cannot compile against an older Java Version without having it installed on the system? In addition (http://goo.gl/VWeZJx or http://goo.gl/VZjS19) the path to the old JVM needs to be hard coded into the build.gradle? I'm spoilt by Eclipse. Here you only need one JVM and the runtime environments taking care that the generated class files are correct. Is this not possible using Gradle?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22917218

http://stackoverflow.com/comment/34824642
score: 1
has text: you cannot package resources to jar.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22831696

http://stackoverflow.com/comment/35038326
type: Comment
comment on: http://stackoverflow.com/a/22949622
type: AnswerComment
has text: @user3479194 No equals will return false if it compares an upper case string with a lower case string ex: AAA and aaa return false. However, equalsIgnoreCase will return true for comparing aaa and AAA
score: 0

http://stackoverflow.com/comment/34926000
type: QuestionComment
comment on: http://stackoverflow.com/q/22887706
has text: Firstly, remove the `regex` tag - details here: http://stackoverflow.com/a/1732454/665261
score: 0
type: Comment

http://stackoverflow.com/comment/35034173
has text: oh, also you can use GCM to notify they about new data exists))
type: AnswerComment
comment on: http://stackoverflow.com/a/22946310
score: 0
type: Comment

http://stackoverflow.com/comment/34799844
type: Comment
comment on: http://stackoverflow.com/a/22817567
type: AnswerComment
score: 0
has text: @MightyPork ah apologies, I understand where you are coming from now.

http://stackoverflow.com/q/22918392
has answer: http://stackoverflow.com/a/22918479
has comment: http://stackoverflow.com/comment/34981282
score: 0
answer count: 2
tagged with: constructor
has answer: http://stackoverflow.com/a/22918423
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34980989
tagged with: java
has title: Multiple constructors won't work
has body: OK, so I'm trying to learn how to use multiple constructors and can't quite understand why calling these different methods won't work - in fact the first method won't compile. Thanks for your interest... // Compile error here. I'm trying to call the 2nd Counter method with default values. public void Counter() { this.Counter(0, false); } // Here I'm trying to enable a call to the Counter method with integer and boolean attributes in its call. public Counter(int startingValue, boolean check) { this.startingValue = startingValue; this.check = check; }
type: Question

http://stackoverflow.com/q/22874807
has answer: http://stackoverflow.com/a/22875172
has comment: http://stackoverflow.com/comment/34903844
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34903189
favorite count: 0
has body: I'm using mysql and having select fields from a gui append to my query. However, I'm getting a mysql exception for this query: String query = "INSERT INTO racebikes " + "VALUES(?,?,?)"; For testing measures I printed out the query to make sure the fields were proper which when populated read as: INSERT INTO racebikes VALUES('BMC','Switzerland',10000.0). How is this throwing an syntax exception? Stack trace: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?,?,?)' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2828) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1842) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1764) at JDBC_GUI$7.actionPerformed(JDBC_GUI.java:375) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseRe…
tagged with: jdbc
has comment: http://stackoverflow.com/comment/34903560
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22875172
tagged with: mysql
has title: JDBC Mysql Syntax Error
type: Question

http://stackoverflow.com/q/22835956
answer count: 1
has comment: http://stackoverflow.com/comment/34832066
tagged with: android
has body: i am developing android application.In my application i need to send sms to recipant.If sms is send to recipient it will show toast message and display new activity.I did using SMSManager class but i do not want to use SMSManager in my application.I want to use intent for send sms which gives me default SMS view for sending message. I used intent which send sms successfully but unable call other activity.Please solve my this problem i did lot of R&amp;D but not successfull. i am attaching source code of send sms and called activity try { String smsSent = "SMS_SENT"; String smsDelivered = "SMS_DELIVERED"; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(smsSent), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(smsDelivered), 0); // Receiver for Sent SMS. registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), "SMS sent", Toast.LENGTH_SHORT).show(); Intent i=new Intent(this,Display.class).startActivity(i); break; case SmsManager.RESULT_ERROR_GENERIC_FAILURE: Toast.makeText(getBaseContext(), "Generic failure", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NO_SERVICE: Toast.makeText(getBaseContext(), "No service", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NULL_PDU: Toast.makeText(getBaseContext(), "Null PDU", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_RADIO_OFF: Toast.makeText(getBaseContext(), "Radio off", Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(smsSent)); // Receiver for Delivered SMS. registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), "SMS delivered", Toast.LENGTH_SHORT).show(); break; case Activity.RESULT_CANCELED: Toast.makeText(getBaseContext(), "SMS not delivered", To…
has answer: http://stackoverflow.com/a/22836093
accepted answer: http://stackoverflow.com/a/22836093
type: AnsweredQuestion
tagged with: smsmanager
tagged with: java
type: Question
has title: Display activity when sms is send in android
score: 0

http://stackoverflow.com/a/22954637
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22954567
has body: The real problem is that the program has not been written with testability in mind. Create an abstraction for the part that obtains the data, so that you can inject a mock implementation in the test.

http://stackoverflow.com/comment/34950051
has text: Can you show the code that creates the instance and adds edge? Also add some sysout for debugging purpose and paste the output here.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22900917
type: Comment

http://stackoverflow.com/comment/34862615
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22852095
has text: What i its used in the for loop so there is no problem

http://stackoverflow.com/q/22923296
has answer: http://stackoverflow.com/a/22950136
answer count: 1
tagged with: logging
type: UnansweredQuestion
has body: I have an application that is using the log4j file appender to create a log file. I need to import this log file into a log management system and its struggling with the RollingFileAppender setup which rolls the file over when it reaches 10mb What I need is a log file that behaves in the same way as a windows event log with a maximum size and old events being overwritten. Is this possible and if so, any suggestions on config? Thanks
has title: Log4j log file appending overwrite old events
downvote count: 0
score: 1
tagged with: log4j
favorite count: 0
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35038592
upvote count: 1

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/22877679
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/22822068
tags question: http://stackoverflow.com/q/22876855
tags question: http://stackoverflow.com/q/22824523
tags question: http://stackoverflow.com/q/22958391
tags question: http://stackoverflow.com/q/22951233
tags question: http://stackoverflow.com/q/22949618
tags question: http://stackoverflow.com/q/22811767
tags question: http://stackoverflow.com/q/22927124
tags question: http://stackoverflow.com/q/22947751
tags question: http://stackoverflow.com/q/22864095
tags question: http://stackoverflow.com/q/22888126
tags question: http://stackoverflow.com/q/22963339

http://stackoverflow.com/q/22849714
tagged with: java
has answer: http://stackoverflow.com/a/22851947
tagged with: webview
type: Question
possible better answer: http://stackoverflow.com/a/22849843
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34857486
has title: Simple webView keeps crashing app
tagged with: android
accepted answer: http://stackoverflow.com/a/22851947
has body: I'm lost but trying in the android world. App runs fine at first, both in emulator and on actual device. But as soon as I go to the activity with a webview, the app instantly crashes, both on device, and emulator. Can anyone spot the problem? (Is it even in my code?) AutosActivity.java: package com.cyclist.cyclist; 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.os.Build; import android.webkit.WebView; public class AutosActivity extends ActionBarActivity { WebView webView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_autos); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } webView = (WebView) findViewById(R.id.webView1); webView.loadUrl("http://www.example.com"); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.autos, 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_autos,…
has answer: http://stackoverflow.com/a/22849843
type: AnsweredQuestion

android-imageview
tags question: http://stackoverflow.com/q/22932761
type: Tag
tags question: http://stackoverflow.com/q/22901002
tags question: http://stackoverflow.com/q/22904416
tags question: http://stackoverflow.com/q/22951375
tags question: http://stackoverflow.com/q/22866903
tag name: android-imageview

http://stackoverflow.com/q/22901413
has title: Can someone help me work out the kinks in my program?
has body: I have to write a calculator program using the Gui components. I have written the program but I'm having issues with my CE button. It is giving me errors. I'm also getting and error in my for loop where I add the operand labels to the expression. I was just hoping to get some help in fixing these errors. Thank you! Please ignore the comments. They are there for my to keep track of what I have to do. import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Calculator { JFrame window; // stuff for top panel JPanel topPanel; JTextField expr,result; JButton equals; // stuff for bottom panel JPanel bottomPanel,digitsPanel,opsPanel; JButton[] digits,ops; JButton clear, clearEntry; Container content; Listener listener; String[] oplabels = { "+", "-", "/", "*" }; public Calculator() { listener = new Listener(); // our Listener class implements ActionListener window= new JFrame("GUI Calc"); content=window.getContentPane(); content.setLayout( new GridLayout(2,1) ); topPanel=new JPanel(); topPanel.setLayout( new GridLayout(1,3) ); // TOP PANEL WORK expr = new JTextField( ); equals = new JButton("="); equals.addActionListener( listener ); result = new JTextField( ); topPanel.add( expr ); topPanel.add( equals ); topPanel.add( result ); // BOTTOM PANEL WORK bottomPanel = new JPanel(); bottomPanel.setLayout( new GridLayout(1,2) ); digitsPanel = new JPanel(); digitsPanel.setLayout( new GridLayout(4,3) ); opsPanel = new JPanel(); opsPanel.setLayout( new GridLayout(4,1) ); digits = new JButton[12]; ops = new JButton[4]; for (int i=0 ; i&lt;10 ; i++) { digits[i] = new JButton( i+"" ); digits[i].addActionListener(listener); digitsPanel.add( digits[i] ); } clear = new JButton( "C" ); clearEntry = new JButton( "CE" ); clear.addActionListener(listener); clearEntry.addActionListener(listener); digitsPanel.add( clear ); digitsPanel.add( clearEntry); for (int i=0 ; i&lt;4 ; i++) { ops[i] = new JButton( oplabels[i] ) ; ops[i].addActionListener(listener); opsPanel.add( op…
type: Question
answer count: 2
score: -2
has answer: http://stackoverflow.com/a/22901538
has comment: http://stackoverflow.com/comment/34950905
downvote count: 2
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/22901638
favorite count: 0
possible better answer: http://stackoverflow.com/a/22901538
has answer: http://stackoverflow.com/a/22901638
has comment: http://stackoverflow.com/comment/34950961
has comment: http://stackoverflow.com/comment/34950853
type: AnsweredQuestion
upvote count: 0
tagged with: java

http://stackoverflow.com/comment/34831967
comment on: http://stackoverflow.com/q/22835509
score: 0
type: Comment
type: QuestionComment
has text: i posted my java code

http://stackoverflow.com/comment/34833660
score: 0
type: Comment
type: QuestionComment
has text: For debug purposes you might add a `Toast` or a `Dialog` to show you've reached the `onActivityResult()` callback.
comment on: http://stackoverflow.com/q/22836819

http://stackoverflow.com/comment/34949380
comment on: http://stackoverflow.com/q/22900376
type: Comment
type: QuestionComment
score: 1
has text: 1) I can't see that your layout corresponds to what you've shown on the picture. 2) Looks like you're trying to get button1 from adapter's getView() method, although button1 is out of the listview's item (unless you have the same names for two buttons).

http://stackoverflow.com/comment/35029811
score: 0
comment on: http://stackoverflow.com/q/22944512
type: Comment
type: QuestionComment
has text: there is an or in there, its for explanation that neither work, and thanks for pointing out the the error, i feel like killing myself now.

javafx-8
tags question: http://stackoverflow.com/q/22821129
tags question: http://stackoverflow.com/q/22926200
tag name: javafx-8
tags question: http://stackoverflow.com/q/22832599
tags question: http://stackoverflow.com/q/22940371
tags question: http://stackoverflow.com/q/22946789
tags question: http://stackoverflow.com/q/22872484
tags question: http://stackoverflow.com/q/22870229
tags question: http://stackoverflow.com/q/22958002
tags question: http://stackoverflow.com/q/22893824
tags question: http://stackoverflow.com/q/22902568
type: Tag
tags question: http://stackoverflow.com/q/22899956
tags question: http://stackoverflow.com/q/22889544
tags question: http://stackoverflow.com/q/22914895
tags question: http://stackoverflow.com/q/22881873

http://stackoverflow.com/a/22871163
downvote count: 0
type: Answer
score: 3
has body: You can use java.util.Date Date date = new Date(); date.setYear(year); // setting year date.setMonth(month); // setting month date.setDate(date); // setting day of month If you don't want to have any other fields: date.setHours(0); // setting hours to 0 date.setMinutes(0); // setting minutes to 0 date.setSeconds(0); // setting seconds to 0 This way your code can still have milliseconds, however you could easily get rid of it: long time = date.getTime(); // getting timestamp time = (time / 1000L) * 1000L; // getting rid of milliseconds by integer division // or alternatively time -= time % 1000L; // getting rid of milliseconds by substracting remainder date.setTime(time); // setting the timestamp without milliseconds You could use the second method to get rid of hours, minutes, seconds and milliseconds too, but it wouldn't be precise because of the leap seconds. Note: these methods (except getTime() and setTime()) are deprecated, but this may be the most straightforward way to do this in GWT.
upvote count: 3
answers question: http://stackoverflow.com/q/22870088

http://stackoverflow.com/comment/34817622
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22827732
type: Comment
has text: I just wanted to help the person. I do not give much importance to number system.

http://stackoverflow.com/q/22869350
accepted answer: http://stackoverflow.com/a/22869630
has body: Scenario: For a list that have 3 elements: [A, B, C] You can circular access it as many times as you want. And there is an additional counting function records access count of each element. For example, if accessing it 7 times, should return: [A, B, C, A, B, C, A] And have access count of each element as following: +–––––––––––+–––––––––––––––+ | Element | Access count | +–––––––––––––––––––––––––––+ | A | 3 | +–––––––––––––––––––––––––––+ | B | 2 | +–––––––––––––––––––––––––––+ | C | 2 | +–––––––––––+–––––––––––––––+ Add another additional function that allow caller to specify a elements list that should be filtered. Still use 7 times accessing as a example, filtering [C]: [A, B, A, B, A, B, A] +–––––––––––+–––––––––––––––+ | Element | Access count | +–––––––––––––––––––––––––––+ | A | 4 | +–––––––––––––––––––––––––––+ | B | 3 | +–––––––––––––––––––––––––––+ | C | 0 | +–––––––––––+–––––––––––––––+ And the subsequent calling on getNextOne() should always fetch the one that access count is low. Simulate a load-balanced accessing count implementation. So, if second caller attempt to accessing it 10 times, should return: [C, C, C, B, C, A, B, C, A, B, C, A] +–––––––––––+–––––––––––––––+ | Element | Access count | +–––––––––––––––––––––––––––+ | A | 7 | +–––––––––––––––––––––––––––+ | B | 6 | +–––––––––––––––––––––––––––+ | C | 6 | +–––––––––––+–––––––––––––––+
has answer: http://stackoverflow.com/a/22869630
type: AnsweredQuestion
tagged with: list
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/55609099
type: Question
score: 14
tagged with: round-robin
tagged with: circular-list
upvote count: 14
has answer: http://stackoverflow.com/a/67026560
answer count: 3
tagged with: load-balancing
possible better answer: http://stackoverflow.com/a/55609099
favorite count: 0
has title: How to implement a round-robin circular list and count access requests of an element?

http://stackoverflow.com/a/22845516
score: 0
answers question: http://stackoverflow.com/q/22845249
type: Answer
has body: This works @Test public void test(){ String password = "dfsdf"; String[] commonPass= new String[] {"bla", "blu", "blo", "bly", "ble", "bli"}; for(int i = 0; i &lt; commonPass.length; i++) { if (password.equalsIgnoreCase(commonPass[i])) { System.out.println("Enter new password."); } } }

http://stackoverflow.com/q/22845949
type: Question
has title: Map Reduce: How can I get blocks from two different data sets to make them pairs
score: 0
answer count: 1
has body: I want to create a Map function with the following operations: Step 1: I have 2 data sets R and S. I want to partition the two data sets into n equal-sized blocks which can be done by putting every (R/n and S/n )records into one block. After that: Step 2: Then every possible pair of blocks (one from R and one from S) is partitioned into a bucket at the end of Map phase so that can be taken from the Reduce Function as input with some id as key for each value pairs. e.g will be &lt;id:(Sij, Ril)&gt; So my questions are: How implement step 1? Is there any implemented function that I can use? 2.How can I refer specifically to these data sets in step 2 so that I can take one block from R and one from S? Note: In main I define the two data sets like this : `FileInputFormat.setInputPaths(conf, new Path(args[0]), new Path(args[1]));`
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22878241
tagged with: java
tagged with: mapreduce

http://stackoverflow.com/comment/34951490
comment on: http://stackoverflow.com/a/22901721
type: Comment
has text: This fixed everything, sometimes we miss the simplest of things. Thank you to everyone who helped :)
score: 1
type: AnswerComment

http://stackoverflow.com/q/22818989
type: Question
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/22818263
has comment: http://stackoverflow.com/comment/34802286
has body: I am trying to access innerclass Class1 defined in ClassA from ClassB ClassB.java public class ClassB implements Initializable { public ClassA[] QR; @Override public void initialize(URL url, ResourceBundle rb) { for(int i=0; i&lt;1; i++) { //QR[i] = new ClassA(i); QR[i].Class1 class1obj = QR[i].new Class1(); //prog_QR[i].progressProperty().bind(QR[i].progressProperty()); prog_QR[i].progressProperty().bind(class1obj.progressProperty()); //lab_QR[i].textProperty().bind(QR[i].messageProperty()); lab_QR[i].textProperty().bind(class1obj.messageProperty()); // My other stuff here } } } ClassA.java public class ClassA { public class Class1 extends Task&lt;Integer&gt; { // Constructor Created Class1() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override protected Integer call() throws Exception { // My logic here } } } At line QR[i].Class1 class1obj = QR[i].new Class1();,I am getting an error in Netbeans and it's either askign me to 1) Create class "Class1" in package mypackage 2) Create class "Class1" in mypackage What am I doing wrong here?
has answer: http://stackoverflow.com/a/22819047
has comment: http://stackoverflow.com/comment/34802174
tagged with: inner-classes
type: UnansweredQuestion
has title: Error: asking to create a new class while accessing innerclass
tagged with: java

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/22909112
tags question: http://stackoverflow.com/q/22870611
type: Tag
tags question: http://stackoverflow.com/q/22857744
tags question: http://stackoverflow.com/q/22961215

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/22842743
tags question: http://stackoverflow.com/q/22847972
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/22901220

http://stackoverflow.com/q/22953084
upvote count: 23
has answer: http://stackoverflow.com/a/22953119
type: AnsweredQuestion
has title: NullPointerException in eclipse in Eclipse itself at PartServiceImpl.internalFixContext
tagged with: java
score: 23
has comment: http://stackoverflow.com/comment/35043913
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/33580757
downvote count: 0
has answer: http://stackoverflow.com/a/76319850
accepted answer: http://stackoverflow.com/a/22953119
possible better answer: http://stackoverflow.com/a/24156079
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/24156079
has answer: http://stackoverflow.com/a/58714848
answer count: 7
has answer: http://stackoverflow.com/a/40825695
favorite count: 0
has body: I have a problem about eclipse IDE, I can't open any file in my work space; if I try to open file, eclipse will alert the following error dialog "An error has occurred. See error log for more details. java.lang.NullPointerException" I go to see .log file in .meta at workspace and I see a paragraph in the file like this: !ENTRY org.eclipse.jface 4 2 2557-04-09 11:40:49.422 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface". !STACK 0 java.lang.NullPointerException at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.internalFixContext(PartServiceImpl.java:380) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:341) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1029) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3047) at org.eclipse.ui.internal.WorkbenchPage.access$22(WorkbenchPage.java:2969) at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:2951) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2947) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2911) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2902) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:655) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:614) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:360) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:167) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:249) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.han…
has answer: http://stackoverflow.com/a/32088408

http://stackoverflow.com/a/22969865
type: Answer
answers question: http://stackoverflow.com/q/22959987
has comment: http://stackoverflow.com/comment/133486015
accepted answer of: http://stackoverflow.com/q/22959987
score: 15
has body: You can do it by utilizing #messages.listMsg and #strings.listJoin Having the model returned from your @Controller: model.addAttribute("messageKeyList", Lists.newArrayList("name", "address")); You can join list of translated messages like this: &lt;div th:text="${#strings.listJoin(#messages.listMsg(messageKeyList), ',')}"&gt;&lt;/div&gt; Which should produce what you expect, e.g.: Some name,Some address Where name and address are keys in your messages file.
upvote count: 15
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35039965
comment on: http://stackoverflow.com/q/22950442
has text: thanks alot man for this, currently i am using `update` query in `method c` so i am returning updated record count to `method b()` where i use `if(rowCount !=0){//execute code}`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22937899
has body: Added this answer to say that String.replace should be used instead of String.replaceAll, because replaceAll uses regex/Pattern class, which are not required in this case. String result = str.replace(" Sec","");
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35016234
answers question: http://stackoverflow.com/q/22937573

http://stackoverflow.com/a/22933956
has comment: http://stackoverflow.com/comment/35009627
has comment: http://stackoverflow.com/comment/35009339
answers question: http://stackoverflow.com/q/22933898
has comment: http://stackoverflow.com/comment/35009370
has body: You should absolutely let Java handle this on its own. All you're doing is making your code harder to read and maintain. All the variables you're nulling out are going out of scope at the end of the method anyway - and the GC knows that. Oh, and in general you shouldn't catch Exception... catch specific exceptions (if you can actually handle them).
has comment: http://stackoverflow.com/comment/35009674
downvote count: 0
has comment: http://stackoverflow.com/comment/35010485
score: 8
upvote count: 8
type: Answer

http://stackoverflow.com/q/22824608
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35206732
answer count: 0
score: 1
tagged with: maven
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/21830815
has body: When trying to run a LibGDX and RoboVM project on the iOS simulator, I get the following error: [ERROR] Exception in thread "main" java.lang.UnsatisfiedLinkError: [ERROR] [ERROR] [ERROR] at [ERROR] com.badlogic.gdx.backends.iosrobovm.IOSGLES20.init(Native Method) [ERROR] at com.badlogic.gdx.backends.iosrobovm.IOSGLES20.<init>(IOSGLES20.java) [ERROR] at [ERROR] com.badlogic.gdx.backends.iosrobovm.IOSApplication.didFinishLaunching(IOSApplication.java) [ERROR] at com.badlogic.gdx.backends.iosrobovm.IOSApplication$Delegate.didFinishLaunching(IOSApplication.java) [ERROR] at [ERROR] org.robovm.cocoatouch.uikit.UIApplicationDelegate$Callbacks.didFinishLaunching(UIApplicationDelegate.java) [ERROR] at org.robovm.cocoatouch.uikit.UIApplication.UIApplicationMain(Native Method) [ERROR] at org.robovm.cocoatouch.uikit.UIApplication.main(UIApplication.java) [ERROR] at package.ios.Main.main(Main.java) Although this question seems to address the same problem, it's answer only works on Eclipse, and I'm using the maven RoboVM plugin to build and run my project. I'm using this maven command to run the project: mvn clean integration-test -Pios and 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.9.1 ${mainClass} ios x86 iphone-sim integration-test iphone-sim I have no idea what might be causing this error, as I have little experience with RoboVM. Does anyone know how I might fix it?
tagged with: libgdx
tagged with: java
has title: RoboVM - Unsatisfied link error when trying to run on iOS simulator
tagged with: robovm
downvote count: 0
tagged with: ios

http://stackoverflow.com/q/22889828
tagged with: libgdx
has title: libgdx ScissorStack not working as expected
tagged with: clipping
upvote count: 3
has comment: http://stackoverflow.com/comment/34933125
answer count: 1
favorite count: 0
has body: I'm trying to create a "progress bar" of sorts but the clipping doesn't seem to work the way I expect it to. Is this something I am doing wrong or something I've misinterpreted? The draw() routine that should clip: @Override public void draw(SpriteBatch batch, float parentAlpha) { Rectangle scissors = new Rectangle(); Rectangle clipBounds = new Rectangle(getX(), getY(), getWidth() * 0.75f, getHeight()); ScissorStack.calculateScissors( getStage().getCamera(), getStage().getGutterWidth(), getStage().getGutterHeight(), getStage().getCamera().viewportWidth, getStage().getCamera().viewportHeight, batch.getTransformMatrix(), clipBounds, scissors); if (ScissorStack.pushScissors(scissors)) { super.draw(batch, parentAlpha); ScissorStack.popScissors(); } } } Complete sample code for ClipTest group class, TestScreen and screenshot. ClipTest is a subclass of group used to demonstrate the "bug". ClipImage is a subclass of Image, which performs the clipping on draw(). ClipTest has 2 images, background and foreground. The background is a black image and it should always be the full size of the progress bar. The foreground is a white image and it's width is clipped depending on the percentage of the bar. The strange result I've found is that although the foreground is using the clipping class, the background image is the one actually clipped. The expected result was created using photoshop (as I couldn't produce it via code). Any idea what's wrong?
has comment: http://stackoverflow.com/comment/34931129
has answer: http://stackoverflow.com/a/22890088
accepted answer: http://stackoverflow.com/a/22890088
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
score: 3
has comment: http://stackoverflow.com/comment/36938045

http://stackoverflow.com/comment/35023604
comment on: http://stackoverflow.com/a/22941263
type: AnswerComment
score: 0
type: Comment
has text: Yes, open a new question and add more code. Because with the current code we can't help you

http://stackoverflow.com/a/23360078
answers question: http://stackoverflow.com/q/22907690
has body: After many days of researching and testing (almost a month) I arrived to conclusion that the best approach for this problem is not use a secure connection for the form but for the entire application (in my case need to be the entire because the login form is present in all app as a popup element). For others, the reason to change was to give the customer the assurance that the data is secure and the website is trusted (the symbol in the address link)... Also, I read somewhere is good for SEO!! I hope with this answer I could clarify someone with the same issue as mine!!
type: Answer
score: 0

http://stackoverflow.com/q/22855494
has comment: http://stackoverflow.com/comment/34867700
favorite count: 0
has answer: http://stackoverflow.com/a/22936484
type: Question
tagged with: android
tagged with: flashlight
tagged with: nexus-5
has comment: http://stackoverflow.com/comment/34868829
linked to: http://stackoverflow.com/q/21284473
upvote count: 2
linked to: http://stackoverflow.com/q/6068803
has body: I'm trying to develop an application for to turn on the flashlight on click in a toggle. I tried every method I found in the web but without success in my nexus 5. The only application that works is the cyanogenmod torch but even if I take that code and I write it in my application, it creates a notification that if clicked it opens the cyanogenmod torch app and not mine! This is a problem!! Is it possible have a easy code that works also for nexus 5? public void turnOffFlashLight() { try { if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) { cam.stopPreview(); cam.release(); cam = null; } } catch (Exception e) { e.printStackTrace(); Toast.makeText(getBaseContext(), "Exception throws in turning off flashlight.", Toast.LENGTH_SHORT).show(); } } public void turnOnFlashLight() { try { if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) { cam = Camera.open(); cam.setPreviewTexture(new SurfaceTexture(0)); Parameters p = cam.getParameters(); p.setFlashMode(Parameters.FLASH_MODE_TORCH); cam.setParameters(p); cam.startPreview(); } } catch (Exception e) { e.printStackTrace(); Toast.makeText(getBaseContext(), "Exception throws in turning on flashlight.", Toast.LENGTH_SHORT).show(); } } EDIT: logcat 04-09 21:52:21.967: E/AndroidRuntime(5346): FATAL EXCEPTION: main 04-09 21:52:21.967: E/AndroidRuntime(5346): Process: com.lob.twixlight, PID: 5346 04-09 21:52:21.967: E/AndroidRuntime(5346): android.util.SuperNotCalledException: Activity {com.lob.twixlight/com.lob.twixlight.MainActivityTwixLight} did not call through to super.onStart() 04-09 21:52:21.967: E/AndroidRuntime(5346): at android.app.Activity.performStart(Activity.java:5243) 04-09 21:52:21.967: E/AndroidRuntime(5346): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2178) 04-09 21:52:21.967: E/AndroidRuntime(5346): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265) 04-09 21:52:21.967: E/AndroidRuntime(5346): at android…
has comment: http://stackoverflow.com/comment/34872472
accepted answer: http://stackoverflow.com/a/22936484
answer count: 1
has comment: http://stackoverflow.com/comment/34868847
tagged with: java
has title: Android flashlight on nexus 5
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/35048404
score: 0
type: Comment
type: QuestionComment
has text: show us how are you trying to get the cookie? and when you are trying to get what error or issue you got?
comment on: http://stackoverflow.com/q/22955752

http://stackoverflow.com/comment/34837934
type: AnswerComment
has text: of course this is the crux of the question. He asked the reason for contains() receive and object and not a generic type ("then why shouldn't it take Element type E as an argument instead of Object?"), and this was what I answered.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22837145

http://stackoverflow.com/a/22919046
score: 1
has comment: http://stackoverflow.com/comment/34982257
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22918872
answers question: http://stackoverflow.com/q/22918872
upvote count: 1
has body: The error is coming from this line: listDataHeader.add(chan.getJSONObject(i).getString("Channel")); My bet is that listDataHeader is null when no connectivity is detected, and this is because you're just initializing this object in this block: if (isInternetPresent) { ... } Simply initialize it outside (above) this block to let it be reachable even when there's no connectivity.

http://stackoverflow.com/a/22826281
type: Answer
answers question: http://stackoverflow.com/q/22825524
has body: Use the @Override annotation like so: class Example extends Origin { @Override public a_method() { //Everything in the original method but very small changes } } I would recommend keeping the same method parameters and return values, lest things start to break.
score: 0

http://stackoverflow.com/comment/35915074
type: QuestionComment
has text: Wait, add additional comments, browse the internet, try to solve it yourself. The **last** thing you should do is open duplicate issues. That's a good way to really upset the admins =)
score: 1
comment on: http://stackoverflow.com/q/22891360
type: Comment

http://stackoverflow.com/a/22939929
downvote count: 0
has body: Tag tag3 = new Tag(); tag3.setId(16); tag1.setTag("OHNO CANNOE");//here is the issue use tag3.setTag("OHNO CANNOE"); you are setting tag1 object's property again to "OHNO CANNOE" which will over write the previously written value "test"
type: Answer
answers question: http://stackoverflow.com/q/22939813
upvote count: 5
score: 5

http://stackoverflow.com/comment/35041708
comment on: http://stackoverflow.com/q/22951727
score: 0
type: Comment
type: QuestionComment
has text: @DavidWallace I assume they would create instances, but I'm only 90% sure. And I think it's more complicated that it looks. I was just expecting a Yes/No answer but I guess this is how it ends up.

ebean
tags question: http://stackoverflow.com/q/22823061
tags question: http://stackoverflow.com/q/22885181
tags question: http://stackoverflow.com/q/22879684
tags question: http://stackoverflow.com/q/22957396
tags question: http://stackoverflow.com/q/22919349
type: Tag
tags question: http://stackoverflow.com/q/22877256
tag name: ebean

http://stackoverflow.com/comment/34994591
comment on: http://stackoverflow.com/a/22925236
type: Comment
score: 0
has text: this won't work for the same reason ajb explains in his/her reply
type: AnswerComment

http://stackoverflow.com/comment/35068418
has text: While I believe this approach will _work_ (as in, it will produce the desired result), reflection is a needlessly complicated solution to this problem, IMO.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22953296

http://stackoverflow.com/q/22874206
has body: I'm working on a video poker assignment in java. We are given class templates that we are supposed to use in our program. I'm confused as to what Card c represents. Like in the method addCard(Card c), does that just mean it will be executed on the Card object that's currently in use? Here are the class files I've been working on so far. They are far from finished. Player Class: import java.util.ArrayList; public class Player { private ArrayList&lt;Card&gt; hand; // the player's cards // you will likely need more instance variables public Player(){ ArrayList&lt;Card&gt; hand = new ArrayList; } public void addCard(Card c){ // add the card c to the player's hand } public void removeCard(Card c){ // remove the card c from the player's hand } // you will likely need more methods here } Deck class: import java.util.Random public class Deck { private Card[] theDeck; private int top; // add more instance variables if needed public Deck(){ top = 0 Card[] theDeck = new Card[52]; for(int s = 1; s &lt;= 4; s++) { for (int v = 1; v &lt;= 13; v++) { for (int i = 0; i &lt; theDeck.length; i++) theDeck[i] = new Card(s,v); } public void shuffle() { // shuffle the deck here Random generator = new Random(); int i; int j; int temp = i; int i = generator.nextInt(51) + 1; int j = generator.nextInt(51) + 1; for(int k = 1; k &lt;100; k++) { theDeck[i] = theDeck[j]; theDeck[j] = temp; } top = 0; } public Card deal(){ // deal the top card in the deck if (top &lt; 40) { theDeck.shuffle; } return theDeck[top]; top++; } //this method should add cards to array hand? no addCard will do that. // add more methods here if needed //DB getter methods here? } Card Class: public class Card implements Comparable&lt;Card&gt;{ private int suit; private int value; public Card(int s, int v){ //constructor of an object Card s = suit; v = value; //make a card with suit s and value v } public int compareTo(Card c){ // use this method to compare cards so they // may be easily sorted } public String toString() //…
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/34901913
downvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/22874715
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has title: Card c in video poker

http://stackoverflow.com/a/22915480
has comment: http://stackoverflow.com/comment/35002648
has body: What you actually want to do is: Map&lt;String, Patient&gt; patients = new HashMap&lt;&gt;(); patients.put("entry1", /* [insert Patient object here] */); Things to note: The class to represent a patient should be named Patient, not Paitents. A class should be named for its instances, not their collection. It is meaningless to set the value in a map to null, unless you are using a special type of map that allows a null key (and makes it meaningfully different from not having an entry for that key).
answers question: http://stackoverflow.com/q/22915233
has comment: http://stackoverflow.com/comment/34975845
downvote count: 0
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34975939

http://stackoverflow.com/comment/35011417
has text: @mat_boy yeah, that's better, I was to focused on the characters that need escaping, though I'd still drop `<` and `>`
type: Comment
comment on: http://stackoverflow.com/a/22934674
score: 0
type: AnswerComment

http://stackoverflow.com/q/22823304
type: UnansweredQuestion
has body: I just tried to execute a java command using runtime like this: Runtime.getRuntime().exec("shutdown -s"); to shutdown the computer, but I am training on a project that will get both my electronics and computer skills so I want to execute an avrdude command to program the mcu from Java and make a GUI program. So I want the cmd window to be visible when I run the command. I just made it visible by: Runtime.getRuntime().exec("cmd.exe /c start"); but I cant write on the window I just created, any help pls???? thanks all
tagged with: java
type: Question
answer count: 2
has title: Java visible command line
score: 0
has comment: http://stackoverflow.com/comment/34810032
has answer: http://stackoverflow.com/a/22823463
linked to: http://stackoverflow.com/q/10407308
has answer: http://stackoverflow.com/a/22840923

http://stackoverflow.com/comment/34805389
has text: I already tried that as i mentioned above..but not working for me. i am debugging on Motorola razor.
comment on: http://stackoverflow.com/a/22820633
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/61942130
comment on: http://stackoverflow.com/a/22866694
type: AnswerComment
has text: Hey dwagelaar Do you mind having a look into http://stackoverflow.com/questions/37196593/atl-transformation-rules-not-matching-nested-bpmn2-elements
score: 0
type: Comment

jsr356
tag name: jsr356
tags question: http://stackoverflow.com/q/22880055
type: Tag

http://stackoverflow.com/comment/34979075
has text: @prash That's a third aspect, yes.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22917135

http://stackoverflow.com/comment/34979088
has text: this.mPhysicsHandler.setVelocityY(-1000); Why it is set to -1000?
comment on: http://stackoverflow.com/q/22916861
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34942975
score: 0
type: AnswerComment
type: Comment
has text: I do not follow. The question got closed for the reasons I mentioned, and you were defending it was on topic. It was not in agreement with others. As for the reopen, there are many robo reviewers, it is a real problem on Stack Overflow.
comment on: http://stackoverflow.com/a/22891412

http://stackoverflow.com/comment/35013867
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22935912
has text: could you please paste the pom.xml

http://stackoverflow.com/q/22935917
tagged with: selinux
tagged with: java
has body: I need to write a program in order to analyze SELinux policy. Indeed, existing programs such Apol or Sediffx (from SETools) don't match my needs. In order to import/use SELinux policy, I intended to use SETools' library (libqpol, libapol, libpoldiff, libsefs). I do have the corresponding .jar but I can't find out how to use them. There is no documentation... And I can't find tutorials or some codes about them... That's why, I call directly SETools' command-line tools (sesearch, seinfo) from my java program, and then parse the response. In this way I can reconstitute the SELinux policy. But this seems a bit rough... Do you think there another way to do it? Do you know how to use SETools' library?
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 2
favorite count: 0
type: Question
upvote count: 2
has title: SELinux - Use of SETools' library in a third party program

http://stackoverflow.com/q/22907470
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34961788
tagged with: java
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/34961360
type: Question
has title: Java static self-references
has comment: http://stackoverflow.com/comment/34961361
has answer: http://stackoverflow.com/a/22907583
downvote count: 0
favorite count: 0
has body: A non-static setter method can look like this: private int var; public void setVar(int var) { this.var = var; } And I can't find out how to solve that with a static method: private static int var; public static void setVar(int var) { // ??? } One solution is to write myClass.var = var;. But that's ugly, because when I rename my class, I have to find and replace all occurrences. Another solution is to rename the parameter to v and write var = v;. For me this is ugly, too. Is there really no way to solve this like in php self::var = var;?
tagged with: static
possible better answer: http://stackoverflow.com/a/22907629
has answer: http://stackoverflow.com/a/22907521
has answer: http://stackoverflow.com/a/22907629
has answer: http://stackoverflow.com/a/22907526
answer count: 4
accepted answer: http://stackoverflow.com/a/22907583
tagged with: reference

save
tags question: http://stackoverflow.com/q/22879469
tags question: http://stackoverflow.com/q/22867391
tags question: http://stackoverflow.com/q/22883297
tags question: http://stackoverflow.com/q/22873597
type: Tag
tag name: save

http://stackoverflow.com/q/22899450
has comment: http://stackoverflow.com/comment/34947118
possible better answer: http://stackoverflow.com/a/22899467
has answer: http://stackoverflow.com/a/22899506
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34947111
accepted answer: http://stackoverflow.com/a/22899506
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34947143
has body: I have seen this form used in some snippets and I was wondering if this is a correct implementation of a while loop in Java: while ((bytesRead = bin.read(contentBytes)) != -1) { response = new String(contentBytes, 0, bytesRead); responseBuffer.append(response); }
has comment: http://stackoverflow.com/comment/34947089
has comment: http://stackoverflow.com/comment/34947104
score: 0
answer count: 2
has title: Is this type of while loop acceptable in Java?
has answer: http://stackoverflow.com/a/22899467

http://stackoverflow.com/a/29569679
answers question: http://stackoverflow.com/q/22821695
upvote count: 36
downvote count: 4
has body: Adding following property to your persistence.xml may solve your problem temporarily &lt;property name="hibernate.enable_lazy_load_no_trans" value="true" /&gt; As @vlad-mihalcea said it's an antipattern and does not solve lazy initialization issue completely, initialize your associations before closing transaction and use DTOs instead.
score: 32
type: Answer
has comment: http://stackoverflow.com/comment/126473504

http://stackoverflow.com/q/22886942
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/34924847
has answer: http://stackoverflow.com/a/22886966
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has title: Adding a string in an int array
tagged with: arrays
has answer: http://stackoverflow.com/a/22887412
score: -1
has body: I have an array with integer numbers and I would like to know the way to put a string "x" in some cells. I am trying this,but i know that its impossible in this way: array[i][j]="x";
has comment: http://stackoverflow.com/comment/34924679
has answer: http://stackoverflow.com/a/22886969
has comment: http://stackoverflow.com/comment/34924938
has answer: http://stackoverflow.com/a/22886992
has comment: http://stackoverflow.com/comment/34924844
favorite count: 0
has comment: http://stackoverflow.com/comment/34924969

http://stackoverflow.com/q/22822830
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/20746429
has comment: http://stackoverflow.com/comment/34812448
has answer: http://stackoverflow.com/a/22824865
has answer: http://stackoverflow.com/a/22836045
accepted answer: http://stackoverflow.com/a/22836045
has title: Using streams to compute infinite sum
type: AnsweredQuestion
tagged with: java-stream
has body: I'm trying to learn the details of using the Stream API, and one of the assignments I gave myself was to try to write a method that takes an infinite DoubleStream and tries to compute the sum (assuming it converges). That is, I'd like to write a method public static double infiniteSum(DoubleStream ds) { ... } that I could call with something like double sum = infiniteSum(IntStream.iterate(1, (i -&gt; i + 1)) .mapToDouble(n -&gt; 1 / ((double)n * n))); to get the sum (1 + 1/22 + 1/32 + ... ) = ζ(2) = π2/6. My crude method for doing this the old way: public static void yeOldeWaye() { double sum = 0; for (double n = 1; ; n++) { double term = 1 / (n * n); if (Math.abs(term) &lt;= 1e-12 * Math.abs(sum)) { break; } sum += term; } System.out.println(sum); } which gives me a result accurate to 5 places. I can implement the method in a hacked way using iterator(): public static double infiniteSum1(DoubleStream ds) { double sum = 0; PrimitiveIterator.OfDouble it = ds.iterator(); while (true) { double term = it.next(); if (Math.abs(term) &lt;= 1e-12 * Math.abs(sum)) { break; } sum += term; } return sum; } but that just feels like reverting to the old way, and I was looking for a method that used streams more the way they were intended to be used, or something. This produces the correct result: private static class DoubleAccumulator { public double sum; public DoubleAccumulator() { sum = 0; } } public static double infiniteSum(DoubleStream ds) { DoubleAccumulator summer = ds.limit(800000).collect (DoubleAccumulator::new, (s, d) -&gt; s.sum += d, (s1, s2) -&gt; s1.sum += s2.sum); return summer.sum; } but I happened to know that the old method used almost 800000 terms, and putting a limit on the stream defeats my purpose. The problem is that I don't see a way to cut off a stream other than by using limit(), which means that I have to know beforehand how many terms I'm going to have; I don't see a way to stop the stream based on some condition that's computed based on what I'm see…
tagged with: java-8
has comment: http://stackoverflow.com/comment/34809111
type: Question
has answer: http://stackoverflow.com/a/51008531
has comment: http://stackoverflow.com/comment/34812257
has comment: http://stackoverflow.com/comment/34811854
possible better answer: http://stackoverflow.com/a/22824865
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/34809246
score: 5
answer count: 3

http://stackoverflow.com/q/22897295
has answer: http://stackoverflow.com/a/22897543
possible better answer: http://stackoverflow.com/a/22897502
has answer: http://stackoverflow.com/a/22897502
accepted answer: http://stackoverflow.com/a/22897415
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34943935
tagged with: mysql
has answer: http://stackoverflow.com/a/22897359
has title: understanding Java JDBC error
has body: I was hoping to have some assistance in understanding this error. I am making a simple connection to a database, and for some reason it doesn't like my input, but I am failing to understand where the error is actually occurring. Any assistance would be appreciated- thanks. My code: package db; import java.sql.*; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Scanner; public class BankAccount { private static String JDBC_DRIVER = "com.mysql.jdbc.Driver"; private static String DB_URL = "jdbc:mysql://localhost:3306/cs565"; private static String DB_USERNAME = "cs"; private static String DB_PASSWORD = "java"; // public String name; // public String action; // public double amount; // create the table public static void createTable(){ try { Class.forName(JDBC_DRIVER); Connection conn = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD); Statement stmt = conn.createStatement(); String sqlDropStatement = "DROP TABLE MYTABLE_TRANSACTIONS"; try { stmt.executeUpdate(sqlDropStatement); } catch (Exception e) { System.out.println("No old data found"); } String sqlCreateStatement = "CREATE TABLE MYTABLE_TRANSACTIONS" + "(TRANSACTION_ID integer auto_increment primary key," + "ACCOUNT_ID varchar(32)," + "TRANSACTION_TYPE varchar(32)," + "AMOUNT double)"; stmt.executeUpdate(sqlCreateStatement); String sql = "insert into MYTABLE_TRANSACTIONS (ACCOUNT_ID,TRANSACTION_TYPE,AMOUNT) values ('John Adams', 'initial', 100.00)"; stmt.executeUpdate(sql); sql = "insert into MYTABLE_TRANSACTIONS (ACCOUNT_ID,TRANSACTION_TYPE,AMOUNT) values ('Benjamin Franklin', 'initial', 200.00)"; stmt.executeUpdate(sql); sql = "insert into MYTABLE_TRANSACTIONS (ACCOUNT_ID,TRANSACTION_TYPE,AMOUNT) values ('George Washington', 'initial', 300.00)"; stmt.executeUpdate(sql); sql = "insert into MYTABLE_TRANSACTIONS (ACCOUNT_ID,TRANSACTION_TYPE,AMOUNT) values ('Thomas Jefferson', 'initial', 400.00)"; stmt.executeUpdate(sql); sql = "Select * from MYTABLE_TRANSAC…
has answer: http://stackoverflow.com/a/22897415
score: 0
tagged with: jdbc
answer count: 4
linked to: http://stackoverflow.com/q/2099425

http://stackoverflow.com/comment/34837621
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22838874
has text: @core As an aside, consider fixing your logging. It'll pretty much tell you exactly what went wrong. Right now your slf4j configuration seems wrong.

http://stackoverflow.com/q/22843984
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34846700
type: Question
has answer: http://stackoverflow.com/a/22872675
has comment: http://stackoverflow.com/comment/34846430
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/34902586
has title: equivalent implementation to com.google.common.util.concurrent
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22844442
has answer: http://stackoverflow.com/a/22844442
favorite count: 0
accepted answer: http://stackoverflow.com/a/22872675
has body: Is there any concurrency implementation lib like guava? For some reason I'm not able to use it. Basically I'm trying to use ListenableFuture
has comment: http://stackoverflow.com/comment/34846958
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34846954
has comment: http://stackoverflow.com/comment/34846773
tagged with: multithreading

http://stackoverflow.com/comment/37710871
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22829433
type: Comment
has text: Do you want to generate a MP3 file? Or play the sound in the browser? Because right now, you will generate some voice on your server (somewhere in your basement), not on the client. Do you know that?

http://stackoverflow.com/comment/34872313
score: 0
comment on: http://stackoverflow.com/a/22858210
type: Comment
has text: No They didn't [javadocs](https://jersey.java.net/apidocs/2.7/jersey/org/glassfish/jersey/grizzly2/httpserver/GrizzlyHttpServerFactory.html#createHttpServer(java.net.URI)), look at the code yourself.
type: AnswerComment

http://stackoverflow.com/q/22931808
type: AnsweredQuestion
score: 3
tagged with: list
has answer: http://stackoverflow.com/a/22932166
upvote count: 3
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/22932089
answer count: 3
has body: As I understood java.util.List does not have size restrictions. As I understand, the size() method: Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE. Therefore I have following question: If my List has a size that is larger than the Integer.MAX_VALUE, is there a way to determine the exact size?
has title: How can I find out the size of a java.util.List if the actual size is greater than the Integer.MAX_VALUE?
has answer: http://stackoverflow.com/a/22932150
accepted answer: http://stackoverflow.com/a/22932150
favorite count: 0
tagged with: size
possible better answer: http://stackoverflow.com/a/22932089

http://stackoverflow.com/q/22832248
answer count: 2
has comment: http://stackoverflow.com/comment/34825689
accepted answer: http://stackoverflow.com/a/22832580
tagged with: datetime
has body: I am receiving a java.sql.Timestamp in UTC for example: 2014-04-03 08:25:20.0 I know, that this timestamp is in UTC. And I know that the target timezone for this timestamp. Example: Europe/Berlin Now I 'd like to convert the UTC timestmap to a localized timestamp. With the correct daylight savings, of course. My attempt so far: println(msg.timestamp) println(new DateTime(msg.timestamp)) val storeTz = DateTimeZone.forID(store.timezone) println(new DateTime(msg.timestamp, storeTz)) val localTimestamp = new DateTime(msg.timestamp).withZone(storeTz) println(localTimestamp) This prints: 2014-04-03 08:25:20.0 2014-04-03T08:25:20.000+02:00 2014-04-03T07:25:20.000+01:00 2014-04-03T07:25:20.000+01:00 Shouldn't the correct localized timestamp be: 2014-04-03T10:25:20.000+02:00
has title: Convert a UTC timestamp to an arbitrary timezone
has answer: http://stackoverflow.com/a/22954288
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22954288
has answer: http://stackoverflow.com/a/22832580
tagged with: java
type: Question
tagged with: jodatime
score: 0

http://stackoverflow.com/comment/34963499
score: 0
comment on: http://stackoverflow.com/q/22902164
type: Comment
type: QuestionComment
has text: Yes I have.It is the main activity of my project.In my Imagetargets code I use setContentView(R.layout.activity_display_contact); to access the ListView of my SQLite.My SQLite is implemented in three classes, named DBHelper.java, MainActivity.java(this is the main activity of the sample SQLite project that I inserted to my own project) and DisplayContact.java.

http://stackoverflow.com/a/22869523
answers question: http://stackoverflow.com/q/22852407
accepted answer of: http://stackoverflow.com/q/22852407
score: 0
type: AcceptedAnswer
has body: So my problem was a couple of things. First, I want to thank those that commented. In my question, I did neglect to put in the out.close(); method. When that didn't work, I was looking at the string which held the URL I wanted to use. That had errors in it. This fixed the download problem, but I wanted to download from a place where the .html file was not in the URL (example: http://www.example.com/ instead of http://www.example.com/index.html). It worked for the latter but not the former. So instead of using URLConnection I used HttpURLConnection. Here is my working code: class Downloader extends AsyncTask&lt;URL, Void, Void&gt; { String site = getResources().getString(R.string.sched_hd_url); File sdCard = Environment.getExternalStorageDirectory(); File dir = new File(sdCard.getAbsolutePath() + "/directory/"); File file = new File(dir, "file.html"); @Override protected Void doInBackground(URL... uri) { FileOutputStream out = null; if (file.exists()) { try { file.delete(); file.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { URL url = new URL(site); HttpURLConnection yc = (HttpURLConnection) url.openConnection(); BufferedInputStream in = new BufferedInputStream( new URL(site).openStream()); out = new FileOutputStream(file); int total = 0; int count; byte data1[] = new byte[1024]; while ((count = in.read(data1)) != -1) { out.write(data1); total += count; } in.close(); out.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } protected void onPostExecute(Void result) { progress.setVisibility(View.INVISIBLE); finish(); } } Also another error in my question was in regards to no implementation checking to see if the file had already existed. Thanks again for the help.
type: Answer

http://stackoverflow.com/q/22819876
tagged with: java
has comment: http://stackoverflow.com/comment/34804122
type: Question
answer count: 2
has body: I want to send some data to a server over HTTP PUT (calling a REST web service). Below is the code.. URL urlObj = new URL("http://99.66.66.238:8443/media/service"); HttpURLConnection conn = (HttpURLConnection) urlObj .openConnection(); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestMethod("PUT"); conn.setRequestProperty("accept-charset", "UTF-8"); conn.setRequestProperty("content-type", "application/x-www-form-urlencoded"); String userPassword = username + ":" + password; byte[] authEncBytes = Base64.encodeBase64(userPassword.getBytes()); String authStringEnc = new String(authEncBytes); conn.setRequestProperty("Authorization", "Basic " + authStringEnc); OutputStreamWriter writer = new OutputStreamWriter( conn.getOutputStream(), "UTF-8"); writer.write(requestXML); conn.getOutputStream().flush(); But on the other side, they do not get the data. They only see.. PUT /media/service HTTP/1.1 accept-charset: UTF-8 content-type: application/x-www-form-urlencoded Authorization: Basic cm10dGVzdDpwYXNzd29yZA=3D=3D Cache-Control: no-cache Pragma: no-cache User-Agent: Java/1.6.0_13 Accept: text/html, image/gif, image/jpeg, *; q=3D.2, */*; q=3D.2 Connection: keep-alive Content-Length: 0 Notice how the Content-Length is 0. Can you please tell me why the data is not going through? Is there anyway I can see exactly what I am sending? Thanks.
tagged with: url
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22825789
tagged with: rest
possible better answer: http://stackoverflow.com/a/22820472
has answer: http://stackoverflow.com/a/22820472
score: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/22825789
tagged with: web-services
tagged with: http
type: AnsweredQuestion
has title: Java HTTP PUT not sending the data

http://stackoverflow.com/q/22935172
has comment: http://stackoverflow.com/comment/35011638
has answer: http://stackoverflow.com/a/22935730
accepted answer: http://stackoverflow.com/a/22935778
has title: BufferedReader.read returns -1 before reading the whole message
tagged with: boost-asio
score: 0
possible better answer: http://stackoverflow.com/a/22935730
tagged with: sockets
has answer: http://stackoverflow.com/a/22935778
has comment: http://stackoverflow.com/comment/35011541
type: AnsweredQuestion
tagged with: java
has body: My C++ server sends my Java client a message using the following code: tcp::socket* server_socket; vector&lt;uchar&gt; buff; //its size is 45682 ... //Sending vector's size stringstream ss; ss &lt;&lt; buff.size(); string str_size = zeroWraper(ss.str(), 10); //Adding leading zeros to the size boost::asio::write(*server_socket, boost::asio::buffer(str_size), ignored_error); //Sending the vector size_t check_size = boost::asio::write(*server_socket, boost::asio::buffer(buff, buff.size()), ignored_error); check_size value is 45682. My Java client Receives the message using the following code: Socket tcpSocket = new Socket("localhost", 5000); BufferedReader inFromServer = new BufferedReader( new InputStreamReader(tcpSocket.getInputStream())); ... String temp = ""; boolean error = false; for(int i=0; i&lt;10 &amp;&amp; !error; i++) { temp += (char)inFromServer.read(); if(temp.equals("e")) //When there is an error on the server side, it sends 'e' error = true; } //No error here and temp is 0000045682 as expected. int mat_size = Integer.parseInt(temp); byte mat_arr[] = new byte[mat_size]; while(!inFromServer.ready()){ //Go to sleep } for(int i=0; i &lt; mat_size &amp;&amp; !error; i++) { mat_arr[i] = (byte)inFromServer.read(); if((int)mat_arr[i] == -1) error = true; } I executed this code couple of times, and every time read returns -1 when i is equal to 21212. What am I doing wrong? Any help would be highly appreciated. Edit: when ignoring the end of stream, read() reads 44278 bytes for(int i=0; i &lt; mat_size &amp;&amp; !error; i++) mat_arr[i] = (byte)inFromServer.read();
type: Question
answer count: 2

http://stackoverflow.com/q/22874937
linked to: http://stackoverflow.com/q/214741
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22874983
type: Question
has answer: http://stackoverflow.com/a/22874976
has body: I am producing a library for personal use; in this particular class, extending JPanel, and my code still for some random reason, produces a StackOverflowError any tips? public class XJPanel extends JPanel { static boolean isManaged = false; public XJPanel() { } public XJPanel(LayoutManager arg0) { super(arg0); isManaged = true; } public XJPanel(boolean arg0) { super(arg0); // TODO Auto-generated constructor stub } public XJPanel(LayoutManager arg0, boolean arg1) { super(arg0, arg1); isManaged = true; } public GridBagConstraints getConstraints() { if(isManaged = true) { return new GridBagConstraints(); } throw new NullPointerException("No Layout Manager Found"); } /* public XJPanel add(Component arg0) { JPanel p = getRoot(); p.add(arg0); return null; } private JPanel getRoot() { return this; }*/ the error it reads is exactly as follows. I think I understand what a StackOverflowError is, but I'd like to know why the error message includes the package declaration -- it contains no code, so... why? Exception in thread "main" java.lang.StackOverflowError at javar.swing.XJPanel.getRoot(XJPanel.java:61) at javar.swing.XJPanel.add(XJPanel.java:55) at javar.swing.XJPanel.add(XJPanel.java:1) ... at javar.swing.XJPanel.add(XJPanel.java:56) at javar.swing.XJPanel.add(XJPanel.java:1) at javar.swing.XJPanel.add(XJPanel.java:56) the javar.swing.XJPanel.add(XJPanel.java:1) being my package declaration. Note: I'm sorry for being such a jerk, @SimonC I guess I had a case of the grumps, I'm well rested now and ready to shape up.
has comment: http://stackoverflow.com/comment/34903809
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/34904300
has answer: http://stackoverflow.com/a/22875250
has title: Class add method throwing StackOverflowError on package declaration
answer count: 3
has comment: http://stackoverflow.com/comment/34903881
has comment: http://stackoverflow.com/comment/34903702
tagged with: stack-overflow
favorite count: 0
has comment: http://stackoverflow.com/comment/34903871
has comment: http://stackoverflow.com/comment/34903783
has comment: http://stackoverflow.com/comment/34903868
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34903339
has comment: http://stackoverflow.com/comment/34903406

http://stackoverflow.com/q/22949718
score: 1
tagged with: final
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/22949775
has comment: http://stackoverflow.com/comment/35037958
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35038015
has answer: http://stackoverflow.com/a/22949761
accepted answer: http://stackoverflow.com/a/22949775
has comment: http://stackoverflow.com/comment/35038055
possible better answer: http://stackoverflow.com/a/22949761
has body: I have a very simple question and just asking to know more about final method arguments. final variables can be initialized just once in its life. In JAVA method arguments are accepted as pass by value and reference is also passed as a value. Now my question is : How method doesn't know that passed object is final and already initialized? Here is sample code: public static void xyz(Abc obj) { System.out.println("hash code in xyz method :"+obj.hashCode()); obj = new Abc(); // here there is no issue to initialize it again } public static void abc() { final Abc obj = new Abc(); //obj=new Abc(); // final variable can be initialized just once System.out.println("hash code in abc method :"+obj.hashCode()); xyz(obj); } public static void main(String[] a) { abc(); }
favorite count: 0
has title: How final variable works if passed in a method?
upvote count: 2
has answer: http://stackoverflow.com/a/22949881
has comment: http://stackoverflow.com/comment/35037972
answer count: 4
has comment: http://stackoverflow.com/comment/35038081
has comment: http://stackoverflow.com/comment/35038085
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22949787

http://stackoverflow.com/comment/34902411
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22874436
has text: Why? What would that do?
type: AnswerComment

http://stackoverflow.com/comment/35056606
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22960681
has text: You are wrong on Atomicity. What you describe is [Isolation](http://en.wikipedia.org/wiki/ACID#Isolation). Consider a method which is synchronized on its class, and modifies a field. But the getter is not synchronized an hence, may read the field. Isolation is not guaranteed this way.
type: AnswerComment

usebean
tags question: http://stackoverflow.com/q/22889660
type: Tag
tag name: usebean

http://stackoverflow.com/comment/34953666
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22902545
has text: You shouldn't move Swing components once you lay them out. You can change the text in the JButtons to simulate them moving.
type: Comment

http://stackoverflow.com/comment/34887571
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22862134
has text: As much as i remember you only need to add a `ColorAttribute` with the type `ColorAttribue.Fog` to the environment. (http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/g3d/attributes/ColorAttribute.html). The default Shader takes care about this Fog attribute, as much as i remember but i am not sure. And i stil use the version 0.9.9 of Libgdx idk if it changed...

linked-list
tags question: http://stackoverflow.com/q/22850825
tags question: http://stackoverflow.com/q/22861662
tags question: http://stackoverflow.com/q/22894206
tags question: http://stackoverflow.com/q/22822894
tags question: http://stackoverflow.com/q/22900917
tags question: http://stackoverflow.com/q/22927848
tag name: linked-list
tags question: http://stackoverflow.com/q/22901375
tags question: http://stackoverflow.com/q/22959226
tags question: http://stackoverflow.com/q/22915233
type: Tag
tags question: http://stackoverflow.com/q/22882632
tags question: http://stackoverflow.com/q/22832344
tags question: http://stackoverflow.com/q/22901639
tags question: http://stackoverflow.com/q/22890967
tags question: http://stackoverflow.com/q/22884138
tags question: http://stackoverflow.com/q/22925293
tags question: http://stackoverflow.com/q/22942579
tags question: http://stackoverflow.com/q/22934553
tags question: http://stackoverflow.com/q/22902924
tags question: http://stackoverflow.com/q/22924044
tags question: http://stackoverflow.com/q/22822396

http://stackoverflow.com/q/22939639
has body: In a HashMap, if I put custom objects as a key. What would happen if I override hashCode() method and implement it to pass value as '1'; would there be any performance hit ? if I change hashCode() method to return random value using Math.random() function what would happen to performance ?
has title: HashMap Performance when overriding hashcode method
has answer: http://stackoverflow.com/a/22939762
tagged with: dictionary
tagged with: collections
has answer: http://stackoverflow.com/a/22939744
downvote count: 1
has answer: http://stackoverflow.com/a/22939713
tagged with: java
upvote count: 7
type: Question
has answer: http://stackoverflow.com/a/22939781
has comment: http://stackoverflow.com/comment/35025223
has answer: http://stackoverflow.com/a/22939955
score: 6
has comment: http://stackoverflow.com/comment/35019615
favorite count: 0
answer count: 5
type: UnansweredQuestion

http://stackoverflow.com/a/23075399
score: 10
accepted answer of: http://stackoverflow.com/q/22900354
answers question: http://stackoverflow.com/q/22900354
has comment: http://stackoverflow.com/comment/35632565
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35490130
has comment: http://stackoverflow.com/comment/35636070
has body: First you need to set up a receiver to watch the wifi connection to see when they have data, you could also check for normal 3g/4g connections and make a broadcast receiver for that as well. todo this let use implement a broadcast receiver for connection status changes. put something like this in the manifest in the application tag &lt;receiver android:name=".NetworkChangeReceiver" &gt; &lt;intent-filter&gt; &lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; now we need to make the receiver we just defined in the manifest public class NetworkChangeReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { //here, check that the network connection is available. If yes, start your email service. If not, stop your email service. ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = cm.getActiveNetworkInfo(); if (info != null) { if (info.isConnected()) { //start service Intent intent = new Intent(this, ItemServiceManager.class); startService(intent); } else { //stop service Intent intent = new Intent(this, ItemServiceManager.class); stopService(intent); } } } } What this does is puts a big fat antenna called NetworkChangeReceiver out in android land, that is fine tuned to listen in on when android has something to say about a change in the data connection status. now you need to build your ItemServiceManager.class which should read from a database (it should also extend Service. It should choose the oldest item in the database, (email it, text it, upload to server, whatever), and if the connection was successful then remove the item from the database, and load the next oldest one. If there is no more then close the service and the broadcast receiver. If you have a connection and the user needs to send more data, then add it to the database, and then make sure the service is started. Maybe notify it tha…
upvote count: 10

http://stackoverflow.com/a/22939434
has comment: http://stackoverflow.com/comment/35095513
answers question: http://stackoverflow.com/q/22939298
score: 4
downvote count: 1
has body: Yes there is, do not add a new line between the import and the logger definition: ${:import(org.apache.log4j.Logger)}private static final Logger logger = Logger.getLogger(${enclosing_type}.class); Side-note: If needed, you can also position the cusrsor in your template with the ${cursor} variable EDIT AFTER QUESTION UPDATE: The same thing applies, the import variable does not have to be the first in the pattern, it can be anywhere and it will be evaluated nonetheless: /** * Logger */ ${:import(org.apache.log4j.Logger)}private static final Logger logger = Logger.getLogger(${enclosing_type}.class);
upvote count: 5
type: Answer

http://stackoverflow.com/comment/34874273
type: QuestionComment
comment on: http://stackoverflow.com/q/22859292
type: Comment
has text: I've seen an AtomicInteger example, I've also tried synchronization between threads but I have only seen how to pass information into threads and not in the reverse direction to a central hash table. I'm struggling to find a simple hash table example used in this way.
score: 0

http://stackoverflow.com/comment/34882081
has text: You might want to review the data type for the 'vendorCode' column
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22863814
score: 0

http://stackoverflow.com/comment/35050833
has text: Read up on [JDT Refactoring](http://www.eclipse.org/articles/article.php?file=Article-Unleashing-the-Power-of-Refactoring/index.html)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22955879

http://stackoverflow.com/q/22870782
tagged with: java
tagged with: inputstream
tagged with: http
type: Question
has body: I'm coding web-server: import java.net.ServerSocket; import java.net.Socket; import java.io.InputStream; import java.io.OutputStream; import java.io.InputStreamReader; import java.io.BufferedReader; public class HttpServer { public static void main(String[] args) throws Throwable { //http://localhost:3000 ServerSocket ss = new ServerSocket(3000); while (true) { //Waiting for socket Socket s = ss.accept(); System.out.println("Client accepted"); //The main process new SocketProcessor(s, ss).start(); } } private static class SocketProcessor implements Runnable { private Thread t; private Socket s; private InputStream is; private OutputStream os; private SocketProcessor(Socket s, ServerSocket ss) throws Throwable { t = new Thread(this, "Server Thread"); this.s = s; this.is = s.getInputStream(); this.os = s.getOutputStream(); } public void run() { try { readInputHeaders(); writeResponse(" Hello "); } catch (Throwable t) { /*do nothing*/ } finally { try { s.close(); } catch (Throwable t) { } } System.out.println("Client processing finished"); } public void start() { t.start(); } private void writeResponse(String s) throws Throwable { String response = "HTTP/1.1 200 OK\r\n" + "Server: Server\r\n" + "Content-Type: text/html\r\n" + "Content-Length: " + s.length() + "\r\n" + "Connection: close\r\n\r\n"; String result = response + s; os.write(result.getBytes()); os.flush(); } private void readInputHeaders() throws Throwable { BufferedReader br = new BufferedReader(new InputStreamReader(is)); while (true) { int a = br.read(); System.out.print((char)a); if (a==-1) { break; } } } } } But I've got trouble with reading. This methods takes too much time: private void readInputHeaders() throws Throwable { BufferedReader br = new BufferedReader(new InputStreamReader(is)); while (true) { int a = br.read(); System.out.print((char)a); if (a==-1) { break; } } } It returns headers and query string, but it freezes my web-server to death. What's wrong?
has comment: http://stackoverflow.com/comment/34898847
has title: Reading HTTP InputStream troubles
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34895147
has answer: http://stackoverflow.com/a/22879584
accepted answer: http://stackoverflow.com/a/22879584
tagged with: sockets
type: AnsweredQuestion

http://stackoverflow.com/q/22898802
type: Question
has body: I'm working with a JTextPane. JTextPane pane = new JTextPane(); String content = "I'm a line of text that will be displayed in the JTextPane"; StyledDocument doc = pane.getStyledDocument(); SimpleAttributeSet aSet = new SimpleAttributeSet(); If I add this aSet to the textpane's document like this: doc.setParagraphAttributes(0, content.length(), aSet, false); Nothing visible happens. No big surprise since I haven't set any custom attributes for aSet. However, if I allow aSet to replace the current ParagraphAttributes of doc like this: doc.setParagraphAttributes(0, content.length(), aSet, true); A lot of things happen. How can I get information on those default values of the JTextPane document? Particularly my problems is that when I'm defining a custom Font for aSet and set it to replace the current attributes, the font is displayed as if it was bold. StyleConstants.setBold(aSet, false); doesn't help.
has answer: http://stackoverflow.com/a/22901671
accepted answer: http://stackoverflow.com/a/22901671
score: 0
linked to: http://stackoverflow.com/q/9567028
answer count: 1
type: AnsweredQuestion
tagged with: java
tagged with: jtextpane
has title: how can I find default attributes for JTextPane document?
tagged with: swing

http://stackoverflow.com/comment/34983690
type: AnswerComment
comment on: http://stackoverflow.com/a/22919632
has text: More generally "the prefix _x_ is not bound" will always mean a missing or misplaced `xmlns:...` somewhere.
type: Comment
score: 1

http://stackoverflow.com/q/22956082
has comment: http://stackoverflow.com/comment/35049332
tagged with: java
type: Question
has title: Running executable from java fails
score: 0
tagged with: bash
upvote count: 1
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22956345
accepted answer: http://stackoverflow.com/a/22956345
has body: I am trying to run mdb-export on a file I know exist in that directory. But it does not seem to execute. "ls-l" will so I am sure that the java code is working. The command will execute perfectly from bash. The failing command is /usr/bin/mdb-export -Q -d ';' -D '%Y-%m-%d %H:%M:%S' /home/jocke/viking.mdb resultat &gt;&gt; resultat.csv private void runCommand() { try { String workingdirectory=System.getProperty("user.dir"); Runtime runtime = Runtime.getRuntime(); //Process process = runtime.exec("/usr/bin/mdb-export -Q -d ';' -D '%Y-%m-%d %H:%M:%S' /home/jocke/viking.mdb resultat &gt;&gt; resultat.csv"); Process process = runtime.exec("/usr/bin/mdb-export /home/jocke/viking.mdb resultat &gt;&gt; resultat.csv"); // process.waitFor(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { System.out.println(line); } } catch (Exception e) { e.printStackTrace(); } }
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/34973584
type: AnswerComment
has text: can you check the error in the logcat? Did you add `single_list_item_view` in the manifest?
type: Comment
comment on: http://stackoverflow.com/a/22913158
score: 0

http://stackoverflow.com/comment/34880660
type: QuestionComment
has text: update complete stack trace.
score: 0
comment on: http://stackoverflow.com/q/22862438
type: Comment

http://stackoverflow.com/comment/34794484
has text: @Cuthbert, I propose you to add last term query as Occur.MUST
type: Comment
comment on: http://stackoverflow.com/a/22814162
score: 0
type: AnswerComment

http://stackoverflow.com/q/22891425
accepted answer: http://stackoverflow.com/a/22891847
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/31844044
has answer: http://stackoverflow.com/a/31844044
score: 11
upvote count: 11
tagged with: coding-style
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22891847
type: Question
tagged with: eclipse
has body: It is possible to Import+Export Clean Up setting as xml file at Preferences-&gt;Java-&gt;Code Style-&gt;Clean Up. I want these setting to be applied on the code each time I save a file. Unfortunately, when I go to Preferences-&gt;Java-&gt;Editor-&gt;Save Actions I don't have an option to Import+Export Clean Up settings (even though I have the option to configure them manually). Is there a way to Import+Export these settings? Clarification: My goal is to create Clean Up setting xml that I can share with my team members so that if any of us saves a file these Clean Up settings will be automatically applied on the code. I am using Eclipse 4.3 Kepler.
answer count: 3
has title: Eclipse: Import+Export actions in "Save Actions" option
has answer: http://stackoverflow.com/a/33878309

http://stackoverflow.com/comment/34929225
type: Comment
has text: For better help sooner, post an ***[MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).***
type: QuestionComment
comment on: http://stackoverflow.com/q/22885858
score: 0

http://stackoverflow.com/q/22921623
has comment: http://stackoverflow.com/comment/34987850
score: 24
has answer: http://stackoverflow.com/a/22921698
tagged with: java-8
upvote count: 24
type: Question
has answer: http://stackoverflow.com/a/22921919
has body: When I execute this code which opens a lot of files during a stream pipeline: public static void main(String[] args) throws IOException { Files.find(Paths.get("JAVA_DOCS_DIR/docs/api/"), 100, (path, attr) -&gt; path.toString().endsWith(".html")) .map(file -&gt; runtimizeException(() -&gt; Files.lines(file, StandardCharsets.ISO_8859_1))) .map(Stream::count) .forEachOrdered(System.out::println); } I get an exception: java.nio.file.FileSystemException: /long/file/name: Too many open files The problem is that Stream.count does not close the stream when it is done traversing it. But I don't see why it shouldn't, given that it is a terminal operation. The same holds for other terminal operations such as reduce and forEach. flatMap on the other hand closes the streams it consists of. The documentation tells me to use a try-with-resouces-statement to close streams if necessary. In my case I could replace the count line with something like this: .map(s -&gt; { long c = s.count(); s.close(); return c; } ) But that is noisy and ugly and could be a real inconvenience in some cases with big, complex pipelines. So my questions are the following: Why were the streams not designed so that terminal operations close the streams they are working on? That would make them work better with IO streams. What is the best solution for closing IO streams in pipelines? runtimizeException is a method that wraps checked exception in RuntimeExceptions.
tagged with: java
has answer: http://stackoverflow.com/a/22929990
possible better answer: http://stackoverflow.com/a/22923414
downvote count: 0
has answer: http://stackoverflow.com/a/22923414
favorite count: 0
answer count: 5
has title: Closing streams in the middle of pipelines
has comment: http://stackoverflow.com/comment/34990103
accepted answer: http://stackoverflow.com/a/22929990
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22921834
tagged with: java-stream

http://stackoverflow.com/q/22932727
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22932937
accepted answer: http://stackoverflow.com/a/22932937
type: Question
answer count: 1
downvote count: 0
tagged with: jface
favorite count: 0
tagged with: swt
upvote count: 1
has body: I have created a Dialog using JFace and set it to resizable using SWT.RESIZE. But, it allows the user to resize it all the way to 0 rows where only the title bar is visible. Is there a way by which I can restrict the user to resize up to a certain number of rows only?
type: AnsweredQuestion
has title: JFaces Dialog resizing to zero rows
tagged with: dialog

http://stackoverflow.com/comment/34886162
type: Comment
has text: How does your configuration file looks like ? Have you configured the dialect ? like org.hibernate.dialect.PostgreSQLDialect
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22865670

http://stackoverflow.com/comment/35033022
type: Comment
has text: Thank you.I forgot to write it here. But I wrote it in main program.So this is not my problem.
score: 0
comment on: http://stackoverflow.com/q/22946789
type: QuestionComment

http://stackoverflow.com/a/34451912
type: Answer
has body: Set your book object with correct hash key value, and use DynamoDBMapper to get the count. DynamoDBQueryExpression&lt;Book&gt; queryExpression = new DynamoDBQueryExpression&lt;Book&gt;() .withHashKeyValues(book); dynamoDbMapper.count(Book.class, queryExpression);
accepted answer of: http://stackoverflow.com/q/22916815
downvote count: 0
answers question: http://stackoverflow.com/q/22916815
score: 5
type: AcceptedAnswer
upvote count: 5

http://stackoverflow.com/q/22820220
has answer: http://stackoverflow.com/a/22820277
has answer: http://stackoverflow.com/a/22820463
has answer: http://stackoverflow.com/a/22820266
has comment: http://stackoverflow.com/comment/34804411
tagged with: java
possible better answer: http://stackoverflow.com/a/22820266
tagged with: ignore-case
answer count: 4
has answer: http://stackoverflow.com/a/22820267
type: AnsweredQuestion
downvote count: 0
has title: Java: equalsIgnoreCase + message.startswith?
accepted answer: http://stackoverflow.com/a/22820267
favorite count: 0
type: Question
has body: Got a Question: How can i combine message.equalsIgnoreCase and message.startswith() ? i.e: if (message.startsWith("!spoiler")) { String name = sender; if (!name.equalsIgnoreCase(ownerchannel)){ try { String spoiler = message.split("!spoiler ")[1]; sendMessage(channel, "/timeout "+name+" 1"); if(englishmode == true){ sendMessage(channel, "Spoiler from "+name+" deleted. Click at 'message deleted' above to read it!"); }else{ sendMessage(channel, "Spoiler von "+name+" wurde zensiert. Wer diesen lesen möchte klickt einfach oben auf 'message deleted'."); } } catch (Exception e) { } } } in my code above, !spoiler xyz will trigger it but !Spoiler xyz wont. how can i combine it to ma tch startswith + ignorecase?
score: 3
has comment: http://stackoverflow.com/comment/34804374
has comment: http://stackoverflow.com/comment/34804268
linked to: http://stackoverflow.com/q/26794275
upvote count: 3
has comment: http://stackoverflow.com/comment/34804866

http://stackoverflow.com/a/22810374
type: Answer
has body: To simplify boolean expression is to reduce complexity of this expression, with preserving the meaning. In your case: if(!this.something) has the same meaning but it's a little bit shorter. To simplify more complex examples you can use truth tables or Karnaugh maps.
score: 0
answers question: http://stackoverflow.com/q/22810275

http://stackoverflow.com/comment/34880859
type: Comment
has text: Now I'm not getting an exception, but the `new_strdate` needs to be in a `Date` object, but when I do again `SimpleDateFormat`, it goes back to the previous format
type: AnswerComment
comment on: http://stackoverflow.com/a/22855687
score: 0

http://stackoverflow.com/a/22964663
answers question: http://stackoverflow.com/q/22963443
has body: The frame seems to be: &lt;iframe id="mailroifrm12" width="300" scrolling="no" align="left" height="223" frameborder="0" src="/poll.cms" marginwidth="0" marginheight="0" hspace="0" vspace="0" valign="top"&gt; so try to : WebElement element=driver.findElement(By.id("mailroifrm12")); driver.switchTo().frame(element); WebElement form =driver.findElement(By.xpath("//form[@name='pollform']")); // do stuff
has comment: http://stackoverflow.com/comment/35105040
score: 0
type: Answer

http://stackoverflow.com/comment/34829786
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22834650
has text: Thanks, add the code. The problem still remains
score: 0

http://stackoverflow.com/comment/34934257
comment on: http://stackoverflow.com/a/22892356
score: 0
has text: uuid won't be will be unique till one instance of jvm exist. Number may not be really unique after jvn restart right?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35030161
comment on: http://stackoverflow.com/q/22945406
score: 1
has text: Define "immune"? I would say safer then C. There is no such thing as bug free software. Also, the operating system might be compromised. Java is not a panacea.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22950659
score: 0
answers question: http://stackoverflow.com/q/22950577
type: Answer
has comment: http://stackoverflow.com/comment/35044500
has body: You may initialize the array in your class, and you may even initialize with initial values, but you cannot execute code that will assign values once the variable is created. There are languages where this would be possible, but Java is not one of them.

http://stackoverflow.com/comment/34836231
comment on: http://stackoverflow.com/a/22837826
score: 0
type: AnswerComment
type: Comment
has text: This only works for characters that can be represented by an `int` value less than 256. Try it with the character "`☼`" and see what happens. Any character that requires more than one byte to represent will not be read properly using this method.

http://stackoverflow.com/comment/34905710
type: AnswerComment
comment on: http://stackoverflow.com/a/22875158
has text: @TimJ.Benham: Indeed, I just layed out what the problem was. As for possible solutions: reflection is always a way when you're encountering limitations native to the libraries. One other possibility I see here is for you to create your own helper function that takes a `Map<K, V>` as argument and creates a new one based on its values. Basically: create your own `clone` method.
type: Comment
score: 0

http://stackoverflow.com/a/22945634
type: Answer
has body: You might not be able to get a custom appender to work in the Studio but it should work in the Standalone. The main problem is that the logger is initiated before the app. See here: Mule ESB 3.4.0 CE: Unable to find custom log4j appender in MuleStudio, but works in Mule Standalone
answers question: http://stackoverflow.com/q/22945093
has comment: http://stackoverflow.com/comment/35031095
accepted answer of: http://stackoverflow.com/q/22945093
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/34993247
comment on: http://stackoverflow.com/q/22923907
type: QuestionComment
score: 0
has text: @MikeM. Should I decrement the variable inside of the if statement within the onRecieve method?
type: Comment

http://stackoverflow.com/q/22815972
has comment: http://stackoverflow.com/comment/34796641
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23122939
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34796735
has answer: http://stackoverflow.com/a/23122939
has comment: http://stackoverflow.com/comment/34796534
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34796696
favorite count: 0
tagged with: timer
has title: Java using timer to disconnect clients from server
has body: I have a UDP server. I want to be able to register client-side disconnects. So far I am using Threads to detect disconnects. How do I use Timers to do the same thing? Current implementation: new Thread(new Runnable() { @Override public void run() { while(running) { currentIteration++; for (Map.Entry&lt;Integer,Long&gt; entry : ping.entrySet()) { long oldIteration = entry.getValue(); if (currentIteration-oldIteration &gt; 1000000) killIds.add(entry.getKey()); } } } }).start();

http://stackoverflow.com/comment/35044526
comment on: http://stackoverflow.com/a/22953007
score: 0
type: AnswerComment
type: Comment
has text: Thanks for your response Karna, since this is not opening with the new window, do we need to switch? i tried with your code as well. but still i couldn't pass the control

http://stackoverflow.com/q/22868431
tagged with: fork-join
has comment: http://stackoverflow.com/comment/34890546
has comment: http://stackoverflow.com/comment/34892261
has comment: http://stackoverflow.com/comment/34892858
type: Question
accepted answer: http://stackoverflow.com/a/22868540
has title: Finding the biggest number with ForkJoin
tagged with: forkjoinpool
has comment: http://stackoverflow.com/comment/34892359
has comment: http://stackoverflow.com/comment/34892898
has comment: http://stackoverflow.com/comment/34892131
answer count: 1
has answer: http://stackoverflow.com/a/22868540
type: AnsweredQuestion
score: 0
tagged with: java
has body: Without block if delay == 2 it works, but doesn't work with it. Here's ForkJoin's compute: compute() { if(lastElem - firstElem == 1) return array[firstElem]; if(lastElem - firstElem == 2){ if(array[firstElem] &gt; array[lastElem]) return array[firstElem]; else return array[lastElem]; } int midElem = (firstElem + lastElem) / 2; MyForkJoinTask left = new MyForkJoinTask(array, firstElem, midElem); MyForkJoinTask right = new MyForkJoinTask(array, midElem, lastElem); left.fork(); right.fork(); int leftResult = left.join(); int rightResult = right.join(); if(leftResult &gt; rightResult) return leftResult; else return rightResult; } Here's my main method: main(String[] args) { Random r = new Random(); for(int i = 0; i &lt; array.length; i++){ array[i] = r.nextInt(); } MyForkJoinTask root = new MyForkJoinTask(array); F_J_POOL.submit(root); System.out.println("Result is " + root.join()); } Short error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at com.bg.fork_join.MainFJ.main(MainFJ.java:24) Caused by: java.lang.ArrayIndexOutOfBoundsException ... 15 more Caused by: java.lang.ArrayIndexOutOfBoundsException: 10000 at com.bg.fork_join.MyForkJoinTask.compute(MyForkJoinTask.java:31) Could you show me where the problem is?

http://stackoverflow.com/q/22925526
answer count: 1
has answer: http://stackoverflow.com/a/22925561
has body: I wonder if anyone can please clear my confusion about the implementation issue that I am having; if Thread.interrupted() clears a flag of the current thread and also tells you if current thread was interrupted, my lack of understanding is the static scope. How does a static function knows my current thread instance ? Thanks, just trying to understand the internals.
favorite count: 0
has title: interrupted vs isinterrupted implementation
downvote count: 0
type: UnansweredQuestion
tagged with: multithreading
type: Question
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/22835268
downvote count: 0
has comment: http://stackoverflow.com/comment/34831123
accepted answer of: http://stackoverflow.com/q/22835214
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/22835214
score: 6
has body: In Java, the object reference is passed as a value. Therefore, when z = new int[5]; is executed, the local array variable z present in the f() method now refers to the newly created int array and nothing happens to the original array whose reference was passed as a value to it when the method was called. public static void f(int x, int[] y, int[] z) { x = 2; y[0] = x; // Till here z is referring to the int array passed from main method z = new int[5]; // now z is re-assigned with a new reference, the one of the newly created int array // thus the reference to the original array is no more being used here z[0] = 555; // this modifies the values of the newly created array } Personally, I always suggest reading this answer by Eng.Fouad to understand this concept.
type: AcceptedAnswer

http://stackoverflow.com/q/22941359
has body: I've been searching StackOverflow for an answer regarding this issue. Lets say I created two array lists, arraylist1 holds Strings arraylist2 holds Integers. NOTE - I've added things into both of these arraylists. The values at each of the indices are related to the other value. Meaning. lets say index 1 of arraylist1 = "Name". Index 1 of arraylist2 = 3, they are related in that I want to put things into a TreeMap (for the purpose of sorting by key) so that the treemap puts in the value ("Name", 3). My problem - TreeMap&lt;String, Integer&gt; mymap = new TreeMap&lt;String, Integer&gt;(); for(String s : arraylist1) { for(Integer v : arraylist2) { mymap.put(s, v); The problem with this is if I added a bunch of random things for testing, arraylist1.add("h"); arraylist1.add("i"); arraylist1.add("e"); arraylist2.add(1); arraylist2.add(3); arraylist2.add(2); And I did the for loops, my result would come out to... Key e Value: 2 Key h Value: 2 Key i Value: 2 Which solves the problem of sorting by key. However, the problem is that only the last value in the Integer arraylist, arraylist2, is being put into the TreeMap.
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has title: Two ArrayList into a TreeMap
possible better answer: http://stackoverflow.com/a/23050704
has answer: http://stackoverflow.com/a/22941406
has answer: http://stackoverflow.com/a/23050704
score: 0
answer count: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/22941406

http://stackoverflow.com/q/22858506
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34888614
has comment: http://stackoverflow.com/comment/34888796
has body: I am trying to send data over bluetooth spp from an Android app. The code below takes a string, which works perfectly. Whatever I put in I get on hyperterminal at the other end of the connection. public void write(String message) { byte[] msgBuffer = message.getBytes(); try { mmOutStream.write(msgBuffer); } catch (IOException e) { Log.d(TAG, "Error data send"); } } However, I want to be able to send a hex value such as 0x41 for an 'A' in ASCII. How would I go about implementing this so that I could convert a string of say "41 7E" to the values 0x41 and 0x7E and then send them as is, so that on hyperterminal they come up as "A~"? I have tried using an example below but no success. public void writeHex(String str){ char[] buffer = str.toCharArray(); byte[] b = new byte[buffer.length]; for (int k=0; k &lt; b.length; k++) { b[k] = (byte) buffer[k]; try{ mmOutStream.write(b); }catch (IOException e){ Log.d(TAG, "Error data send"); } } } The values to be sent are read in from and editText when a button 'send' with an onClickListener is triggered. I have already formatted the editText so that only characters 0-9 and A-F are valid. hexSend.setOnClickListener(new OnClickListener() { public void onClick(View v) { String hex = hexInput.getText().toString(); mConnectedThread.writeHex(hex); Toast.makeText(getBaseContext(), "Hex Data Sent", Toast.LENGTH_SHORT).show(); } });
tagged with: bluetooth
has comment: http://stackoverflow.com/comment/34888049
linked to: http://stackoverflow.com/q/923863
has comment: http://stackoverflow.com/comment/34873277
downvote count: 0
favorite count: 0
has title: Send hex via bluetooth from Android app
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34874222
answer count: 0
has comment: http://stackoverflow.com/comment/34872853
score: 1
tagged with: java

http://stackoverflow.com/comment/34880576
comment on: http://stackoverflow.com/q/22862253
type: QuestionComment
has text: Can you show us the part the method is called and the code of the method? maybe you open a new thread or something and you wont jump to the breakpoint because you are in a different thread and the method is never called in the one you´ve joined.
score: 0
type: Comment

http://stackoverflow.com/comment/34983496
type: AnswerComment
comment on: http://stackoverflow.com/a/22919521
type: Comment
has text: @LaRRy - yes, i looked at that, which is using ZipInputStreamZipEntrySource. can you show your exception?
score: 0

http://stackoverflow.com/a/22887034
upvote count: 1
has comment: http://stackoverflow.com/comment/34925178
score: 1
answers question: http://stackoverflow.com/q/22886524
downvote count: 0
has comment: http://stackoverflow.com/comment/34925445
has body: You must declare your WebView inside onCreateView(), on your PlaceHolderFragment, because it is part of your fragment layout. Remove it from onCreate(). Like this: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); WebView ourBrow = (WebView) rootView.findViewById(R.id.Browser); try{ ourBrow.loadUrl("http://www.youtube.com/"); } catch (Exception e){ e.printStackTrace(); } }
type: Answer

http://stackoverflow.com/q/22822696
tagged with: modality
favorite count: 0
has title: JFrame "blocking" show()
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22822825
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/1481405
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/34809002
answer count: 2
has body: I'm using CHARVA (ncurses-like Swing) and I have a problem. Because charva is very similar to Swing, I think the solution for Swing is the same to charva. I'm developing an application that call a JFrame-extended class, get its return code and shows other JFrame windows depending on return code. It's like : public static void main() { MainFrame mainframe=new MainFrame(); mainframe.show(); switch (mainframe.returncode) { case "generalsetting": Frame1 frame1=new Frame1; frame1.show(); break; case "usersetting": Frame2 frame2=new Frame2; frame2.show(); break; etc. But when I do: mainframe.show(); The program does not wait until mainframe is closed/hidden, but continue on the "switch", the return code is not initialized and crashes my program. There is a way to have a "blocking" show()?
score: 2
tagged with: modal-dialog
downvote count: 0
has answer: http://stackoverflow.com/a/22822803

http://stackoverflow.com/q/22935719
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22935857
tagged with: java
possible better answer: http://stackoverflow.com/a/22935857
type: Question
has title: Wildcards with diamond operator
has answer: http://stackoverflow.com/a/22935780
tagged with: wildcard
answer count: 3
has comment: http://stackoverflow.com/comment/35012256
tagged with: generics
score: 7
favorite count: 0
has body: If I am trying to do something like this : List&lt;?&gt; unknownList = new ArrayList&lt;&gt;(); then the code compiles and runs fine, but of which type the ArrayList has created? and after this line, If I have done like this : unknownList.add("str"); //compilation error It gives compilation error : error: no suitable method found for add(String) unList.add("str"); ^ method List.add(int,CAP#1) is not applicable (actual and formal argument lists differ in length) method List.add(CAP#1) is not applicable (actual argument String cannot be converted to CAP#1 by method invocation conversion) method Collection.add(CAP#1) is not applicable (actual argument String cannot be converted to CAP#1 by method invocation conversion) where CAP#1 is a fresh type-variable: CAP#1 extends Object from capture of ? What is this error, and is it good to use the diamond-operator with wildcards? If YES then WHERE???
upvote count: 8
accepted answer: http://stackoverflow.com/a/22935780
tagged with: diamond-operator
has answer: http://stackoverflow.com/a/22950268
downvote count: 1

http://stackoverflow.com/q/22855685
has comment: http://stackoverflow.com/comment/34868298
has comment: http://stackoverflow.com/comment/34868799
has comment: http://stackoverflow.com/comment/34868001
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34868546
favorite count: 0
has title: Brute Force Decryption issue
type: UnansweredQuestion
tagged with: brute-force
tagged with: encryption
has answer: http://stackoverflow.com/a/22855891
has comment: http://stackoverflow.com/comment/34867792
has body: Ok, so yesterday, I submitted this question about an issue with an extra credit assignment I'm working on. Since then, I think I've made a little progress, but now I'm running into a couple of new problems that I could use some help with. As I mentioned in my last post, my assignment is to decrypt an encrypted file. The file was encrypted with the PBEWithSHA1AndDESede algorithm and we don't have the password. The password is a dictionary word with no special characters or numbers. Also, the file is encrypted using an unmodified version of the Crypt class, linked below. The way I'm trying to handle it is with brute force by just testing thousands of words pulled at random from a dictionary. Here's my new code: import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; import java.util.Scanner; public class WordGuess { public static void main(String[] args) { ArrayList&lt;String&gt; words = new ArrayList(); String curWord = ""; try { File aFile = new File("english.txt"); Scanner reader = new Scanner(aFile); while (reader.hasNext()) { curWord = reader.next(); if (curWord.length() == 5) { words.add(curWord); } } } catch (FileNotFoundException e) { System.out.println("Error: " + e); } Random numGen = new Random(); int count = 0; int maxTries = 10000; int tries = 0; File extraIn = new File("extracredit.enc"); File extraOut = new File("extra_out.txt"); while (true) { try { Crypt c = new Crypt(randomGenerator(words, numGen)); System.out.println(randomGenerator(words, numGen)); byte[] bytes = FileIO.read(extraIn); System.out.println("Attempt number: " + tries++); FileIO.write(extraOut, c.decrypt(bytes)); System.out.println("Success!"); } catch (IOException e) { System.out.println("Could not read/write file"); } catch (Exception e) { if (++count == maxTries) { try { throw e; } catch (Exception e1) { System.out.println("Encryption error."); System.exit(0); } } } } } public…
has answer: http://stackoverflow.com/a/22855792
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/22852680
score: 1
has comment: http://stackoverflow.com/comment/34863369
answers question: http://stackoverflow.com/q/22852538
downvote count: 1
has body: This is not my solution. Someone has already answered it here You should use File#createTempFile() which takes a directory instead. File file = File.createTempFile("upload-", ".bin", new File("/path/to/your/uploads")); item.write(file); Or if you actually want to move the temp file to another location afterwards, use File#renameTo(). File destination = new File("/path/to/your/uploads", file.getName()); file.renameTo(destination);
has comment: http://stackoverflow.com/comment/34863310
accepted answer of: http://stackoverflow.com/q/22852538
has comment: http://stackoverflow.com/comment/34862774
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34864721
has comment: http://stackoverflow.com/comment/34862782
type: Answer
has comment: http://stackoverflow.com/comment/34863203

http://stackoverflow.com/comment/34903560
type: Comment
comment on: http://stackoverflow.com/q/22874807
type: QuestionComment
has text: It looks okay to me (other than resource management). I'd imagine that error could happen if there was no space between `racebikes` and `VALUES`. No funny non-printable characters in there? Try typing out the line again: `String query = "INSERT INTO racebikes VALUES(?,?,?)";`
score: 0

http://stackoverflow.com/comment/35047498
has text: Awesome...quotes worked perfectly...Thanks
score: 0
comment on: http://stackoverflow.com/q/22955302
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22866653
tagged with: jakarta-ee
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22866762
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has title: Casting JSON to resource in REST call
downvote count: 0
answer count: 1
tagged with: glassfish
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/22866762
has body: I'm trying to accept JSON input from a POST and automatically cast it to the resource class, but I keep getting the error: java.lang.ClassCastException: com.foo.MyResource cannot be cast to java.util.Collection I thought I annotated my class correctly, but I feel like I'm missing something obvious. Can anyone help me figure out why this code will not parse the below JSON into a MyResource object? My service class contains this method: @POST @Path("/somepath/{user}") @Consumes(MediaType.APPLICATION_JSON) public String createUser(MyResource resource, @PathParam("user") String user){ return "Got resource " + resource + " for " + user; } The resource is as follows: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class MyResource { public String foo; public String bar; public int baz; public String toString(){ return foo + " " + bar + " " + baz; } } My request message: Headers: Content-Length: 92 Host: requestb.in Cache-Control: no-cache Accept-Encoding: gzip,deflate,sdch Content-Type: application/json Connection: close User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 Accept: */* Cookie: session=eyJyZWNlbnQiOlsiMTZwcXV1NDEiXX0.BiBTRw.qNeCDkVfl-4Xog8hLhYuJFSlEYg; _ga=GA1.2.1701494324.1396374352 X-Request-Id: c9bd3f19-f071-47ad-9adb-d98232a7e8fb Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm Accept-Language: en-US,en;q=0.8 RAW BODY [ { "foo": "foo string" }, { "bar": "bar string" }, { "baz": 5 } ]
upvote count: 1

http://stackoverflow.com/q/22963363
has comment: http://stackoverflow.com/comment/35061958
has answer: http://stackoverflow.com/a/22963431
has comment: http://stackoverflow.com/comment/35061745
answer count: 4
has comment: http://stackoverflow.com/comment/35062040
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35062307
has comment: http://stackoverflow.com/comment/35061925
tagged with: arraylist
has answer: http://stackoverflow.com/a/22963390
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/22963495
type: Question
has comment: http://stackoverflow.com/comment/35061924
downvote count: 2
has comment: http://stackoverflow.com/comment/35061848
upvote count: 1
has body: Today I have an even more stupid problem than yesterday but I really can't understand why my code doesn't work. The code is the following: public class A{ List fileList; public A(List fl){ fileList = new ArrayList&lt;String&gt;; if(fl != null) { fileList = fl; } } public void removeFiles(List fl){ for(Object obj : fl) { fileList.remove(obj.toString()); } } } I tried every single things I found on the web even with an Iterator but no file has been removed and no errors or exceptions comes up! Some more code public class CoordinationServer extends Activatable implements CoordinationSerInt { List&lt;CoordObj&gt; userList; public int updateFileList(String username, List files, int option) throws RemoteException{ for (CoordObj anUserList : userList) { if (anUserList.getUsername().equals(username)) { if(option == 0){ anUserList.setFileList(files); return 1; }else if(option == 1){ anUserList.addFilesToList(files); return 1; }else if(option == 2){ anUserList.removeFiles(files); return 1; } return 0; } } return -1; } } public class CoordObj implements Serializable { UserForUser userReference; List fileList; String username; public CoordObj(UserForUser ur, List fl, String un) { userReference = ur; fileList = new ArrayList&lt;String&gt;(); if(fl != null) fileList = fl; username = un; } public void removeFiles(List fl){ this.fileList.removeAll(fl); } } RESOLVED If someone else has this problem I resolved it in this way: fileList.removeAll(Arrays.asList(fl.toArray()));
has title: Both List and ArrayList remove method doesn't work
has answer: http://stackoverflow.com/a/22963504
tagged with: java

http://stackoverflow.com/q/22855749
type: UnansweredQuestion
has body: I want to enter decimal numbers like "23.50", "250.75". The following code provide this but it put front of numbers a "$" symbol like "$23.50", "$250.75" .. I want to remove dollar symbol and tried a few way but i couldn't. How can i change regex and displaying? the following codde : inputAmount.setRawInputType(Configuration.KEYBOARD_12KEY); inputAmount.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) {} public void beforeTextChanged(CharSequence s, int start, int count, int after) {} public void onTextChanged(CharSequence s, int start, int before, int count) { if(!s.toString().matches("^\\$(\\d{1,3}(\\,\\d{3})*|(\\d+))(\\.\\d{2})?")) { String userInput= ""+s.toString().replaceAll("[^\\d]", ""); StringBuilder cashAmountBuilder = new StringBuilder(userInput); while (cashAmountBuilder.length() &gt; 3 &amp;&amp; cashAmountBuilder.charAt(0) == '0') { cashAmountBuilder.deleteCharAt(0); } while (cashAmountBuilder.length() &lt; 3) { cashAmountBuilder.insert(0, '0'); } cashAmountBuilder.insert(cashAmountBuilder.length()-2, '.'); cashAmountBuilder.insert(0,'$'); inputAmount.setText(cashAmountBuilder.toString()); // keeps the cursor always to the right Selection.setSelection(inputAmount.getText(), cashAmountBuilder.toString().length()); } } });
tagged with: regex
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/28693983
has comment: http://stackoverflow.com/comment/34868386
has title: Android EditText money input Regex without "$" symbol
score: 0
has comment: http://stackoverflow.com/comment/34867910
has answer: http://stackoverflow.com/a/22857460

http://stackoverflow.com/comment/34876723
score: 0
has text: Generic serialiser/de-serialiser can easily handle 10s of thousands objects per second, externaliser can do 100s of thousands.
comment on: http://stackoverflow.com/q/22859618
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35031095
type: Comment
has text: So I should just use a relative path to the class, as in: log4j.appender.myCustomAppender=MyClass Since both files will end up in the same directory?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22945634

http://stackoverflow.com/comment/34986929
type: Comment
comment on: http://stackoverflow.com/a/22902786
has text: @user3500131 Internally you hold `ltrAra` as `List`, and after filling it you call `SortSearchUtil.selectionSort(ltrAra.toArray(new Letter[ltrAra.size()]));`.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22861770
tagged with: jdbc
type: Question
has comment: http://stackoverflow.com/comment/34882379
has answer: http://stackoverflow.com/a/22862314
tagged with: java
has body: I have a sql file as follows(Pseudocode). Begin Create Table1 Create Table2 Insert values into Table1 by joining 20 different tables Insert values into Table2 by joining 16 different tables End When I execute this in MS Sql server, I get output with several columns. The same SQL Query I am storing in a physical location in my computer and trying to obtain the ResultSet in Java. Here is what I am trying. Connection conn = null; Class.forName(driver); conn = DriverManager.getConnection(dbUrl + dbName, userName,password); FileInputStream input = new FileInputStream("E:\\Query2.sql"); CallableStatement cs = conn.prepareCall(IOUtils.toString(input)); cs.execute(); ResultSet rs = cs.getResultSet(); System.out.println("Done" + rs); When I run this, I am getting Result set as null, Where am I going wrong? Please help.
score: 0
answer count: 2
tagged with: sql
has answer: http://stackoverflow.com/a/22861955
tagged with: sql-server
has title: Get a Result Set using Callable statement
tagged with: callable-statement
type: UnansweredQuestion

http://stackoverflow.com/a/22852975
has body: NumberFormatException / "Any ideas on how I can get the program to run without having all of the text areas filled?" You're probably trying to parse the text (during initialization) before any event has been fired. It's a mistake I see a lot here. Like JTextField field = new JTextField(); double num = Double.parseDouble(field.getText()); That's will undoubtedly get you a NumberFormatException as there is not text (empty String as the error says). You need to wait until some event is fired before you want to parse the text, not during initialization. Like for example a button press private double num; private JTextField field = new JTextField(); private JButton button = new JButton("Nutton"); ... button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { num = Double.parseDouble(field.getText()); } }); "Under x3 == null and the others I get: The operator == is undefined for the argument type(s) double, null" It makes sense, if x3 is a double. As I stated i my comment, primitives (int, double, etc) can't be null. They are defaulted at 0, If you want to check if they haven't been initialized, then check them against 0, not null
has comment: http://stackoverflow.com/comment/34880025
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34881143
has comment: http://stackoverflow.com/comment/34881317
has comment: http://stackoverflow.com/comment/34881614
type: Answer
accepted answer of: http://stackoverflow.com/q/22852856
has comment: http://stackoverflow.com/comment/34881446
answers question: http://stackoverflow.com/q/22852856
has comment: http://stackoverflow.com/comment/34879909
has comment: http://stackoverflow.com/comment/34881078
has comment: http://stackoverflow.com/comment/34879634
has comment: http://stackoverflow.com/comment/34879810

dayofweek
type: Tag
tags question: http://stackoverflow.com/q/22890644
tag name: dayofweek

http://stackoverflow.com/q/22960273
score: 3
linked to: http://stackoverflow.com/q/23775173
has comment: http://stackoverflow.com/comment/38164623
tagged with: java
type: Question
tagged with: javacv
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36629918
has comment: http://stackoverflow.com/comment/40320166
has title: How to create the video from images located in SD card in Android using JavaCV/OpenCV
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40320088
has answer: http://stackoverflow.com/a/30296554
has comment: http://stackoverflow.com/comment/38121881
upvote count: 3
type: UnansweredQuestion
has body: Sorry for bad English...:( I want to create video from images located on SD Card and also each frame/image stay on screen min 1 sec or any value(like 2,3,4 sec). I am using the javacv/opencv library for that. I have use the below code but not work for me i get error given below. I have put my method and error log also, please help me as soon as possible. Thanks in advance public void createVideo() { String path ="/mnt/sdcard/images/"; File folder = new File(path); File[] listOfFiles = folder.listFiles(); IplImage[] iplimage = (IplImage[]) new IplImage[listOfFiles.length]; if(listOfFiles.length&gt;0) { for (int j = 0; j &lt; listOfFiles.length; j++) { String files=""; if (listOfFiles[j].isFile()) { files = listOfFiles[j].getName(); } String[] tokens = files.split("\\.(?=[^\\.]+$)"); String name=tokens[0]; System.out.println(" j " + name); iplimage[j]=cvLoadImage("/mnt/sdcard/images/"+name+".jpg"); } } File videopath = new File(path); videopath.mkdirs(); FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(path+"video"+System.currentTimeMillis()+".mp4",320,480); try { recorder.setVideoCodec(13); //CODEC_ID_MPEG4 //CODEC_ID_MPEG1VIDEO recorder.setVideoBitrate(50); recorder.setFrameRate(10); recorder.setPixelFormat(2); //PIX_FMT_YUV420P recorder.start(); int x = 0; int y = 0; for (int i=0;i&lt; 300 &amp;&amp; x&lt;listOfFiles.length;i++) { recorder.record(iplimage[x]); if (i&gt;(y+10)) { y=y+1; x++; } } recorder.stop(); } catch (Exception e){ e.printStackTrace(); } } But i get this one error please 04-09 12:36:26.130: W/System.err(10201): com.googlecode.javacv.FrameRecorder$Exception: avcodec_open2() error -22: Could not open video codec. 04-09 12:36:26.131: W/System.err(10201): at com.googlecode.javacv.FFmpegFrameRecorder.startUnsafe(FFmpegFrameRecorder.java:492) 04-09 12:36:26.131: W/System.err(10201): at com.googlecode.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:267) 04-09 12:36:26.131: W/System.err(10201): at com.example.imagetovideo.MainActivity.cre…
has comment: http://stackoverflow.com/comment/40318608
tagged with: opencv

http://stackoverflow.com/q/22909301
favorite count: 0
type: UnansweredQuestion
tagged with: java
upvote count: 1
tagged with: scaffold
has title: Creating own scaffold plugins: Unable to locate scaffold/faces/metawidget-qbe.xml
type: Question
linked to: http://stackoverflow.com/q/12622849
downvote count: 0
has answer: http://stackoverflow.com/a/22923826
tagged with: jboss-forge
tagged with: jboss-tools
tagged with: metawidget
answer count: 1
has body: I want to create my own scaffold's provider for jboss forge 1.4.4, for do that I forked the files on github. I add succesfully the plugin with command: forge source-plugins path/to/plugins I can add the plugins to my project with scaffold setup --scaffoldType mFaces But when I run the command scaffold from-entity com.model.* I get the error: ERROR Exception encountered: Unable to locate scaffold/faces/metawidget-qbe.xml on CLASSPATH (type "set VERBOSE true" to enable stack traces) there is the full output: ***INFO*** Using currently installed scaffold [mfaces] java.io.FileNotFoundException: Unable to locate scaffold/faces/metawidget-qbe.xml on CLASSPATH ***ERROR*** Exception encountered: (type "set VERBOSE false" to disable stack traces) [testScaffoldS] testScaffoldS $ at org.metawidget.config.impl.SimpleResourceResolver.openResource(SimpleResourceResolver.java:75) at org.metawidget.config.impl.BaseConfigReader.configure(BaseConfigReader.java:216) at org.metawidget.pipeline.w3c.W3CPipeline.configure(W3CPipeline.java:153) at org.metawidget.pipeline.base.BasePipeline.configureOnce(BasePipeline.java:152) at org.metawidget.pipeline.base.BasePipeline.inspectAsDom(BasePipeline.java:335) at org.metawidget.statically.StaticMetawidget.inspect(StaticMetawidget.java:332) at org.metawidget.statically.StaticMetawidget.write(StaticMetawidget.java:278) at org.jboss.forge.scaffold.mfaces.FacesScaffold.generateFromEntity(FacesScaffold.java:298) at org.jboss.forge.scaffold.plugins.ScaffoldPlugin.generateFromEntity(ScaffoldPlugin.java:174) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.jboss.forge.shell.command.Execution.perform(Execution.java:160) at org.jboss.forge.shell.command.fshparser.FSHRuntime.run(FSHRuntime.java:109) at org.jboss.forge…
score: 1

http://stackoverflow.com/q/22940300
has title: Class file's magic value changes during read/write
has body: I'm trying to save java classes into a database. To do so I read files as follows: bytes = com.google.common.io.ByteStreamsByteStreams.toByteArray(url.openStream()); Then, those bytes are encoded in base64: org.apache.hadoop.hbase.util.Base64.encodeBytes(bytes); When loading them again, the same thing happens vice versa: org.apache.hadoop.hbase.util.Base64.decode(base64); and its written to a file: com.google.common.io.Files.write(binary, file); However, source and targe files are not identical. Using a binary file viewer shows that they are indeed very similar; just one thing I spotted: The new file begins with EF BF BD EF BF BD EF BF BD EF BF BD instead of the expected CA FE BA BE After that, they're identical for at least a few hundert bytes. As a logical consequence, I get the following error message when trying to load the class form the new file: java.lang.ClassFormatError: Incompatible magic value 4022320623 in class file ch/unibe/scg/doodle/producerTest/GiantTurtle I have no idea where it breaks, and it's quite hard to debug. My unit tests for file read/write are green. Where could the problem be?
upvote count: 2
has comment: http://stackoverflow.com/comment/35021907
has comment: http://stackoverflow.com/comment/35021592
accepted answer: http://stackoverflow.com/a/22941120
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: .class-file
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22941120
tagged with: file-io
has comment: http://stackoverflow.com/comment/35021776
has comment: http://stackoverflow.com/comment/35022375
favorite count: 0
has comment: http://stackoverflow.com/comment/35020930
tagged with: binary
has comment: http://stackoverflow.com/comment/35021273

http://stackoverflow.com/a/22822366
score: 1
downvote count: 0
has body: Your method seems to have problem. public static void printShortestString(ArrayList&lt;String&gt; myArray) { if (myArray.isEmpty()) return; int len = myArray.get(0).length(); int shortestIndex = 0; for (int index = 1; index &lt; myArray.size(); index++) { if (myArray.get(index).length() &lt; myArray.get(index - 1).length()) { len = myArray.get(index).length(); shortestIndex = index; } } System.out.printf("\nShortest string is \"%s\" with length %d", myArray.get(shortestIndex), len); return; }
type: Answer
answers question: http://stackoverflow.com/q/22822204
upvote count: 1

http://stackoverflow.com/a/26807039
has comment: http://stackoverflow.com/comment/64921330
has body: Accessing and manipulating log4j2 over slf4j by code/at runtime: import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.LoggerConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Log4j2OverSlf4jConfigurator { final private static Logger LOGGER = LoggerFactory.getLogger(Log4j2OverSlf4jConfigurator.class); public static void main(final String[] args) { LOGGER.info("Starting"); LoggerContext loggerContext = (LoggerContext) LogManager.getContext(false); Configuration configuration = loggerContext.getConfiguration(); LOGGER.info("Filepath: {}", configuration.getConfigurationSource().getLocation()); // Log4j root logger has no name attribute -> name == "" LoggerConfig rootLoggerConfig = configuration.getLoggerConfig(""); rootLoggerConfig.getAppenders().forEach((name, appender) -> { LOGGER.info("Appender {}: {}", name, appender.getLayout().toString()); // rootLoggerConfig.removeAppender(a.getName()); }); rootLoggerConfig.getAppenderRefs().forEach(ar -> { System.out.println("AppenderReference: " + ar.getRef()); }); // adding appenders configuration.addAppender(null); } } Reference: https://logging.apache.org/log4j/2.x/manual/customconfig.html
answers question: http://stackoverflow.com/q/22866275
downvote count: 2
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/114611352
score: 8
has comment: http://stackoverflow.com/comment/107242001

http://stackoverflow.com/a/22874715
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34907625
type: Answer
has comment: http://stackoverflow.com/comment/34907666
has comment: http://stackoverflow.com/comment/34903202
has comment: http://stackoverflow.com/comment/34903298
upvote count: 1
has body: In public void addCard(Card c), c is a parameter. This means that within the body of the function addCard, you can refer to the value passed to the function by the name c. You call the function addCard with some value (e.g., theDeck[0]), and that value will be used in addCard().
answers question: http://stackoverflow.com/q/22874206

http://stackoverflow.com/a/22855953
has body: I think whats missing is to set the color for the even items. The Problem is that you adapter loads the layout with the white background and changes it for the odd items to grey, but when you scroll down, the views gets reused. What happen is that your views background is already set to grey. just adjust your code to something like that //set background color in odd items LinearLayout groupLayout=(LinearLayout)convertView.findViewById(R.id.groupLinearLayout) if(groupPosition%2==0){ groupLayout.setBackgroundResource(R.color.gray15p); } else { groupLayout.setBackgroundResource(R.color.gray30p); // &lt;-- important part. }
has comment: http://stackoverflow.com/comment/34869010
type: Answer
has comment: http://stackoverflow.com/comment/34868744
has comment: http://stackoverflow.com/comment/34868568
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22855436
has comment: http://stackoverflow.com/comment/34868623
accepted answer of: http://stackoverflow.com/q/22855436
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/35289378
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22952316
has text: Yes, I did debugging.

http://stackoverflow.com/a/56151268
answers question: http://stackoverflow.com/q/22841368
has body: The short answer is your example will be thread-safe, if the variable is declared as volatile, or the getter is declared as synchronized. The reason that your example class A is not thread-safe is that one can create a program using it that doesn't have a "well-formed execution" (see JLS 17.4.7). For instance, consider // in thread #1 int a1 = A.getA(); Thread.sleep(...); int a2 = A.getA(); if (a1 == a2) { System.out.println("no increment"); // in thread #2 A.incrementA(); in the scenario that the increment happens during the sleep. For this execution to be well-formed, there must be a "happens before" (HB) chain between the assignment to a in incrementA called by thread #2, and the subsequent read of a in getA called by thread #1. If the two threads synchronize using the same lock object, then there is a HB between one thread releasing the lock and a second thread acquiring the lock. So we get this: thread #2 acquires lock --HB--&gt; thread #2 reads a --HB--&gt; thread #2 writes a --HB--&gt; thread #2 releases lock --HB--&gt; thread #1 acquires lock --HB--&gt; thread #1 reads a If two threads share a a volatile variable, there is a HB between any write and any subsequent read (without an intervening write). So we typically get this: thread #2 acquires lock --HB--&gt; thread #2 reads a --HB--&gt; thread #2 writes a --HB--&gt; thread #1 reads a Note that incrementA needs to be synchronized to avoid race conditions with other threads calling incrementA. If neither of the above is true, we get this: thread #2 acquires lock --HB--&gt; thread #2 reads a --HB--&gt; thread #2 writes a // No HB!! thread #1 reads a Since there is no HB between the write by thread #2 and the subsequent read by thread #1, the JLS does not guarantee that the latter will see the value written by the former. Note that this is a simplified version of the rules. For the complete version, you need to read all of JLS Chapter 17.
score: 0
type: Answer

http://stackoverflow.com/q/22912887
has title: how to add a string to a string array with comma
type: UnansweredQuestion
has body: I have created a web application, in which the user input data in JSP table and then store data in database when user clicks on Save. In this application, I have concated all the columns data in one row and stored in array which is posted to INSERT page to insert data into DataBase. There I split all the elements in array with the ","(comma). The problem I got here is, when user enters a string with comma in one single column then at theme time of splitting this array, the array size increases to actual size and getting ArrayIndexOutOfBoundsException.
has answer: http://stackoverflow.com/a/22912908
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22913150
tagged with: jsp
score: 0

http://stackoverflow.com/comment/35031544
comment on: http://stackoverflow.com/q/22944821
has text: can't, i'm working with standard classes :P
score: 0
type: QuestionComment
type: Comment

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/22950249

jfilechooser
tags question: http://stackoverflow.com/q/22824027
tags question: http://stackoverflow.com/q/22872743
tags question: http://stackoverflow.com/q/22873417
tags question: http://stackoverflow.com/q/22816564
tag name: jfilechooser
tags question: http://stackoverflow.com/q/22892801
type: Tag

http://stackoverflow.com/q/22844048
has title: Some questions regarding architecture/design to this usecase?
linked to: http://stackoverflow.com/q/17336036
type: Question
answer count: 2
has body: My application needs to work as middleware where it has got orders(in form of xml) from various customers which contains the supplier id. Once it get the order, it needs to send order request to different suppliers in the form of xml.i am double minded about three aspects of it. Here they are:- Questions: What i am planning at high level is as soon as request come, put it on jms queue.(Now i am not sure should i create queue for each supplier or one queue should be sufficient. I think one queue will be sufficient. as maintaining large number of queues will be overhead.). Advantage of maintaining separate queue per supplier is message can be processed faster as there will be separate producer on each queue. Before putting the object on queue i need to do some business validations. Also the structure of input xml i am receiving and output xml i need to send to supplier is different. For this i am planning to convert the input xml to java object then put on queue so that validation can be done with ease at consumer side. Another thought is dont convert the xml into java object, just get all elements value thru xpath/xstream api and validate them and put xml string as it is on queue because. Then at consumer side convert xml to java object then to different xml format. Is there a way of doing it? Now my requirement is consumer on queue process the messages on queue after every 5 hours and send the xml request to suppliers. I am planning to use quartz scheduler here which will pick the job one by one and send to corresponding supplier based on supplierId. Here is my question is if my job pick the message one by one and then send it to supplier. it will be too slow . I am planning to handle it where quartz job create ThreadPool with size of say ten threads at time which concurrently process the messages from queue(So here will be multiple consumers on queue. I think thats not valid for queue. Do i need topic here instead of queue?). Is second approach is better or there i…
possible better answer: http://stackoverflow.com/a/22845331
has comment: http://stackoverflow.com/comment/34847258
score: 0
has answer: http://stackoverflow.com/a/22845423
accepted answer: http://stackoverflow.com/a/22845423
tagged with: jms
tagged with: architecture
has comment: http://stackoverflow.com/comment/34847059
has answer: http://stackoverflow.com/a/22845331
has comment: http://stackoverflow.com/comment/34847333
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34848164

http://stackoverflow.com/comment/34866595
type: Comment
comment on: http://stackoverflow.com/a/22854844
score: 3
has text: What is there to elaborate? How about you trying to implement what I suggest?
type: AnswerComment

http://stackoverflow.com/comment/34988471
comment on: http://stackoverflow.com/q/22921485
has text: We need more code, I think that your interfaces are not registred to the fragments. Are you sure, that they are fired ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34957049
has text: `f` is for `float`, which is the same as `double`, with half precision and therefor needs only half of the space. By writing `f` after a number you say, that it is a `float`.
comment on: http://stackoverflow.com/a/22855342
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22889455
has comment: http://stackoverflow.com/comment/66728410
score: 0
has comment: http://stackoverflow.com/comment/34929564
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I'm writing a java program for class that reads in from a txt file. I placed the text file in the package called Assignment3pckg and use a scanner like so: Scanner s = new Scanner( new File("./src/Assignment3pckg/studentdata.txt") ); But it just keeps giving me java.io.FileNotFoundException: .\src\Assignment3pckg\studentdata.txt (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.util.Scanner.&lt;init&gt;(Unknown Source) at Assignment3pckg.TestHW3.readStudentDataFromFile(TestHW3.java:25) at Assignment3pckg.TestHW3.main(TestHW3.java:14) Any insight would be greatly appreciated!
has comment: http://stackoverflow.com/comment/34929153
upvote count: 1
has title: Java can't find my file even though I'm pretty sure I have the directory right
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22889493
tagged with: java
has comment: http://stackoverflow.com/comment/34929245

http://stackoverflow.com/comment/34945744
type: Comment
has text: All that does is find a position for `"a"` in both lists. Why do you think this has anything to do with what the iterator's doing?
comment on: http://stackoverflow.com/a/22884779
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35010902
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22923957
has text: The lambda has been transformed into an anonymous inner class - that is functionally equivalent.

http://stackoverflow.com/comment/34930664
comment on: http://stackoverflow.com/q/22886097
score: 0
has text: Did you check the contents of the C:\Users\Administrator\Desktop\TestResults folder? Does it contain the test results xml files, or is there maybe a subdirectory structure? Do the xml files look ok? Also could you run ant -v to perhaps get more logging info?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35015300
type: Comment
comment on: http://stackoverflow.com/a/22935471
has text: @Joffrey I have one more doubt .If row.put(md.getColumnName(i),rs.getObject(i)); how it will be stored in Hashmap? Example My table has only two columns and have n rows .Column 1 =some string and column2= String .If I use row.put(md.getColumnName(i),rs.getObject(i)); what will be there in the key and value inside the Hashmap.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34897299
has text: Thanks! Yeah I guess the examples I looked at had different syntax for custom acquire and release mechanisms
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22871924

http://stackoverflow.com/q/22859453
answer count: 9
accepted answer: http://stackoverflow.com/a/38789604
tagged with: text
has answer: http://stackoverflow.com/a/43388225
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34874852
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/34874312
has answer: http://stackoverflow.com/a/38615619
has answer: http://stackoverflow.com/a/22859819
has answer: http://stackoverflow.com/a/22859893
possible better answer: http://stackoverflow.com/a/22859960
has body: I am wondering what is the easiest (and simplest) way to write a text file in Java. Please be simple, because I am a beginner :D I searched the web and found this code, but I understand 50% of it. import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class WriteToFileExample { public static void main(String[] args) { try { String content = "This is the content to write into file"; File file = new File("C:/Users/Geroge/SkyDrive/Documents/inputFile.txt"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close(); System.out.println("Done"); } catch (IOException e) { e.printStackTrace(); } } }
has answer: http://stackoverflow.com/a/38789604
has answer: http://stackoverflow.com/a/22859960
has answer: http://stackoverflow.com/a/27004508
has answer: http://stackoverflow.com/a/42072858
score: 55
has answer: http://stackoverflow.com/a/61784854
has title: What is the simplest way to write a text file in Java?
upvote count: 55
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/22879721
has body: I am working on app that calculate time when specific app run, to save ram, I want to stop some of the threads by using check box. i want a command when I press the check box the thread stops even "if condition" is right" the if conditon of detecting app : if (MainActivity.tgbutton.isChecked()) { if (packageName.equals("com.facebook.katana")) { if (f==1) { } else { // Toast.makeText(getApplicationContext(),"fb on", Toast.LENGTH_SHORT).show(); f=1; facebook = true; startTimef = SystemClock.uptimeMillis(); customHandlerf.postDelayed(updateTimerThreadfacebook, 0); } } else { if(f==1) { //Toast.makeText(getApplicationContext(),"fb off", Toast.LENGTH_SHORT).show(); facebook = false; timeSwapBufff += timeInMillisecondsf; customHandlerf.removeCallbacks(updateTimerThreadfacebook); f=2; } } } the check box : blabla.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (((CheckBox) v).isChecked()) { // what to write here to disable thread??? } } }); the thread itself : private Runnable updateTimerThreadfacebook = new Runnable() { public void run() { if (facebook = true) { timeInMillisecondsf = SystemClock.uptimeMillis() - startTimef; updatedTimef = timeSwapBufff + timeInMillisecondsf; int secsf = (int) (updatedTimef / 1000); int minsf = secsf / 60; secsf = secsf % 60; MainActivity.facebook.setText("" + minsf + ":" + String.format("%02d", secsf)); customHandlerf.postDelayed(this, 0); } } };
tagged with: java
has answer: http://stackoverflow.com/a/22879916
type: Question
has comment: http://stackoverflow.com/comment/34911747
score: 0
answer count: 2
has title: disable a thread on click
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
has answer: http://stackoverflow.com/a/22880038

http://stackoverflow.com/comment/34807524
score: 1
has text: i am not using an applet. i am using html page to call web service
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22821773

http://stackoverflow.com/a/22821374
upvote count: 4
has comment: http://stackoverflow.com/comment/34806758
has comment: http://stackoverflow.com/comment/34808167
has comment: http://stackoverflow.com/comment/34806373
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34806722
has comment: http://stackoverflow.com/comment/34806656
has comment: http://stackoverflow.com/comment/34807769
type: Answer
has body: A better approach would be to generify the static method: static &lt;T extends Base&gt; T create(Class&lt;T&gt; type){ // create concrete instance of type T and return it } so now the create method is parameterized by the actual concrete type Class object. You can use type to create the appropriate sub-type, either via reflection or using nested if statements. Using generics has the advantage of giving you strong type safety for free, so you can avoid unchecked casts and go home after work with no worries. EDIT: as an example if you had a no-arg constructor in each sub-class you could implement the above as: return type.newInstance(); EDIT 2: To sum up the discussion, if the factory can't take the type or the logic to create the object depends in a non trivial way on the value of the argument, the only option is the following: static Base create(String someParameter){ // create the concrete class and return it } And the client code will look like: Base b = create("myArgument"); if(b instanceof SomeDerived){ SomeDerived d = (SomeDerived) b; // use d } else if(b instanceof OtherDerived){ // you get the idea } Not ideal but there's no way to generify the create method without an instance of Class&lt;? extends Base&gt;.
has comment: http://stackoverflow.com/comment/34806454
answers question: http://stackoverflow.com/q/22821258
has comment: http://stackoverflow.com/comment/34809326
has comment: http://stackoverflow.com/comment/34806577
has comment: http://stackoverflow.com/comment/34806811
has comment: http://stackoverflow.com/comment/34806925
accepted answer of: http://stackoverflow.com/q/22821258
has comment: http://stackoverflow.com/comment/34809385
has comment: http://stackoverflow.com/comment/34807862
has comment: http://stackoverflow.com/comment/34806544
score: 4
has comment: http://stackoverflow.com/comment/34806598

http://stackoverflow.com/a/22833147
score: 6
has comment: http://stackoverflow.com/comment/34827368
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34848462
accepted answer of: http://stackoverflow.com/q/22832936
upvote count: 6
has body: The name of the service property is "component.name", not "name". If you do this, it will work: getServiceReferences(java.util.Comparator.class.getName(),"(component.name=sample.component)");
answers question: http://stackoverflow.com/q/22832936

http://stackoverflow.com/a/23020892
has comment: http://stackoverflow.com/comment/35169212
answers question: http://stackoverflow.com/q/22875437
type: Answer
has body: Add this ImageAware into your project: public class BgImageAware implements ImageAware { public static final String WARN_CANT_SET_DRAWABLE = "Can't set a drawable into view. You should call ImageLoader on UI thread for it."; public static final String WARN_CANT_SET_BITMAP = "Can't set a bitmap into view. You should call ImageLoader on UI thread for it."; protected Reference&lt;View&gt; viewRef; protected boolean checkActualViewSize; public BgImageAware(View view) { this(view, true); } public BgImageAware(View view, boolean checkActualViewSize) { this.viewRef = new WeakReference&lt;View&gt;(view); this.checkActualViewSize = checkActualViewSize; } @Override public int getWidth() { View view = viewRef.get(); if (view != null) { final ViewGroup.LayoutParams params = view.getLayoutParams(); int width = 0; if (checkActualViewSize &amp;&amp; params != null &amp;&amp; params.width != ViewGroup.LayoutParams.WRAP_CONTENT) { width = view.getWidth(); // Get actual image width } if (width &lt;= 0 &amp;&amp; params != null) width = params.width; // Get layout width parameter return width; } return 0; } @Override public int getHeight() { View view = viewRef.get(); if (view != null) { final ViewGroup.LayoutParams params = view.getLayoutParams(); int height = 0; if (checkActualViewSize &amp;&amp; params != null &amp;&amp; params.height != ViewGroup.LayoutParams.WRAP_CONTENT) { height = view.getHeight(); // Get actual image height } if (height &lt;= 0 &amp;&amp; params != null) height = params.height; // Get layout height parameter return height; } return 0; } @Override public ViewScaleType getScaleType() { return ViewScaleType.CROP; } @Override public View getWrappedView() { return viewRef.get(); } @Override public boolean isCollected() { return viewRef.get() == null; } @Override public int getId() { View view = viewRef.get(); return view == null ? super.hashCode() : view.hashCode(); } @Override public boolean setImageDrawable(Drawable drawable) { if (Looper.myLooper() == Looper.get…
upvote count: 2
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/35172011

http://stackoverflow.com/q/22818430
has body: I have a tomcat7.0 running in a remote desktop machine say 204.34.34.45. When I log into the remote desktop and try "http://localhost:8080" it is working fine.However http://204.34.34.45:8080 is not working. I am able to ping 204.34.34.45 from outside the remote desktop machine. Do you know how can I access tomcat outside the remote desktop machine.
score: 0
has comment: http://stackoverflow.com/comment/34802043
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22818527
accepted answer: http://stackoverflow.com/a/22818527
tagged with: java
has title: Tomcat 7.0 issue
linked to: http://stackoverflow.com/q/18617
type: Question
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/34802507

http://stackoverflow.com/a/22913270
has body: This is not possible. The java code is only executed when you refresh/load the page. Once the page is rendered, only client-side code can be executed.
type: Answer
accepted answer of: http://stackoverflow.com/q/22913010
answers question: http://stackoverflow.com/q/22913010
upvote count: 3
downvote count: 0
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/35012226
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22935705
has text: While good practice, it shouldn't make a difference and is better left as a comment.
score: 0

http://stackoverflow.com/q/22942297
tagged with: java
has answer: http://stackoverflow.com/a/22943571
score: 2
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22943571
favorite count: 0
tagged with: smt
has title: Values of a set in a model found by Z3
has body: I have a similar question to the one here : How to print a Z3 Set object? from which I couldn't figure how to print the values of a set in a model. I have one enumeration sort (code in Java): EnumSort rSort = ctx.mkEnumSort(ctx.mkSymbol("res"), ctx.mkSymbol("res1")); from which I create a set sort: SetSort rSet = ctx.mkSetSort(rSort) By using this set sort, I create a Z3 constant rID and define a simple membership expression: BoolExpr c1 = (BoolExpr)ctx.mkSetMembership(rSort.getConsts()[0], rID); When c1 is satisfiable, I would like to see one possible value for rID in the model. If I try with a const interpretation (i.e. m.getConstInterp(e) where e is a FuncDecl from the model), I get : "Non-zero arity functions and arrays have FunctionInterpretations as a model. Use FuncInterp.". When I try with func interpretation (i.e. m.getFuncInterp(e)), I get "Argument was not an array constant". Am I doing something wrong here? Isn't it possible to print the values of set object? Alternatively, is there a better way of representing a variable that may contain multiple values from a sort?
linked to: http://stackoverflow.com/q/15935051
upvote count: 2
type: Question
tagged with: z3
type: AnsweredQuestion

http://stackoverflow.com/comment/34868022
comment on: http://stackoverflow.com/q/22855249
has text: @Pokuri sorry for 'dynamic' word. It has been removed. You suggesting me to store XML file for evry job on hard drive. Won't that consume lots of disk space when I run program for 5-6 hours? By 'anyone should be able to read ' , I mean that at the same time simulator.java reads it, other program should be able to read. Its not that other program will read later.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39621656
comment on: http://stackoverflow.com/a/22892991
score: 0
type: Comment
has text: Same issue as the original poster. My filter gives me a 404 when activated.
type: AnswerComment

http://stackoverflow.com/comment/35000602
has text: Would that be something as simple as: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { submit = (Button) getActivity().findViewById(R.id.button1);
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22928491
score: 0

http://stackoverflow.com/a/22893519
has body: You need to create a new List of preferences for each student like this : List&lt;List&lt;String&gt;&gt; preferences1 = new ArrayList&lt;List&lt;String&gt;&gt;(); List&lt;String&gt; preferences1 = new ArrayList&lt;String&gt;(); List&lt;String&gt; preferences2 = new ArrayList&lt;String&gt;(); // add first student preferences.clear(); preferences1.clear(); preferences2.clear(); preferences1.add("Company1"); preferences1.add("Company3"); preferences2.add("Company2"); preferences2.add("Company4"); preferences.add(preferences1); preferences.add(preferences2); students.add(new Student("Michiel", preferences)); // add second student List&lt;List&lt;String&gt;&gt; secondPreferences = new ArrayList&lt;List&lt;String&gt;&gt;(); List&lt;String&gt; secondPreferences2 = new ArrayList&lt;String&gt;(); List&lt;String&gt; secondPreferences3 = new ArrayList&lt;String&gt;(); // preferences1.clear(); preferences2.clear(); preferences3.clear(); // you don't need to clear those ! as they are new lists secondPreferences2.add("Company5"); secondPreferences2.add("Company7"); secondPreferences3.add("Company6"); secondPreferences3.add("Company8"); secondPreferences.add(preferences1); secondPreferences.add(preferences2); students.add(new Student("William", secondPreferences)); System.out.println(students.get(0).choice); System.out.println(students.get(1).choice); Good luck.
has comment: http://stackoverflow.com/comment/34937394
has comment: http://stackoverflow.com/comment/34936589
answers question: http://stackoverflow.com/q/22893420
type: Answer
has comment: http://stackoverflow.com/comment/34936378
score: 0

http://stackoverflow.com/q/22923266
has title: Random generator does not work it always shows 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34990908
tagged with: java
has comment: http://stackoverflow.com/comment/34990678
has body: import java.util.Random; public class PouAbilites { protected int Health; public int getHealth(){ return this.Health; } public void setHealth(final int Health){ final Random random = new Random(); final int randomInt = random.nextInt(100)+1; this.Health=randomInt; } PouAbilites(){ this.Eletero=getEletero(); } public void onscreen(){ System.out.println("Health: "+ this.Health); } } The main function is included in an other class: package KotelezoProgram; public class Main { public static void main(final String[] args) { final PouAbilites Pou = new PouAbilites(); Pou.onscreen(); } }
type: Question
has answer: http://stackoverflow.com/a/22923348
has comment: http://stackoverflow.com/comment/34990752
has comment: http://stackoverflow.com/comment/34990650
score: 0

http://stackoverflow.com/q/22896401
tagged with: filewriter
has title: My array list to .txt file program is giving me several errors
tagged with: swing
has comment: http://stackoverflow.com/comment/34941625
type: Question
has comment: http://stackoverflow.com/comment/34942761
has comment: http://stackoverflow.com/comment/34942126
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/22896575
answer count: 2
has answer: http://stackoverflow.com/a/22896534
tagged with: string
has comment: http://stackoverflow.com/comment/34941663
type: UnansweredQuestion
has body: I have an inventory application that sets a list of strings based on user input. Than it is supposed to export the strings to a .txt file. I have never used FileWriter before, and am very much stuck. Any help is appreciated. Here is all the relevant code: The three lines near the end that have 'writer.' in them are giving me a unreported exception IOException; must be caught or declared to be thrown. import java.util.*; import java.io.FileWriter; public class mVentory extends javax.swing.JFrame { /** * Creates new form mVentory */ public mVentory() { initComponents(); } public class ProductInfo { String name; String des; String ID; String num; public ProductInfo(String name, String des, String ID, String num) { this.name = name; this.des = des; this.ID = ID; this.num = num; } } public static void Inventory() { } //creat Array ArrayList&lt;String&gt; Inventory = new ArrayList&lt;String&gt;(); private void AddGoActionPerformed(java.awt.event.ActionEvent evt) { // Add Item String Name, Description, Identification, Number, Item; Name = NameIn.getText(); Description = DesIn.getText(); Identification = IDIn.getText(); Number = NumIn.getText(); Item = "" + Name + "," + Description + "," + Identification + "," + Number + "."; Inventory.add(new String(Item)); NameIn.setText(""); DesIn.setText(""); IDIn.setText(""); NumIn.setText(""); } private void ExportGoActionPerformed(java.awt.event.ActionEvent evt) { FileWriter writer; writer = new FileWriter("Inventory.txt"); for (String str : Inventory) { writer.write(str); } writer.close(); } }
tagged with: java

http://stackoverflow.com/comment/35056686
score: 0
type: AnswerComment
has text: It might be better to post as a new question.
type: Comment
comment on: http://stackoverflow.com/a/22960088

http://stackoverflow.com/a/22837132
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22836757
has body: It seems that solr container was not initialized. Try with this code to initialize the container: String solrDir = "C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/solr/new_core/"; //this solr Directory is home and specified core. //solrParams.set("qt", "/dataimport"); //solrParams.set("command", "full-import"); //above two line for importing data one time. CoreContainer container = new CoreContainer(solrDir); container.load(); EmbeddedSolrServer server = new EmbeddedSolrServer(container, "collection1"); ModifiableSolrParams solrParams = new ModifiableSolrParams(); solrParams.add(CommonParams.Q, "*:*"); QueryResponse queryResponse = server.query(solrParams); for (SolrDocument document : queryResponse.getResults()) { System.out.println(document); }
accepted answer of: http://stackoverflow.com/q/22836757
has comment: http://stackoverflow.com/comment/34835609
type: AcceptedAnswer

http://stackoverflow.com/comment/34914775
comment on: http://stackoverflow.com/a/22881434
has text: Thank you. And where could I read more about creating my own ToDoubleFunction()? For example, for calculating variance.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22851788
has comment: http://stackoverflow.com/comment/35027386
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22842780
accepted answer of: http://stackoverflow.com/q/22842780
type: Answer
has comment: http://stackoverflow.com/comment/34893246
upvote count: 3
has comment: http://stackoverflow.com/comment/34892532
has comment: http://stackoverflow.com/comment/34877726
has body: Answer Try a lower max heap (-Xmx) value, such as -Xmx900m or -Xmx800m and see if this solves the problem. From my experience, Jenkins honors your ANT_OPTS environment variable and does not mess with it. I use Jenkins Freestyle Jobs that launch Ant personally and I've always set ANT_OPTS, MAVEN_OPTS, ... separate from Jenkins and it has never changed anything. Make Better yet, start with a much lower value like -Xmx512m (I would use ANT_OPTS, which Ant uses for this and not bother with JAVA_OPTS). If it still fails to initialize, OK, then maybe I'll entertain that Jenkins is doing something. If not, there's your answer. At the root, I believe this is the same problem as the duplicate question you linked, it just reproduces in more limited circumstances. More details below. Background Just yesterday, on a coworker's machine I saw -Xmx1024m fail in a standard command window with the same message with 32-bit Java. Just because it works in one situation does not mean it will always work. On Windows, 2GB max address space per 32-bit process severely limits the maximum heap size you can set in Java since Java requires that the entire object heap be allocated in one contiguous block. Especially in modern versions of Windows that use ASLR (Address Space Layout Randomization), you simply can't be guaranteed large heap sizes for 32-bit processes...even 1024m can sometimes be too large since in Java the heap must be contiguous. Picture a horizontal line from 0 to 2GB, and then a [1GB] chunk taking up 50% of the width. Now insert 50 random DLLs into that 2GB horizontal line in random locations...now try to fit your [1GB] chunk without hitting a dot. Not exact, here's my poor man's diagram of the address space: 0 [________________________________________] 2GB _ is unallocated, available, | is occupied Now with DLLs: 0 [__|_______|___________________|___|_____] 2GB You need to fit this (including edges) into that address space: [__________________] Maybe it barely squeeks in...no…
score: 3
has comment: http://stackoverflow.com/comment/34887016
has comment: http://stackoverflow.com/comment/34892220
has comment: http://stackoverflow.com/comment/35013234

http://stackoverflow.com/comment/34855974
comment on: http://stackoverflow.com/a/22848943
score: 0
type: AnswerComment
type: Comment
has text: yea, this just returns 0s

priority-queue
tags question: http://stackoverflow.com/q/22928255
tags question: http://stackoverflow.com/q/22880355
tag name: priority-queue
type: Tag
tags question: http://stackoverflow.com/q/22944512
tags question: http://stackoverflow.com/q/22965652

http://stackoverflow.com/comment/34881497
score: 0
comment on: http://stackoverflow.com/q/22863165
type: Comment
type: QuestionComment
has text: @Priyesh But suppose I didn't cancel and I refresh then also control goes to onSubmit(). Sorry ajaxMethod created confusion.

http://stackoverflow.com/comment/35034693
comment on: http://stackoverflow.com/q/22947588
has text: What test cases are you using? Also have you stepped through it and found any problem areas?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22913687
has comment: http://stackoverflow.com/comment/34972876
tagged with: excel
answer count: 0
has comment: http://stackoverflow.com/comment/34983080
tagged with: java
type: Question
score: 0
has title: apache poi and adobe poi. Are they different projects?
has body: In our project for parsing excel files use poi. I noticed that in different subprojects uses different poi. In one part - apache poi and in another part - adobe poi. As I understood its resolves one task - parsing excel files. But are it absolutely independent projects or not? in project I see this pom.xml snippet ... com.adobe.granite com.adobe.granite.poi provided ... Therefore I asked this question.
has comment: http://stackoverflow.com/comment/34988537
tagged with: apache-poi
type: UnansweredQuestion

http://stackoverflow.com/comment/121569503
score: 0
type: Comment
has text: Hey guys, just came across this issue. I think that this type of project would be an amazing idea. We could have it work via annotations on both Entities and Service methods - which then generate .proto files with all of the types, messages and RPCs that can be extracted from these annotations. It's very much like SPQR (except that's for GraphQL) - but follows the exact same principle right? It takes our Java annotations and generates a .graphqls schema with the queries, types, mutations etc...
comment on: http://stackoverflow.com/a/22992297
type: AnswerComment

http://stackoverflow.com/q/22923297
downvote count: 1
has comment: http://stackoverflow.com/comment/34990922
upvote count: 4
has answer: http://stackoverflow.com/a/22923496
tagged with: race-condition
has title: Can Synchronized Methods Have Race Conditions? [Example]
has answer: http://stackoverflow.com/a/22923503
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22923389
has answer: http://stackoverflow.com/a/22923432
accepted answer: http://stackoverflow.com/a/22923496
favorite count: 0
answer count: 6
type: Question
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/22923403
has answer: http://stackoverflow.com/a/22923403
has answer: http://stackoverflow.com/a/71600215
has body: I am learning about synchronized methods as a means of preventing race conditions and unwanted behavior in Java. I was presented with the following example, and told the race condition is quite subtle: public class Messages { private String message = null; private int count = 2; // invariant 0 &lt;= count &amp;&amp; count &lt;= 2 public synchronized void put(String message) { while( count &lt; 2 ) this.wait(); this.message = message; this.count = 0; this.notifyAll(); } public synchronized String getMessage() { while( this.count == 2 ) this.wait(); String result = this.message; this.count += 1; this.notifyAll(); return result; } } Subtle or not, I think I have a fundamental misunderstanding of what synchronized methods do. I was under the impression they restrict access to threads through use of a lock token (or similar), and thus can never race. How, then, does this example have a race condition, if its methods are synchronized? Can anyone help clarify?
tagged with: java

http://stackoverflow.com/comment/34998603
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22927492
has text: If the array is only 10 spots long, the program might try to put something into the 11th spot of the array. This would cause an `ArrayIndexOutOfBoundsException`

http://stackoverflow.com/a/22913026
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22912859
has body: Take a for loop and build options like below " "+hm.getValue()+" "; HashMap doc.

http://stackoverflow.com/comment/34920344
score: 0
comment on: http://stackoverflow.com/q/22883794
type: Comment
type: QuestionComment
has text: Using a whole JComponent/JPanel just to represent a single oval is wasteful. **A JComponent is no "sprite"**. However, you are calling `add(canvas)` - where is this located? That is, on which component do you call `add`? Does it have a LayoutManager? You are not setting the size and/or bounds of the `FireworksDisplay` instances....

http://stackoverflow.com/q/22847001
favorite count: 0
accepted answer: http://stackoverflow.com/a/22847251
type: AnsweredQuestion
tagged with: reflection
has title: Obtain value of a field in an "owning" class using reflection
score: 1
tagged with: java
has body: Is there anyway to obtain an instance of a class called in another class? For example, if Foo class has an instance of a Bar class and a Clazz class, is there anyway to obtain the instance of the Bar class through the Clazz class using reflection? public class Foo{ Bar b = new Bar(); Clazz c = new Clazz(); } public class Bar { int i = 3; } public class Clazz { //Code to get the instance of Bar running in Foo using Reflection }
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/5067987
has answer: http://stackoverflow.com/a/22847251
downvote count: 0
answer count: 1

http://stackoverflow.com/q/22904640
has comment: http://stackoverflow.com/comment/34956465
has title: Throwable getCause returns null
upvote count: 6
has comment: http://stackoverflow.com/comment/34956542
has answer: http://stackoverflow.com/a/22904703
score: 6
accepted answer: http://stackoverflow.com/a/22904703
possible better answer: http://stackoverflow.com/a/73336374
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/73336374
tagged with: throwable
tagged with: java
has comment: http://stackoverflow.com/comment/34956514
type: Question
has comment: http://stackoverflow.com/comment/34956562
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34956668
has body: I am catching a Throwable error. catch (Throwable t){ System.out.println(t.getCause().getMessage()); } When I put a breakpoint on a line System.out., and hover over (Eclipse) the t variable, Eclipse shows me the cause: java.lang.NoClassDefFoundError: myclass But when I release the breakpoint I am getting null for t.getCause(). Why does it happen? How can I get the cause string. UPDATE: Same happens if I catch catch (NoClassDefFoundError e){ }

http://stackoverflow.com/a/22966799
type: Answer
has body: Try: boolean foundNotNull = false; // has a non-null value been found already? for(int i = array.length - 1 ; i &gt;= 0 ; --i) { if(array[i] == null &amp;&amp; foundNotNull ) { return true; // yes there are null values } if(array[i] != null) { foundNotNull = true; } }
answers question: http://stackoverflow.com/q/22966521
score: 0

http://stackoverflow.com/a/22827732
downvote count: 1
has comment: http://stackoverflow.com/comment/34817486
has body: You can loop through the element of array and add them. To find the sum: private int sum (List&lt;Integer&gt; array) { int sum =0; for(Integer i: array) { sum = sum + i; } return sum; } I do not understand the second part of the question. When you say longest String. I think you mean largest number. And if you mean largest number from the list you can use Collections.max(array);
score: 0
accepted answer of: http://stackoverflow.com/q/22827698
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22827698
has comment: http://stackoverflow.com/comment/34817758
has comment: http://stackoverflow.com/comment/34817622
has comment: http://stackoverflow.com/comment/34817571
type: Answer
has comment: http://stackoverflow.com/comment/34817514
has comment: http://stackoverflow.com/comment/34817445
upvote count: 1

http://stackoverflow.com/a/22920157
has comment: http://stackoverflow.com/comment/106647371
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22919329
has body: As per the above scenario. Since request will hold the session object for sure. You can try this :- &lt;p style="display:block" &gt; &lt;%(String)request.getSession().getAttribute("allEmails"); %&gt; &lt;/p&gt;
score: 1
downvote count: 0

http://stackoverflow.com/a/22906781
has body: Its not the problem of MD5 hash generator MD5 hash for bb27aee4 : 46d5acfcd281bca9f1df7c9e38d50576 &amp; MD5 hash for BB27AEE4 : b767fe33172ec6cbea569810ee6cfc05 So basically in .NET you are generating MD5 hash for BB27AEE4 instead of bb27aee4 So check for the error in your code Good Luck
upvote count: 5
accepted answer of: http://stackoverflow.com/q/22906588
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22906588
downvote count: 0
score: 5
type: Answer

http://stackoverflow.com/comment/34983421
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22919629
has text: Oh, of course! I got it. I think I was missing the obvious here. I feel kind of ashame for having posted this... Too much stress I guess. Anyway, thank you! Feel free to make an answer anyway so I can mark this as accepted.

http://stackoverflow.com/comment/35054262
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22956466
type: Comment
has text: Just a shame all this is good stuff is being thrown under the wheels of the JSON juggernaut, which is worse in almost every way

http://stackoverflow.com/a/22903547
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22903465
has body: Use StringUtils.isBlank() which checks for null or empty string. visit http://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html

http://stackoverflow.com/a/23456832
score: 1
answers question: http://stackoverflow.com/q/22961244
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22961244
has body: You do not control the JDK classes, but your own code. So why not intercept method execution instead of call? pointcut abcCall() : execution(@Abc * *(..));
type: Answer
downvote count: 0

http://stackoverflow.com/comment/35007368
type: Comment
comment on: http://stackoverflow.com/a/22932038
has text: Do you know why there is error : NoClassDefFoundError
score: 0
type: AnswerComment

http://stackoverflow.com/q/22926372
has comment: http://stackoverflow.com/comment/34999572
has comment: http://stackoverflow.com/comment/34999650
favorite count: 0
tagged with: crc32
answer count: 0
type: UnansweredQuestion
has body: I need to calculate the CRC32 checksum in my iOS app, and found the post for CRC32 calculation here, https://stackoverflow.com/a/14533955/691626. The image is read from UIImagePickerController(sent the image file to email first, then used iPhone to read the email and saved it to camera roll, then used UIImagePickerController to open the file) CGDataProviderRef provider = CGImageGetDataProvider(image.CGImage); NSData* data = (id)CFBridgingRelease(CGDataProviderCopyData(provider)); uint32_t result = crc32(0, data.bytes, data.length); However, the result does not match outputs(CRC32 or CRC32B) this website https://defuse.ca/checksums.htm generates. With the same image file, I tried to verify it on Java // fileName is the path to the file on local drive, for example, /Users/myName/Documents/myimage.jpg on Mac Path path = Paths.get(fileName); byte[] data = Files.readAllBytes(path); CRC32 checksum = new CRC32(); checksum.update(data, 0, data.length); result = checksum.getValue(); At least the result can match the CRC32B that the verification website generates. Do I use the library incorrectly in iOS? Would someone please advise? UPDATE 1 Did another experiment obtain a raw data from captureSession NSData *rawData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer]; convert the raw data to image UIImage *originalImage = [[UIImage alloc] initWithData:rawData]; convert the image to JPEG representation (required by the server I am working on) NSData *jpegData = UIImageJPEGRepresentation(image, 1.0); Compute CRC32 checksum for the NSData jpegData long long checksum1 = crc32(0, jpegData.bytes, jpegData.length); save the NSData jpegData to Documents folder, reload it, compute its checksum [jpegData writeToFile:filePath atomically:YES]; NSData *jpegDataFromDocuments = [NSData dataWithContentsOfFile:filePath]; long long checksum2 = crc32(0, jpegDataFromDocuments.bytes, jpegDataFromDocuments.length); reload the data with file manager, compute its chec…
score: 4
tagged with: java
has title: CRC32 calculation on Java and iOS
type: Question
upvote count: 4
downvote count: 0
tagged with: ios
has comment: http://stackoverflow.com/comment/34999913
linked to: http://stackoverflow.com/q/4115059

http://stackoverflow.com/q/22957665
tagged with: java
tagged with: jboss
type: Question
tagged with: jsf-2
score: 0
has body: I have a simple code File Upload in java and it works fine. The problem is when I upload a file name with accent (like : é à ...) it doesn't work Java code public void upload() { if(file != null) { System.out.println(file.getFileName()); } } XHTML code &lt;h:form enctype="multipart/form-data"&gt; &lt;p:messages showDetail="true"/&gt; &lt;p:fileUpload value="#{fileUploadController.file}" mode="simple"/&gt; &lt;p:commandButton value="Submit" ajax="false" actionListener="#{fileUploadController.upload}"/&gt; &lt;/h:form&gt; Result: INFO [stdout] (http-localhost/127.0.0.1:8080-2) C:\Users\test\dÃ©tail 0120.xlsx
has comment: http://stackoverflow.com/comment/35052042
has title: How can I upload file with special word?
type: UnansweredQuestion
answer count: 0
tagged with: primefaces
has comment: http://stackoverflow.com/comment/35051621

http://stackoverflow.com/q/22923505
downvote count: 0
has comment: http://stackoverflow.com/comment/34994842
favorite count: 0
has title: Excluding extrema from HashSet with a Stream
answer count: 3
possible better answer: http://stackoverflow.com/a/22926264
accepted answer: http://stackoverflow.com/a/22923576
has answer: http://stackoverflow.com/a/22926264
has answer: http://stackoverflow.com/a/22925701
score: 4
tagged with: java-8
type: AnsweredQuestion
tagged with: performance
tagged with: java-stream
tagged with: java
has body: I've been experimenting with Java 8 streams, is this is best way to remove the min and max scores. private final Set&lt;MatchScore&gt; scores = new HashSet&lt;&gt;(10); . . . public double OPR() { return scores.stream() .mapToDouble(MatchScore::getScore) .filter((num) -&gt; { //Exclude min and max score return num != scores.stream() .mapToDouble(MatchScore::getScore) .max().getAsDouble() &amp;&amp; num != scores.stream() .mapToDouble(MatchScore::getScore) .min().getAsDouble(); }) .average().getAsDouble(); }
has answer: http://stackoverflow.com/a/22923576
type: Question
upvote count: 4

http://stackoverflow.com/q/22829161
type: UnansweredQuestion
has title: Java How to search if user input is equal to something in my array
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/1128723
has comment: http://stackoverflow.com/comment/34820705
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/25608432
has body: Hello my goal is to get the user to input some customerID value and some videoID how would I check to make sure the user inputs a correct customerID and videoID in my array I have made for these fields and tell the user they have inputted the wrong ID. This is what i have so far for my code public static void HireVideo(){ System.out.println("Enter Customer ID"); String customerID = sc.next(); System.out.println("Enter Video ID"); String videoID = sc.next(); HireList.add(new Hire(customerID, videoID)); }
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/34820441

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/22818264

http://stackoverflow.com/q/22888681
type: Question
has comment: http://stackoverflow.com/comment/34927707
has comment: http://stackoverflow.com/comment/34927736
score: 0
answer count: 2
has title: Initialization of fields of class
linked to: http://stackoverflow.com/q/24551
favorite count: 0
has comment: http://stackoverflow.com/comment/34927711
tagged with: constructor
has answer: http://stackoverflow.com/a/22888700
duplicate of: http://stackoverflow.com/q/24551
has body: Sorry, if this question is trivial... There are two ways of initializing fields For example: The first way is: Public class A{ int a; A(){ a = 5; } } The second way is: Public class A{ int a = 5; A(){ } } Which way is better? Why or why not?
possible better answer: http://stackoverflow.com/a/22888700
has comment: http://stackoverflow.com/comment/34927756
has answer: http://stackoverflow.com/a/22888754
type: AnsweredQuestion
tagged with: oop
tagged with: java
accepted answer: http://stackoverflow.com/a/22888754
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/35057865
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22931128
has text: Yes, path is correct, because have image displayed in ImageView. Now I corrected my code, now image i get from camera and rewrite code on `LuminanceSource qr = new PlanarYUVLuminanceSource(data,size.width,size.width,0,0,300,300,false);` . And he start decode qr code
score: 0

http://stackoverflow.com/comment/34803509
type: Comment
type: QuestionComment
has text: throw new InputException("your message here");
score: 0
comment on: http://stackoverflow.com/q/22819820

http://stackoverflow.com/comment/35040018
type: QuestionComment
has text: Then I suggest you research how to calculate distances between points.
comment on: http://stackoverflow.com/q/22950730
score: 0
type: Comment

http://stackoverflow.com/a/22920903
score: 0
type: Answer
has body: You can perform a similar transformation within String: // add "." to format the major version ("." + versionString). // replace each "." with "a00" replaceAll("\\.", "a00"). // keep 2 digits, remove "a" and extra leading "0" replaceAll("a0+([0-9]{2})", "$1"); This method can be easily adopted for different number of significant digits and/or different formats of the input string. Performance is ~2.4x slower than that of your toLong method (2.5 s to format 1M version strings). If performance is more important than simplicity of code, this is about 5.5x faster (0.2 s for 1M strings), than your toLong method: public static Long toLong2(String versionString) { if (versionString == null || versionString.isEmpty() ) { return 0L; } // end if empty char[] C = versionString.toCharArray(); int i, i1 = 0, i2 = C.length; Long l, number = 0L, factor = 1L; try { for (i = C.length - 1; i &gt; 0; i--) { if (C[i] == '.') { i1 = i + 1; l = Long.parseLong(versionString.substring(i1, i2) ); i2 = i; number += l * factor; factor = factor * 100L; } // end if '.' } // end for i l = Long.parseLong(versionString.substring(0, i2) ); number += l * factor; } catch (NumberFormatException e) { // silently ignored } // end try return number; } // end method toLong2
answers question: http://stackoverflow.com/q/22811690

http://stackoverflow.com/a/22963972
type: Answer
score: 1
upvote count: 1
has body: It's unfortunate that java uses synchronized as a keyword. A synchronized block in Java is a "mutex" (short for "mutual exclusion"). It's a mechanism that insures only one thread at a time can enter the block. Mutexes are just one of many tools that are used to achieve "synchronization" in a multi-threaded program: Broadly speaking, synchronization refers to all of the techniques that are used to insure that the threads will work in a coordinated fashion to achieve a desired outcome. Atomicity is what Oleg Estekhin said, above. We usually hear about it in the context of "transactions." Mutual exclusion (i.e., Java's synchronized) guarantees something less than atomicity: Namely, it protects invariants. An invariant is any assertion about the program's state that is supposed to be "always" true. E.g., in a game where players exchange virtual coins, the total number of coins in the game might be an invariant. But it's often impossible to advance the state of the program without temporarily breaking the invariant. The purpose of mutexes is to insure that only one thread---the one that is doing the work---can see the temporary "broken" state.
downvote count: 0
answers question: http://stackoverflow.com/q/22960524

http://stackoverflow.com/comment/34985247
type: AnswerComment
has text: Can u please express more on "arbitrary addresses"? Are they the temporary addresses created in the RAM(Memory) while some programs run? Give some examples for it. And do u mean that the java exe programs cannot anyway access the memory or the hard disk addresses? Anyhow in my case the 'remotely loaded code' refers to java applets.
type: Comment
comment on: http://stackoverflow.com/a/22907275
score: 0

http://stackoverflow.com/q/22890864
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22931284
answer count: 2
accepted answer: http://stackoverflow.com/a/22931284
has title: facebook sdk java query getting name from actor_id with graph API or url/http
tagged with: facebook-fql
possible better answer: http://stackoverflow.com/a/22897862
score: 0
tagged with: android
tagged with: facebook-graph-api
has body: How do I get the name of the actor_id in the same request, and display all the information from the table and the "name"? SELECT permalink,actor_id FROM stream WHERE source_id=me() then I want the name of the actor_id I know I can use the actor_id results and get the name in a new request SELECT name FROM user WHERE uid=actor_id but, I need to display the permalink and the name together. How do I get results from https://graph.facebook.com/user_id?fields=name Can I do a URL/https request to display the name with actor_id results I got?
tagged with: facebook
has answer: http://stackoverflow.com/a/22897862
linked to: http://stackoverflow.com/q/16169893
type: AnsweredQuestion

http://stackoverflow.com/a/22962112
score: 0
answers question: http://stackoverflow.com/q/22961968
type: Answer
has body: private int divide(int i1, int i2) throws IllegalArgumentException{ if(i2==0) throw new IllegalArgumentException("Argument 'divisor' is 0"); else return i1/i2; }

http://stackoverflow.com/q/22968313
favorite count: 0
has title: Java: repaint() not working?
linked to: http://stackoverflow.com/q/21289140
linked to: http://stackoverflow.com/q/21868170
downvote count: 0
linked to: http://stackoverflow.com/q/21800466
linked to: http://stackoverflow.com/q/21532761
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/22968559
tagged with: java
linked to: http://stackoverflow.com/q/22123266
type: Question
linked to: http://stackoverflow.com/q/21587972
upvote count: 1
has body: Code: @Override public void mouseReleased(MouseEvent e) { //when the mouse is pressed Point where=e.getPoint(); int x=(where.x-3)/20+1; int y=(where.y-30)/20+1; if(x&gt;=1&amp;&amp;x&lt;=30&amp;&amp;y&gt;=1&amp;&amp;y&lt;=30) { v[x][y]=1-v[x][y]; repaint(); try{ TimeUnit.MILLISECONDS.sleep(300); } catch(Exception ex){} redo(); repaint(); } } The paint function is made so that it will show, on screen, all 30x30 elements of the V matrix. The redo function makes some changes (the details are irrelevant) to V. What i am trying to do is paint the elements of V, but with v[x][y] changed, wait 0.3s, and then paint the elements of V again, but this time after they were changed by the redo function. But the repaint only works the second time, the first time not doing anything.
has answer: http://stackoverflow.com/a/22968559
answer count: 1
has comment: http://stackoverflow.com/comment/35070888

http://stackoverflow.com/q/22954636
tagged with: user-interface
downvote count: 0
has comment: http://stackoverflow.com/comment/35047810
tagged with: javabeans
favorite count: 0
has comment: http://stackoverflow.com/comment/35048311
has comment: http://stackoverflow.com/comment/35048638
tagged with: netbeans
tagged with: list
has body: I have two classes that are identical in every way but one; the first implements List&lt;RuleSet&gt; while the second doesn't. They have all the same members and methods. When I try to build a GUI using Netbeans' GUI builder, I cannot bind to properties in the list, whereas I can in the other. Is there something that prevents me from having a class implement a List interface and using it as a Bean as well? I can work around it this time, but it is going to require changes in my design I didn't expect. A concrete example to make things clearer: PatternSet_I implements List PatternSet_J doesn't implement List I can't bind to properties in instances of PatternSet_I I can bind to properties in instances of PatternSet_J I'll add code below: PatternSet_I implements List&lt;RuleSet&gt; package dvrminer.pattern; import dvrminer.rule.RuleSet; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; public class PatternSet_I implements List&lt;RuleSet&gt; { public static final String PROP_STRING = "string"; private Pattern pattern; private final List&lt;RuleSet&gt; ruleSets; private final transient PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); public PatternSet_I() { ruleSets = new ArrayList&lt;&gt;(); } public Pattern getPattern() { return pattern; } public void setPattern(Pattern pattern) { this.pattern = pattern; } // @Override public int size() { return ruleSets.size(); } // @Override public boolean isEmpty() { return ruleSets.isEmpty(); } // @Override public boolean contains(Object o) { return ruleSets.contains(o); } // @Override public Iterator&lt;RuleSet&gt; iterator() { return ruleSets.iterator(); } // @Override public Object[] toArray() { return ruleSets.toArray(); } // @Override public &lt;T&gt; T[] toArray(T[] a) { return ruleSets.toArray(a); } // @Override public boolean…
answer count: 0
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35046498
has title: Beans can't implement List?
score: 2

http://stackoverflow.com/comment/34797543
has text: thx for this. I ended up working with an InputStream which I feel is much more comfortable ;)
comment on: http://stackoverflow.com/a/22813785
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22924090
type: Answer
has body: There's a multitude of problems with your code: lang is used on the first line, but further on you use language Exemplary is used on the first line, but on the 2nd you use Exemplairy the method doesn't have a closing } at the end you don't have code that deals with an empty language the loop should be rewritten as an enhanced for loop the interface List should be used instead of the class ArrayList where possible
score: 1
answers question: http://stackoverflow.com/q/22923678
upvote count: 1
has comment: http://stackoverflow.com/comment/34992923
downvote count: 0
has comment: http://stackoverflow.com/comment/34992491

http://stackoverflow.com/q/22824889
type: Question
tagged with: pool
answer count: 2
has answer: http://stackoverflow.com/a/23520325
accepted answer: http://stackoverflow.com/a/22948074
score: 0
possible better answer: http://stackoverflow.com/a/23520325
has body: I am trying to use apache pool2 to pool some resources. I have it working fine in a unit test, but when I try using it in spring 3, I get an error. Everything else is working with the Controller and Service. I could access the endpoint before I added the pooling code, and the autowired service is not null. This is all wired together using context:component-scan If I set a breakpoint in the controller method, I see that the object returned from the borrow is org.apache.cxf.jaxws.JaxWsClientProxy@15de00c . Then inspecting the object in the active pool gives org.apache.cxf.jaxws.JaxWsClientProxy@15de00c So, my question is this: why does this work in the unit test, but fails in the spring controller/service controller: @Controller public class TestController() { @Autowired private TestService testService @RequestMapping(value="/test", method=RequestMethod.GET) public ModelAndView getTest() throws Exception { GenericObjectPool&lt;MyObj&gt; pool = testService.getPool(); pool.returnObject(pool.borrowObject()); return new ModelAndView("jsp/test", "command", new TestObj()); //not really relevant yet } } and the service: @Service public class TestService implements DisposableBean { GenericObjectPool&lt;MyObj&gt; pool; public TestService () { pool = new GenericObjectPool&lt;MyObj&gt;(new MyObjPooledObjectFactory()); } public GenericObjectPool&lt;MyObj&gt; getPool() { return pool; } public void setPool(GenericObjectPool&lt;MyObj&gt; pool) { this.pool = pool; } @Override public void destroy() throws Exception { LOG.info("DESTROYING Service"); this.pool.close(); } } Factory: MyObjPooledObjectFactory extends BasePooledObjectFactory&lt;MyObj&gt; { @Override public MyObjc create() throws Exception { MyObj myObj = expensive call. return myObj; } @Override public PooledObject&lt;MyObj&gt; wrap(MyObj obj) { return new DefaultPooledObject&lt;MyObj&gt;(obj); } } @Override public void destroyObject(PooledObject&lt;MyObj &gt; p) throws Exception { super.destroyObject(p); p.releaseConnectio…
has title: Apache Pool can't return object in spring controller/service
has answer: http://stackoverflow.com/a/22948074
tagged with: apache-commons-pool
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35036813
type: QuestionComment
comment on: http://stackoverflow.com/q/22948929
score: 0
has text: Yes, a word search is a good way to look at it. It will need to test for equality right to left and vice versa, up and down and vice versa, and diagonally.
type: Comment

http://stackoverflow.com/comment/34837863
comment on: http://stackoverflow.com/q/22839300
type: Comment
type: QuestionComment
score: 0
has text: Once the app is compiled you can download the .apk to your phone by emailing it yourself, or something. I load it up on my website and download it. That's how I test all my stuff in development. I've never plugged in my phone or tablet.

http://stackoverflow.com/comment/34899943
comment on: http://stackoverflow.com/q/22849268
score: 0
type: Comment
type: QuestionComment
has text: @Chris not all DB accept deferred constraints checking, so I would have preferred not relying on that. For your other question, I think I was told not to use flush() because it's more a performance/implmentation detail rather than something I should care about. In a "DB way of thinking" it is only logical to think about it. In an object-Java world, you should not care about that.

http://stackoverflow.com/a/22864048
has comment: http://stackoverflow.com/comment/34883462
has comment: http://stackoverflow.com/comment/34883405
has comment: http://stackoverflow.com/comment/34883950
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34884569
answers question: http://stackoverflow.com/q/22861824
has body: unfortunately Java is very clumsy when it comes to deal with binary raw data... however, you get different tokens each time due to the leading PKCS padding which concatenates some random stuff in order to prevent replay attacks and/or statistical analysis on your encrypted data FYI you want to encrypt a symmetric key and use such key to encode/decode large binary data. Don't use RSA directly to encode/decode your final data!

http://stackoverflow.com/a/22988439
answers question: http://stackoverflow.com/q/22918763
type: Answer
has body: To extract the names, I would do it by following your code with: List&lt;WebElement&gt; names = driver.findElements(By.cssSelector(".nameList li"); It finds all &lt;li&gt; elements nested in the &lt;ol&gt; class="nameList"&gt; element. What remains is to iterate over this list and put your names into your Excel file with JXL. You did not specify how they should be arranged so I cannot help you further.
score: 0

http://stackoverflow.com/comment/34903214
comment on: http://stackoverflow.com/a/22874754
has text: if you want to run operations that take more then milliseconds to finish there is no real alternative but threads.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/40376658
comment on: http://stackoverflow.com/a/22964655
score: 0
type: Comment
has text: What do you have in your `httpClientFilter()`?
type: AnswerComment

http://stackoverflow.com/comment/34922854
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22885858
has text: So basically the code is the same, the only difference is the block in the middle is moved outside the actionPerformed method ?

http://stackoverflow.com/comment/34865112
score: 3
comment on: http://stackoverflow.com/q/22854086
type: Comment
type: QuestionComment
has text: To start, don't use `Vector`; it's been essentially deprecated since Java 1.2. Always prefer `List` unless working with ancient APIs that require `Vector`.

http://stackoverflow.com/comment/35004529
has text: Yes I have replaced the original segment of code with your suggestion, but it doesn't seem to have changed anything.
type: AnswerComment
comment on: http://stackoverflow.com/a/22931044
score: 0
type: Comment

http://stackoverflow.com/a/22820581
has comment: http://stackoverflow.com/comment/34806560
has comment: http://stackoverflow.com/comment/34807032
downvote count: 0
answers question: http://stackoverflow.com/q/22819908
has comment: http://stackoverflow.com/comment/34806889
has comment: http://stackoverflow.com/comment/34807234
has comment: http://stackoverflow.com/comment/34805983
has body: Well my guess is that you are authenticated in alfresco in another tab of google chrome and that alfresco picks that up. 401 is an authentication exception and you need to authenticate to alfresco which is not done in your code above. See for example: http://wiki.alfresco.com/wiki/Web_Scripts#Authenticating The first thing you should do is to check you webscripts description file to find out which authentication method it demands. Since this seems to be a custom webscript in you alfresco installation its hard to tell you where it is to be found. It could be called something like get-order.info.post.desc.xml (strange with a post request to a script named get- BTW) Look at the authentication element.
has comment: http://stackoverflow.com/comment/34805775
upvote count: 2
has comment: http://stackoverflow.com/comment/34805910
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34805955
has comment: http://stackoverflow.com/comment/34807049

http://stackoverflow.com/comment/103603497
has text: The most elegant solution so far but due to Java streams implementation, not very efficient. C# does a better job with the IEnumerable interface implemented by arrays.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/58348964
score: 1

http://stackoverflow.com/comment/35002498
score: 1
comment on: http://stackoverflow.com/q/22929851
type: Comment
has text: So I may be also out of date, I am much older than that.
type: QuestionComment

http://stackoverflow.com/comment/34932072
type: AnswerComment
has text: So thats why he has given the url for java watcher API. he can have is own implementation and run that notification service.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22890991

http://stackoverflow.com/a/22875951
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22875913
accepted answer of: http://stackoverflow.com/q/22875913
upvote count: 1
type: Answer
has body: The error is simple and coming because you can't write data in directory. Try to print dir.isDirectory() to confirm if it's directory. Since its part of argument, check the caller method.

http://stackoverflow.com/comment/34920652
comment on: http://stackoverflow.com/q/22883813
type: Comment
has text: Yes the problem I am having is in the line analytics.newTracker(PROPERTY_ID) I don't understand how to define this property_id
type: QuestionComment
score: 0

http://stackoverflow.com/q/22887424
score: 1
has title: Call synchronized method from reflection
tagged with: synchronization
favorite count: 0
upvote count: 1
type: AnsweredQuestion
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/34926212
has answer: http://stackoverflow.com/a/22888538
type: Question
downvote count: 0
tagged with: block
tagged with: synchronized
has body: I need to call some synchronized methods via Java's Reflection API. Let's say that I have: public final synchronized void doSomething() { Thread.sleep(1000); } If I called this method directly from two threads one thread would enter the method and the other thread would have to wait until the first thread has left the method block (after one second). Then the other thread could enter the method and any other threads would need to wait. Is there any difference if I don't call the method directly but call it through reflection? Would the "blocking"-behaviour be the same?
answer count: 1
accepted answer: http://stackoverflow.com/a/22888538

http://stackoverflow.com/comment/35007083
has text: and this is Java script I use to attach Image in outlook if (window.XMLHttpRequest) { outlookApp=new XMLHttpRequest("Outlook.Application"); } var outlookApp = new ActiveXObject("Outlook.Application"); var nameSpace = outlookApp.getNameSpace("MAPI"); mailFolder = nameSpace.getDefaultFolder(6); mailItem = mailFolder.Items.add('IPM.Note.FormA'); mailItem.Attachments.Add ();//here I have to pass that image // mailItem.display (0);
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22929582
score: 0

http://stackoverflow.com/comment/34847207
score: 0
type: Comment
has text: Not sure. It's been a long time since I've dealt with Java UIs so I'm not sure. Might be worth asking as a new question though. Someone else might know.
comment on: http://stackoverflow.com/a/22842642
type: AnswerComment

http://stackoverflow.com/a/22944146
answers question: http://stackoverflow.com/q/22942606
downvote count: 0
type: Answer
upvote count: 1
has body: You can force a flush using this the ApiProxy class: import com.google.apphosting.api.ApiProxy; ApiProxy.flushLogs();
score: 1

http://stackoverflow.com/q/22846538
accepted answer: http://stackoverflow.com/a/22846691
type: AnsweredQuestion
tagged with: java
has title: Correct use of arrayBaseOffset and arrayIndexScale
score: 4
type: Question
upvote count: 4
has body: I have defined a simple array and I want to use Unsafe.arrayBaseOffset and Unsafe.arrayIndexScale with the following snippet. import sun.misc.Unsafe; public class Arr { public static void main(String[] args) { int [] a = new int[3]; a[0] = 10; a[1] = 20; a[2] = 30; int baseOffset = Unsafe.arrayBaseOffset(a.getClass()); int indexScale = Unsafe.arrayIndexScale(a.getClass()); } } However I get these errors Arr.java:11: non-static method arrayBaseOffset(java.lang.Class) cannot be referenced from a static context int baseOffset = Unsafe.arrayBaseOffset(a.getClass()); ^ Arr.java:12: non-static method arrayIndexScale(java.lang.Class) cannot be referenced from a static context int indexScale = Unsafe.arrayIndexScale(a.getClass()); ^
answer count: 1
tagged with: arrays
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34851307
tagged with: unsafe
has answer: http://stackoverflow.com/a/22846691

http://stackoverflow.com/q/22878922
has answer: http://stackoverflow.com/a/22878970
has body: I have a function in which I have to send two states of an object: void functionA(MyObject objStateOff, MyObject objStateOn){ } And there would always be only two types states: on and off But instead of having two parameters of the same type for this function, I was hoping to combine them. SO I was thinking of having a HashMap&lt;Boolean, MyObject&gt;. But since this map would at most contain only two entries, it seems to be a waste of resources, as I am developing for Android. So, is there a better way of passing these two objects, without having two either use a HashMap or having two parameters in the function signature? Update: I want to see if any other method would basically improve the following: Readability, performance(even though i think that won't change) and maintainability Thanks.
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34910308
has comment: http://stackoverflow.com/comment/34910365
type: Question
has answer: http://stackoverflow.com/a/22878958
has answer: http://stackoverflow.com/a/22879072
answer count: 6
has comment: http://stackoverflow.com/comment/34910102
has answer: http://stackoverflow.com/a/22878984
score: 0
has comment: http://stackoverflow.com/comment/34910145
tagged with: android
has answer: http://stackoverflow.com/a/22879000
has title: Efficient way to implement HashMap<Boolean, Object>: Java
has answer: http://stackoverflow.com/a/22879186
possible better answer: http://stackoverflow.com/a/22878958
accepted answer: http://stackoverflow.com/a/22879186

http://stackoverflow.com/q/22825305
type: AnsweredQuestion
tagged with: java
has body: I have written a method in Java to delete a caret at the end of each line of a file. The method is as follows: //Creates a new file, and deletes the temp file public void createFinalFile() throws FileNotFoundException, IOException{ // read file data into a String String data1 = new Scanner(new File(fileDirectoryString + "tempFile.txt")).useDelimiter("\\Z").next(); // replace all ^ from end of line using (?m) - MULTILINE switch data1 = data1.replaceAll("(?m)\\^$", ""); PrintWriter docketFile3 = new PrintWriter(new FileWriter(fileDirectoryString + "Forclosure-Docket-"+startingYear+startingMonth+startingDay+"-"+endingYear+endingMonth+endingDay+".txt", true)); docketFile3.write(data1); } The issue is that sometimes the temp file will have all the information, but after the method is run the newly created file is blank and I am not sure why. An example of the temp file is: 04/02/2014^BR-12-005193^09/12/2012^P1^SF^DEPOSIT AMOUNT PAID CUYAHOGA COUNTY SHERIFF^ 04/02/2014^BR-12-005193^09/12/2012^P1^CS^COST PAYMENT $860.90 CUYAHOGA COUNTY SHERIFF^ While it should just delete the caret at the end of each line, it seems to be deleting every line.
type: Question
answer count: 1
has title: Regex wiping file
has answer: http://stackoverflow.com/a/22825437
tagged with: regex
score: 0
accepted answer: http://stackoverflow.com/a/22825437

http://stackoverflow.com/a/22839299
has comment: http://stackoverflow.com/comment/34839046
answers question: http://stackoverflow.com/q/22838583
accepted answer of: http://stackoverflow.com/q/22838583
has comment: http://stackoverflow.com/comment/34841297
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34840710
score: 0
has comment: http://stackoverflow.com/comment/34841799
type: Answer
has body: When one overrides the equals() method, one is also supposed to override the hashCode() method. The equals() method takes an Object parameter. Here's how your Media class should look like: // Media.java public class Media { private final String support; private final String title; public Media(String title, String support) { this.title = title; this.support = support; } public Media(Media media) { this(media.title, media.support); } @Override public int hashCode() { return 31 * title.hashCode() + support.hashCode(); } @Override public boolean equals(Object object) { if (object instanceof Media) { Media media = (Media) object; return media.title.equals(title) &amp;&amp; media.support.equals(support); } return false; } } Then use a HashMap to map the media with its number of copies. Here's how that's done: // MediaMap.java import java.util.HashMap; import java.util.Map; public class MediaMap { // Media to its Number of Copies mapping. private Map&lt;Media, Integer&gt; mediaMap; public MediaMap() { mediaMap = new HashMap&lt;&gt;(); } public void add(Media media) { mediaMap.put(media, mediaMap.getOrDefault(media, 0) + 1); } public void removeOneMedia(Media media) { if (mediaMap.containsKey(media)) { mediaMap.put(media, mediaMap.get(media) - 1); } } // And so on... } Without overriding the hashCode() method in the Media class, the hash based collections won't work as expected. You can also have a look at MultiSet data structure, and use that instead. If you are to use ArrayList then here's how its done: // Media.java public class Media { private final String support; private final String title; private int numberOfCopies; public Media(Media media) { this(media.title, media.support, media.numberOfCopies); } public Media(String title, String support, int numberOfCopies) { this.title = title; this.support = support; this.numberOfCopies = numberOfCopies; } @Override public int hashCode() { return 31 * title.hashCode() + support.hashCode(); } @Override public boolean equals(O…

http://stackoverflow.com/a/22884315
score: 0
has comment: http://stackoverflow.com/comment/34920055
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22884209
type: Answer
accepted answer of: http://stackoverflow.com/q/22884209
has body: You stated the problem yourself: the class has a different package name in your Android app. Why are you doing that? You should use exactly the same jar in both apps.

http://stackoverflow.com/comment/34922175
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22885530
has text: Well see it like this: I need to spread the amount over a list, a split that list into high, medium and low. High is the list that must be methodized first, then medium then low. So if I got 20 to spread and the size of the highlist is 5, I will first pick the 5 from the highlist then from the mediumlist, then the lowlist.
score: 0

http://stackoverflow.com/q/22919399
tagged with: string
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22919529
has title: Replace a string.
has answer: http://stackoverflow.com/a/22920077
upvote count: 1
type: Question
tagged with: java
tagged with: replace
has answer: http://stackoverflow.com/a/22919469
tagged with: char
answer count: 3
has body: I've replaced a string so that all the letters appear as **'s however when I ask the user for input of a char, I can't seem to get the letters to revert back from *'s into strings. I will show you below what I have done in my code: System.out.println(randomPirateWord.replaceAll("\\S", "*")); System.out.println("guess a letter"); char letterGuesed = input.findInLine(".").charAt(0); System.out.println(randomPirateWord.replaceAll("\\S"+letterGuesed,"*"));
downvote count: 0
score: 1

http://stackoverflow.com/comment/34852576
type: Comment
has text: So does the compiler consider this neither thing? Should not there be a one direction which is right/wrong for the compiler? Just wondering.
comment on: http://stackoverflow.com/a/22846981
score: 0
type: AnswerComment

http://stackoverflow.com/q/22828777
answer count: 1
tagged with: jquery
tagged with: asp.net
has body: Is there any option to get client PC hardware configuration from a website? I need to create a website for showing the local system configuration. I know there are many tools to get system configuration. But the user want to get them PC configuration from a website. I tried in many ways. Thanks in advance.
tagged with: actionscript-3
tagged with: php
has comment: http://stackoverflow.com/comment/34819981
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/34819780
has comment: http://stackoverflow.com/comment/34819863
has comment: http://stackoverflow.com/comment/34819635
has answer: http://stackoverflow.com/a/22828845
tagged with: java
has title: how to get client pc configuration from website
type: Question

http://stackoverflow.com/comment/34853758
has text: @dasblinkenlight And this has been asked as a final assignment for an interview. I need to submit in a day, I know the approach but the classes and methods to represent in a class diagram are little difficult. Any high level class examples, anyone?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22846484
score: 0

http://stackoverflow.com/a/22897862
has comment: http://stackoverflow.com/comment/34959662
has comment: http://stackoverflow.com/comment/34961967
has comment: http://stackoverflow.com/comment/35004301
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34958837
has comment: http://stackoverflow.com/comment/34960175
has comment: http://stackoverflow.com/comment/34963942
has comment: http://stackoverflow.com/comment/34960678
has comment: http://stackoverflow.com/comment/34965606
has comment: http://stackoverflow.com/comment/34950681
has comment: http://stackoverflow.com/comment/34966137
answers question: http://stackoverflow.com/q/22890864
has comment: http://stackoverflow.com/comment/34958911
has comment: http://stackoverflow.com/comment/34962972
has body: You can make the multiple query using RequestBatch- ArrayList&lt;Request&gt; requests = new ArrayList&lt;Request&gt;(); // Request-1 String streamQuery = "SELECT permalink,actor_id FROM stream WHERE source_id=me()"; Bundle args1 = new Bundle(); args1.putString("q", streamQuery); Request request1 = new Request(session, "fql", args1, HttpMethod.GET); request1.setCallback(new com.facebook.Request.Callback() { @Override public void onCompleted(Response response) { GraphObject graphObject = response.getGraphObject(); String s = textViewResults.getText().toString(); if (graphObject != null) { JSONObject jsonObject = graphObject.getInnerJSONObject(); try { JSONArray array = jsonObject.getJSONArray("data"); for (int i = 0; i &lt; array.length(); i++) { JSONObject object = (JSONObject) array.get(i); Log.d(TAG, "permalink = "+object.get("permalink")); } } catch (JSONException e) { e.printStackTrace(); } } } }); requests.add(request1); // Request-2 String userQuery = "SELECT name FROM user WHERE uid=actor_id"; Bundle args2=new Bundle(); args2.putString("q", userQuery); Request request2 = new Request(session, "fql", args2, HttpMethod.GET); request2.setCallback(new com.facebook.Request.Callback() { @Override public void onCompleted(Response response) { GraphObject graphObject = response.getGraphObject(); String s = textViewResults.getText().toString(); if (graphObject != null) { JSONObject jsonObject = graphObject.getInnerJSONObject(); try { JSONArray array = jsonObject.getJSONArray("data"); for (int i = 0; i &lt; array.length(); i++) { JSONObject object = (JSONObject) array.get(i); Log.d(TAG, "name = "+object.get("name")); } } catch (JSONException e) { e.printStackTrace(); } } } }); requests.add(request2); // Execute Batch RequestBatch requestBatch=new RequestBatch(requests); requestBatch.setTimeout(10000); List&lt;Response&gt; responses = requestBatch.executeBatchAndWait(); Hope that helps. Good luck!
has comment: http://stackoverflow.com/comment/34960098
has comment: http://stackoverflow.com/comment/34965689
has comment: http://stackoverflow.com/comment/34960047
has comment: http://stackoverflow.com/comment/34952629
has comment: http://stackoverflow.com/comment/34960916
upvote count: 1
has comment: http://stackoverflow.com/comment/34959314
has comment: http://stackoverflow.com/comment/34966184
has comment: http://stackoverflow.com/comment/34965380
has comment: http://stackoverflow.com/comment/34959531
has comment: http://stackoverflow.com/comment/34961519
has comment: http://stackoverflow.com/comment/34960425
has comment: http://stackoverflow.com/comment/34964030
has comment: http://stackoverflow.com/comment/35006011
has comment: http://stackoverflow.com/comment/34963768
has comment: http://stackoverflow.com/comment/34961667
has comment: http://stackoverflow.com/comment/34965569
has comment: http://stackoverflow.com/comment/34966998
has comment: http://stackoverflow.com/comment/34963252
type: Answer
has comment: http://stackoverflow.com/comment/34959451

http://stackoverflow.com/comment/34875252
comment on: http://stackoverflow.com/q/22858435
score: 0
has text: @leigero No its not always the same
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22943983
answer count: 1
has comment: http://stackoverflow.com/comment/35027950
linked to: http://stackoverflow.com/q/5710394
favorite count: 0
duplicate of: http://stackoverflow.com/q/5710394
has comment: http://stackoverflow.com/comment/35027638
has comment: http://stackoverflow.com/comment/35027671
has title: how to return a double rounded to tenths
has comment: http://stackoverflow.com/comment/35027481
upvote count: 0
type: UnansweredQuestion
has body: I am trying to return a double so that it rounds up to the tenths. I have: roundedTemp = (double)Math.round(tempNum *10)/10; return roundedTemp; What am I doing wrong? I get it back to 2 decimal places...
type: Question
tagged with: rounding
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/22944258
downvote count: 2
has comment: http://stackoverflow.com/comment/35027600

http://stackoverflow.com/comment/34802014
type: AnswerComment
has text: i was trying out the code and forgot to remove that line.
type: Comment
comment on: http://stackoverflow.com/a/22818290
score: 0

http://stackoverflow.com/a/22948839
has comment: http://stackoverflow.com/comment/35037690
type: Answer
answers question: http://stackoverflow.com/q/22948737
score: 0
has body: You have no view with ID R.id.etxt_tituloanuncio so your EditText titu_anun is null and calling getText() on a null object throws the Null Pointer Exception

http://stackoverflow.com/comment/35042906
type: Comment
has text: Another function sets pos and then calls this function that I printed. I printed pos and I get the right values but it can't be found to remove. Pos is an object that I created in the class Posicao, it has 2 integers, x and y.
type: QuestionComment
comment on: http://stackoverflow.com/q/22952058
score: 0

http://stackoverflow.com/comment/34985269
type: Comment
comment on: http://stackoverflow.com/q/22920510
score: 0
has text: http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html... If you are expecting large values, use Long.
type: QuestionComment

http://stackoverflow.com/comment/35026118
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22940414
has text: Yes, i annotated with @PrepareForTest(Singleton.class)

http://stackoverflow.com/q/22887211
has comment: http://stackoverflow.com/comment/34925579
accepted answer: http://stackoverflow.com/a/22887734
favorite count: 0
linked to: http://stackoverflow.com/q/8689344
possible better answer: http://stackoverflow.com/a/22887539
has comment: http://stackoverflow.com/comment/34925796
has comment: http://stackoverflow.com/comment/34925206
has answer: http://stackoverflow.com/a/22887539
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34925187
linked to: http://stackoverflow.com/q/2750636
has body: Now line separator is system dependent but while in a c program i use '\n' for line separator , it works fine whether i run it in windows or linux . why ?? In java we have to use %n as it is system dependent then how come we use '\n' in c for new line irrespective of os in which we run it ?
tagged with: java
has answer: http://stackoverflow.com/a/22887734
type: Question
upvote count: 4
answer count: 2
has title: New line character in c and java language
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/34925583
score: 4
tagged with: printf

http://stackoverflow.com/comment/35026014
has text: What's your format specifier string?
comment on: http://stackoverflow.com/q/22943135
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35330373
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22914668
has text: Cabrera Miguel 193 90 353 3 0 555 Cuddyer Michael 162 46 259 10 3 489 Mauer Joe 144 61 212 0 1 445 Trout Mike 190 110 328 33 7 589 Johnson Chris 165 29 235 0 0 514 Freeman Freddie 176 66 276 1 0 551 "the start of Each Name starts a new line in the input file"
type: AnswerComment

http://stackoverflow.com/comment/34914282
type: Comment
comment on: http://stackoverflow.com/a/22880229
score: 0
type: AnswerComment
has text: post your activity code where you are using this method and i will try to help further

http://stackoverflow.com/a/22897582
has comment: http://stackoverflow.com/comment/34943650
has comment: http://stackoverflow.com/comment/34943584
has comment: http://stackoverflow.com/comment/34943683
upvote count: 5
has comment: http://stackoverflow.com/comment/34943605
has comment: http://stackoverflow.com/comment/34943699
has comment: http://stackoverflow.com/comment/34943702
has comment: http://stackoverflow.com/comment/34943655
score: 5
type: AcceptedAnswer
downvote count: 0
has body: That's the compound assignment operator, which is equivalent to: k = (boolean)(k &amp; m);
has comment: http://stackoverflow.com/comment/34943876
has comment: http://stackoverflow.com/comment/34943792
has comment: http://stackoverflow.com/comment/34943715
has comment: http://stackoverflow.com/comment/34943657
has comment: http://stackoverflow.com/comment/34943579
type: Answer
has comment: http://stackoverflow.com/comment/34943690
has comment: http://stackoverflow.com/comment/34943821
has comment: http://stackoverflow.com/comment/34943842
has comment: http://stackoverflow.com/comment/34943632
has comment: http://stackoverflow.com/comment/34943839
answers question: http://stackoverflow.com/q/22897574
has comment: http://stackoverflow.com/comment/34943804
has comment: http://stackoverflow.com/comment/34943617
accepted answer of: http://stackoverflow.com/q/22897574

http://stackoverflow.com/comment/34890282
type: QuestionComment
comment on: http://stackoverflow.com/q/22868084
score: 0
has text: You asking me why I dont do that (if you read carefully, I said I do) or why Swing doesnt? If the latter, I second your question.
type: Comment

http://stackoverflow.com/comment/34961667
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22897862
has text: By the way, do I have to put anything in onCompleted like we did before, String name = (String)graphObject.getProperty("name"); ?
type: AnswerComment

http://stackoverflow.com/q/22809971
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/22810023
has comment: http://stackoverflow.com/comment/34788320
favorite count: 0
has answer: http://stackoverflow.com/a/22810032
answer count: 5
score: -4
has comment: http://stackoverflow.com/comment/34785358
accepted answer: http://stackoverflow.com/a/22810032
has answer: http://stackoverflow.com/a/22810611
type: AnsweredQuestion
has title: program to find the largest number in arraylist
linked to: http://stackoverflow.com/q/1484347
tagged with: java
has answer: http://stackoverflow.com/a/22811725
has answer: http://stackoverflow.com/a/22810115
has body: Let us imagine that we are having a arraylist in java which contains both intergers and strings value. I would like to loop through the entire arraylist(only taking the integers,ignore string) to find the largest number on the list???i need a program for this task????help me please
has comment: http://stackoverflow.com/comment/34785383
type: Question
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/34785380
has answer: http://stackoverflow.com/a/22810023

http://stackoverflow.com/comment/34853475
has text: The same way you [implement any interface](http://docs.oracle.com/javase/tutorial/java/IandI/usinginterface.html).
comment on: http://stackoverflow.com/q/22847578
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22933014
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22931422
has comment: http://stackoverflow.com/comment/35013148
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35015436
has body: I validate XML file against XSD using this way.I think this will help you. public String validateXMLSchema() throws SAXException, IOException { File folder = new File("xsdPath"); File[] listOfFiles = folder.listFiles(); String tempXsdFile; for( int i=0; i &lt; listOfFiles.length; i++ ) { if(listOfFiles[i].isFile()) { tempXsdFile = listOfFiles[i].getName(); try { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new File(xsdPath + tempXsdFile)); Validator validator = schema.newValidator(); validator.validate(new StreamSource(new File("C://Users//test.xml"))); return tempXsdFile; } catch (IOException | SAXException e) { System.out.println("ERROR: XML not well known"+ e.getMessage()); } } } return null; }
answers question: http://stackoverflow.com/q/22931422

http://stackoverflow.com/comment/36187900
has text: May refer post, http://stackoverflow.com/questions/21021216/ca-x-509-generated-by-bouncy-castle-is-seen-on-android-as-user-certificate
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22954401

http://stackoverflow.com/a/22860887
has comment: http://stackoverflow.com/comment/34911077
upvote count: 20
has body: Technically, there is no difference between &lt;E&gt; void printObjects(List&lt;E&gt; list) { and void printList(List&lt;?&gt; list) { When you are declaring a type parameter, and using it only once, it essentially becomes a wildcard parameter. On the other hand, if you use it more than once, the difference becomes significant. e.g. &lt;E&gt; void printObjectsExceptOne(List&lt;E&gt; list, E object) { is completely different than void printObjects(List&lt;?&gt; list, Object object) { You might see that first case enforces both types to be same. While there is no restriction in second case. As a result, if you are going to use a type parameter only once, it does not even make sense to name it. That is why java architects invented so called wildcard arguments (most probably). Wildcard parameters avoid unnecessary code bloat and make code more readable. If you need two, you have to fall back to regular syntax for type parameters. Hope this helps.
has comment: http://stackoverflow.com/comment/34910951
answers question: http://stackoverflow.com/q/22860582
score: 20
downvote count: 0
has comment: http://stackoverflow.com/comment/34911005
has comment: http://stackoverflow.com/comment/34910605
type: Answer
has comment: http://stackoverflow.com/comment/34910385
has comment: http://stackoverflow.com/comment/34910463

http://stackoverflow.com/comment/34928642
comment on: http://stackoverflow.com/q/22887214
type: Comment
type: QuestionComment
score: 4
has text: @DavidWallace: It's not true that we don't every need a wildcard. For example, a `List<List<?>>` is a list which can simultaneously hold lists of different things in it (you can add `List` and `List` into it; but cannot put non`List`s into it). You cannot express this without wildcards, unless perhaps by using raw types. A `List<List<E>>` for any `E` can only hold one kind of list inside it: `List<E>`.

http://stackoverflow.com/a/22837909
answers question: http://stackoverflow.com/q/22821472
type: Answer
has body: Please see how it should be done on this page: https://code.google.com/p/robotium/wiki/Getting_Started There is also an example test project you can download from there.
score: 0

http://stackoverflow.com/a/22816912
has body: Another suggestion: What reason do you have all these questions to generate a user password ? A random password is difficult to remember, asking about the number of special characters to be placed into it won't help a lot. For generated passwords I would suggest to just make your own guideline and generate a password according to that instead of asking all those prompts. But a modern password is often one-way hash encrypted, so you actually only store an encrypted form of the password and when a user enters the password again you encrypt it once again, then you match it with the encrpyted stored one. This has the big benefit that the password can not be stolen and even if the encrypted hash is stolen it can not be 'decrypted' again. You do not even need any special characters but I'd suggest to enforce a minimal length of 7-8 chars. Here an example code on how to make an encrypted hash MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update("CUSTOMSTRING"+pass.getBytes(), 0, 12+pass.length()); String md5 = new BigInteger(1, digest.digest()).toString(16); This code will make a 16 byte MD5 hash out of any password and it adds a so called 'Salt" to it ("CUSTOMSTRING" in the example) which makes it very difficult to get the original password through brute force if someone steals the hash without access to the code. I always hated websites that require you to have uppercase characters or special characters in the password as it makes me forget them. Passwords are not guessed these days, brute force can be detected too. Summary: Instead of generating the password based on user prompts, let the user choose one. Only require a minimal length which can be checked easily. And do not store the password, just store it's encrypted and salted hash. In case of a security breach (database stolen) the attacker only has limited use for the password hashes.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22816422

http://stackoverflow.com/comment/34812760
score: 1
has text: Use standard Java naming conventions. Variable names should NOT start with an upper case character!!!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22824582

http://stackoverflow.com/comment/35277881
has text: thanks for your answer. I also added a comment below with my solution.
comment on: http://stackoverflow.com/a/22908852
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35017022
type: QuestionComment
has text: If your phone has no SDcard then Export DB into Phone Memory
score: 0
comment on: http://stackoverflow.com/q/22937935
type: Comment

reflection
tags question: http://stackoverflow.com/q/22873658
tags question: http://stackoverflow.com/q/22922170
tags question: http://stackoverflow.com/q/22905339
tags question: http://stackoverflow.com/q/22953732
tags question: http://stackoverflow.com/q/22819156
tags question: http://stackoverflow.com/q/22932510
tags question: http://stackoverflow.com/q/22922602
tags question: http://stackoverflow.com/q/22965293
tags question: http://stackoverflow.com/q/22882324
tags question: http://stackoverflow.com/q/22900910
tags question: http://stackoverflow.com/q/22914964
tags question: http://stackoverflow.com/q/22959100
tags question: http://stackoverflow.com/q/22816104
tags question: http://stackoverflow.com/q/22921723
tags question: http://stackoverflow.com/q/22862117
type: Tag
tags question: http://stackoverflow.com/q/22867693
tags question: http://stackoverflow.com/q/22847001
tags question: http://stackoverflow.com/q/22862442
tags question: http://stackoverflow.com/q/22909049
tags question: http://stackoverflow.com/q/22866925
tags question: http://stackoverflow.com/q/22896321
tags question: http://stackoverflow.com/q/22819886
tags question: http://stackoverflow.com/q/22938852
tags question: http://stackoverflow.com/q/22929486
tags question: http://stackoverflow.com/q/22876120
tag name: reflection
tags question: http://stackoverflow.com/q/22916822
tags question: http://stackoverflow.com/q/22881164
tags question: http://stackoverflow.com/q/22887424

http://stackoverflow.com/q/22873461
has comment: http://stackoverflow.com/comment/34900488
has body: I'm trying to add two matrices and I get and exception when the compiler attempts to call the sum method. public static void main(String[] args) { int[][] a = new int[3][3]; int[][] b = new int[3][3]; for (int i = 0; i &lt; a.length; i++) { for (int j = 0; j &lt; a[0].length; j++) { a[i][j] = Integer.parseInt(JOptionPane.showInputDialog("Enter a[" + i + "][" + j + "]")); } } for (int i = 0; i &lt; b.length; i++) { for (int j = 0; j &lt; b[0].length; j++) { b[i][j] = Integer.parseInt(JOptionPane.showInputDialog("Enter b[" + i + "][" + j + "]")); } } I get the exception at the next line. int[][] c = sum(a,b); for (int[] row: c) { for (int e: row) { System.out.print(e + "\t"); } } } public static int[][] sum(int[][] a, int[][] b) { int[][] c = new int[a.length][a[0].length]; for (int i = 0; i &lt; a.length; i++) { for (int j = 0; i &lt; a[i].length; j++) c[i][j] = a[i][j] + b[i][j]; } return c; } Anybody can help me with that?
tagged with: matrix
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/22873559
type: AnsweredQuestion
has title: Add two matrices in Java
has comment: http://stackoverflow.com/comment/34900367
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22873559

http://stackoverflow.com/comment/34842508
score: 1
type: AnswerComment
has text: be careful how assertive you are about that last comment, specialized situations can call for specialized implementations: http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/CopyOnWriteArraySet.html
comment on: http://stackoverflow.com/a/22841583
type: Comment

http://stackoverflow.com/comment/34971160
type: Comment
score: 0
type: QuestionComment
has text: First, the Most Important thing is Do not Put Java code inside the JSPs, it is very bad practice.
comment on: http://stackoverflow.com/q/22912150

http://stackoverflow.com/comment/34961860
type: Comment
has text: Yes, i need spring to use features like wire-tap and interceptor.
comment on: http://stackoverflow.com/a/22872327
score: 0
type: AnswerComment

http://stackoverflow.com/comment/58388219
score: 1
comment on: http://stackoverflow.com/a/31547426
type: AnswerComment
type: Comment
has text: How does running as admin/sudo on a machine give you elevated privileges on a remote web-server or load balancer?

http://stackoverflow.com/comment/34852967
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22846348
has text: First question: yes. Second question: probably not (I assume the process is instantaneous from the user perspective). Third question: Writing sequential code as if it is parallel does not performs worse in theory. I'm not sure if there is some small overhead for the JVM when executing concurrency-related code. Parallel code is usually harder to manage (read, maintain etc.) from the programmer's point of view (subjective). See my edits to the answer.
type: AnswerComment

http://stackoverflow.com/q/22851355
has answer: http://stackoverflow.com/a/22851511
score: -1
downvote count: 1
type: AnsweredQuestion
tagged with: if-statement
has comment: http://stackoverflow.com/comment/34860503
tagged with: java
has answer: http://stackoverflow.com/a/22851474
has body: import java.util.Scanner; public class Assignment6 { public static void commandList() { System.out.println("Command Options------------"); System.out.println("a: Create a new table"); System.out.println("b: Change the row sizes"); System.out.println("c: Change the column sizes"); System.out.println("d: Change the data types"); System.out.println("e: Change the formats"); System.out.println("f: Display the table"); System.out.println("g: Display the log data"); System.out.println("?: Display this menu"); System.out.println("q: Quit the program"); System.out.println("---------------------------"); } public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Command Options------------"); System.out.println("a: Create a new table"); System.out.println("b: Change the row sizes"); System.out.println("c: Change the column sizes"); System.out.println("d: Change the data types"); System.out.println("e: Change the formats"); System.out.println("f: Display the table"); System.out.println("g: Display the log data"); System.out.println("?: Display this menu"); System.out.println("q: Quit the program"); System.out.println("---------------------------"); String input = ""; System.out.println("Please input a command:"); input = in.nextLine(); do { if (input.equals("a")) { System.out.println("a [Input three integers to ititialze a table:] "); int newTable = in.nextInt(); } else if (input.equals("b")) { System.out.println("Change the row sizes"); int newRow = in.nextInt(); } else if (input.equals("c")) { System.out.println("c [Type an integer to update the table column]: "); int newColumn = in.nextInt(); } else if (input.equals("d")) { System.out.println("d [Type an integer to update the data type]: "); int newDataType = in.nextInt(); } else if (input.equals("e")) { System.out.println("e [Type and integer to update printf format]: "); int newPrintf = in.nextInt(); } else if (input.equals("f")) { System.out.println("f [Display the table]"); } el…
possible better answer: http://stackoverflow.com/a/22851415
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/22851415
upvote count: 0
favorite count: 0
has title: How to take multiple user inputs using if-else statements in java.
tagged with: statements
accepted answer: http://stackoverflow.com/a/22851474
tagged with: menu

http://stackoverflow.com/a/22961248
has body: I hope, the snippet below might resolve the issue. String msg = "Invalid password entered. You have {0,number,integer} {0,choice, 1#attempt|1&lt;attempts} remaining."; int attemptCount = 1; System.out.println(MessageFormat.format(msg, attemptCount, attemptCount)); the result is, Invalid password entered. You have 1 attempt remaining.
type: Answer
answers question: http://stackoverflow.com/q/22960758
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22960758
has comment: http://stackoverflow.com/comment/35062274
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22835854
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34832026
favorite count: 0
has comment: http://stackoverflow.com/comment/34832359
tagged with: http://stackoverflow.com/tag/html
upvote count: 3
has body: Is it possible to to a XSL transformation mit xsl:output method set to HTML but without using HTML entities in the output? The output should either use numeric entities or no entities at all (as i am using UTF-8 entities are not required).
has answer: http://stackoverflow.com/a/22841080
has comment: http://stackoverflow.com/comment/34832673
tagged with: xslt
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/22841080
has comment: http://stackoverflow.com/comment/34831915
tagged with: java
tagged with: entities
type: Question
has comment: http://stackoverflow.com/comment/34845858
has title: Java: XSLT with output HTML but without HTML entities

http://stackoverflow.com/q/22858965
has answer: http://stackoverflow.com/a/22859267
has body: How to make generic method that will accept a specific MyObject or subtype of MyObject. Something like the below: public static Response sendResponse(accept MyObject or subtype of MyObject) { return response }
score: -4
has answer: http://stackoverflow.com/a/22859033
has comment: http://stackoverflow.com/comment/34873467
type: Question
has title: Generic method to accept specific object or its subtype
tagged with: java
downvote count: 4
answer count: 3
upvote count: 0
tagged with: generics
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22859110

http://stackoverflow.com/a/22916440
answers question: http://stackoverflow.com/q/22916116
has body: java.lang.VerifyError is caused when you have compiled against a different library than you are using at runtime. In runtime the error is thrown when the signature of the method isn't matching. Or when there's a compiler bug (a rare case though). Check this line: Could not find method com.google.android.gms.common.api.GoogleApiClient.isConnected, referenced........ It seems like you're not using the same library you used in compile time.
type: Answer
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22916116
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34978669

http://stackoverflow.com/a/22886978
type: Answer
has body: No you may need to write a small utility function which will help you achieving the same in Java you ca refer SO Answer here for the same here
answers question: http://stackoverflow.com/q/22886823
score: 0

http://stackoverflow.com/comment/34981099
type: QuestionComment
comment on: http://stackoverflow.com/q/22918360
score: 0
has text: Might be a duplicate of http://stackoverflow.com/questions/2043783/how-to-efficiently-performance-remove-many-items-from-list-in-java?rq=1
type: Comment

http://stackoverflow.com/q/22951278
has title: Scanner skips line in text file and doesn't print leading whitespace
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/22951316
has body: I want to read in a text file and print the responses in my Java program. My text file contains a number of lines, each containing a string of grades. Some of them have leading whitespace (indicating blanks). I'm having two problems: 1. the first line in the text file isn't printing; it starts from the 2nd line 2. one of the grade lines contains two "spaces" at the beginning indicating blanks; those blank spaces are not printing. Below is my code. Any input into how I can fix this? New programmer here so really appreciate your help. public static void printResponses (File f) throws FileNotFoundException { Scanner input = new Scanner (f); String line; int count = 1; while (input.nextLine() != null) { line = input.nextLine(); System.out.println ("Student #" + count +"\'s responses: " + line); count++; } System.out.println ("We have reached \"end of file!\"\n"); if (!f.exists()) { System.out.println ("An error occurred. Please try again."); System.exit(0); } }
tagged with: java
has comment: http://stackoverflow.com/comment/35040791
type: Question
has comment: http://stackoverflow.com/comment/35040838
has comment: http://stackoverflow.com/comment/35040853
score: 0
tagged with: file-io
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/22871232
accepted answer: http://stackoverflow.com/a/22871333
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22871333
type: Question
has body: There is a problem with the code for android applications I tried to assign multiple actions to a single button.Here's the code: import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity implements OnClickListener { AudioRecord audioRecord; private Thread recordingThread = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); start_button = (Button) findViewById(R.id.button1); stop_button = (Button) findViewById(R.id.button2); start_button.setOnClickListener(this); stop_button.setOnClickListener(this); createAudioRecorder(); } private void createAudioRecorder() { int sampleRate = 16000; int channelConfig = AudioFormat.CHANNEL_IN_MONO; int audioFormat = AudioFormat.ENCODING_PCM_16BIT; int minInternalBufferSize = AudioRecord.getMinBufferSize(sampleRate, channelConfig, audioFormat); int internalBufferSize = minInternalBufferSize * 4; Log.d(TAG, "minInternalBufferSize = " + minInternalBufferSize + ", internalBufferSize = " + internalBufferSize + ", myBufferSize = " + myBufferSize); audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, channelConfig, audioFormat, internalBufferSize); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button1: reading = true; startRecorder(); break; case R.id.button2: reading = false; stopRecorder(); break; } } private void startRecorder() { recordingThread = new Thread(new Runnable() { @Override public void run() { AudioData(); } }, "AudioRecorder Thread"); recordingThread.start(); } protected void AudioData() { audioRecord.startRecording(); byte data[] = new byte[myBufferSize]; byte[] myBuffer = new byte[myBufferSize]; int readC…
answer count: 1
score: 0
tagged with: android
has title: two actions for one button android (android)

http://stackoverflow.com/q/22834936
has comment: http://stackoverflow.com/comment/34830961
has answer: http://stackoverflow.com/a/22835150
has body: I have a class definition like below. I want it to be a singleton. public class MyClass { public static MyClass sInstance; public static final int STATUS_CONSTANT = 0; public int myProperty = 0; public static MyClass get() { if (sInstance==null) { sInstance= new MyClass(); } return sInstance; } } When using it, JetBrains IdeaJ warns me that the comparison always returns false... MyClass myClass = MyClass.get(); if (myClass.myProperty == MyClass.STATUS_CONSTANT) { ... } ...whereas, it doesn't say anthing if I make it this way: if (MyClass.get().myProperty == MyClass.STATUS_CONSTANT) I did not get why it's angry about the first method!? In either way, it should be referencing the same static field (sInstance).
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34843486
has comment: http://stackoverflow.com/comment/34830401
tagged with: java
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/34830475
type: Question
has comment: http://stackoverflow.com/comment/34831019
has comment: http://stackoverflow.com/comment/34830564
has title: Basic comparison always returns false
has comment: http://stackoverflow.com/comment/34830746
score: -1
accepted answer: http://stackoverflow.com/a/22835150
has comment: http://stackoverflow.com/comment/34830438
tagged with: intellij-idea
answer count: 1
favorite count: 0
tagged with: static-members

http://stackoverflow.com/a/22819490
upvote count: 3
has comment: http://stackoverflow.com/comment/34803611
has body: By itself, there is nothing illegal happening from what you've described. But you're being very vague. What do you mean by "generates a meaningful url"? Generates how? What determines "meaningful"? Downloading the html given by the server at the requested url is exactly what a browser does. Nothing odd there. Browsers also read that html and build a document from it to display to a user. What do you mean by "extracts useful info from it"? What do you do with the resulting info? Are you bypassing any security, or spamming the same server with massive numbers of requests? Are you doing anything that violates someone's privacy? Are you reposting any of the information you gathered without referring back to its original source? What is it about your project that is even raising a red flag in your mind about legality? These are the sorts of questions you should be asking yourself.
has comment: http://stackoverflow.com/comment/34802992
has comment: http://stackoverflow.com/comment/34803989
score: 3
has comment: http://stackoverflow.com/comment/34803639
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34803435
has comment: http://stackoverflow.com/comment/34803380
type: Answer
answers question: http://stackoverflow.com/q/22819287
accepted answer of: http://stackoverflow.com/q/22819287

linux
tags question: http://stackoverflow.com/q/22956975
tags question: http://stackoverflow.com/q/22886083
tags question: http://stackoverflow.com/q/22942419
tags question: http://stackoverflow.com/q/22846081
tags question: http://stackoverflow.com/q/22932453
tags question: http://stackoverflow.com/q/22918630
tags question: http://stackoverflow.com/q/22869300
tags question: http://stackoverflow.com/q/22952058
tags question: http://stackoverflow.com/q/22849811
type: Tag
tags question: http://stackoverflow.com/q/22968181
tags question: http://stackoverflow.com/q/22863510
tags question: http://stackoverflow.com/q/22857072
tags question: http://stackoverflow.com/q/22954916
tags question: http://stackoverflow.com/q/22880334
tag name: linux
tags question: http://stackoverflow.com/q/22811908
tags question: http://stackoverflow.com/q/22907986
tags question: http://stackoverflow.com/q/22927480
tags question: http://stackoverflow.com/q/22916476
tags question: http://stackoverflow.com/q/22955813
tags question: http://stackoverflow.com/q/22845489
tags question: http://stackoverflow.com/q/22886960
tags question: http://stackoverflow.com/q/22809576

http://stackoverflow.com/q/22812461
has comment: http://stackoverflow.com/comment/34798309
upvote count: 10
has answer: http://stackoverflow.com/a/27323966
tagged with: gradle
type: Question
has title: Using Proguard in Gradle - can't find referenced class java.lang.String
tagged with: java
has answer: http://stackoverflow.com/a/23399850
has body: I'm trying to configure ProGuard as part of my Gradle build scripts for a java application in Ubuntu, accessed through bash, but I can't seem to get it right. I've never used either technology before. Using the ProGuard Manual I wrote the following task, which I currently call on a pre-existing jar file while I try and get something working. task obfuscate(type: proguard.gradle.ProGuardTask) { injars 'build/libs/myapplication.jar' outjars 'build/libs/myapplication_out.jar' libraryjars '&lt;java.home&gt;/lib/rt.jar' printmapping 'myapplication.map' keep 'public class mypackage.MyMainClass { \ public static void main(java.lang.String[]); \ }' } I get back a lot of lines stating missing built in java library files such as: Warning: myclasses: can't find referenced class java.lang.String At the bottom of the list I also see: Could not call ProGuardTask.proguard() If I check my output directory, I can see it created the directory structure but not the jar file and this is what I see if I run my gradle task with stacktrace on: Caused by: org.gradle.api.GradleException: Could not call ProGuardTask.proguard() on task I had a look on the proguard trouble shooting page and it said that I should make sure I'm specifying the run-time library of my platform and that for JSE this is lib/rt.jar. You can see that up there in the library jars argument. What have I missunderstood?
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 10
tagged with: proguard

http://stackoverflow.com/comment/35037510
comment on: http://stackoverflow.com/a/22948424
has text: Alright. I changed the array size to 10. Now here is the output when I try to input the social security number and the salary. _Enter social security number12345678 Enter salary1000 Please input next security numbers or -1 to quit123456 Enter salary20000 Please input next security numbers or -1 to quit4000000 Enter salary12212 Please input next security numbers or -1 to quit_
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22821073
answer count: 1
has answer: http://stackoverflow.com/a/22837563
has title: Image field as part of the FieldGroup in Vaadin7
favorite count: 0
upvote count: 2
tagged with: vaadin7
has body: I have a requirement to display the image as part of the FieldGroup. This is for the functionality where the Image appears as normal on a web page, when in edit mode I need to edit this image value by providing an 'upload' option. I have a Pojo with a property of type com.vaadin.ui.Image along with the other String and Integer values. public Image getImage() { return image; } public void setImage(Image image) { this.image = image; } I need to work this Image as a normal form element, for example when I edit a form, I have an editable TextField to type in the String value and change it, the same way I intend to display an upload button where I would have an option to replace the existing image. I have tried using EasyUploads addon for this purpose by intercepting the build method of FieldGroup and specifying the Image field as of type org.vaadin.easyuploads.UploadField Like this; @Override @SuppressWarnings({ "rawtypes", "unchecked" }) protected &lt;T extends Field&gt; T build(String caption, Class&lt;?&gt; dataType, Class&lt;T&gt; fieldType) throws BindException { T field = super.build(caption, dataType, fieldType); if (caption.equalsIgnoreCase("image")) { final UploadField imageField = new UploadField() { @Override protected void updateDisplay() { final byte[] pngData = (byte[]) getValue(); String filename = getLastFileName(); String mimeType = getLastMimeType(); long filesize = getLastFileSize(); if (mimeType.equals("image/jpeg")) { StreamSource imagesource = new ImageSource(pngData); StreamResource resource = new StreamResource( imagesource, "Uploaded File"); Embedded embedded = new Embedded("Image:" + filename + "(" + filesize + " bytes)", resource); getRootLayout().addComponent(embedded); } else { super.updateDisplay(); } } }; imageField.setFieldType(FieldType.BYTE_ARRAY); ... This however fails to display the already available image, errors out with the stacktrace: Caused by: java.lang.IllegalArgumentException: Property type class com.vaadin.ui.Image is not co…
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/22837563
tagged with: java
tagged with: vaadin
tagged with: image
type: Question
downvote count: 0

http://stackoverflow.com/a/22847191
has body: Try this: z.setFont(z.getFont().deriveFont(Font.BOLD, 14f)); deriveFont() has the advantage of being able to base your new font on the existing one. This will maintain the font characteristics that you don't mean to change.
answers question: http://stackoverflow.com/q/22847148
type: AcceptedAnswer
score: 18
has comment: http://stackoverflow.com/comment/34852596
upvote count: 18
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22847148

http://stackoverflow.com/q/22851377
answer count: 2
has answer: http://stackoverflow.com/a/22851601
tagged with: macos
type: UnansweredQuestion
tagged with: java-home
has answer: http://stackoverflow.com/a/22851700
has body: I have jdk installed under "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" When i do a "which java", it returns "/usr/bin/java" But, I want which java to return /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java, instead of /usr/java/bin How can this be done? and what is happening behind the scenes?
has title: which java command should return custom java installation path
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/34817350
score: 0
comment on: http://stackoverflow.com/q/22827577
type: Comment
has text: @RafaEl `replace()` replaces all copies too, just not using regex,so the best advice is to *not* use `replaceAll()` because regex is not required.
type: QuestionComment

http://stackoverflow.com/a/22872327
has body: An EAR application is not standalone, but requires a Java EE application server to run. This official tutorial shows a basic JMS sample as an EAR application. You need to download and setup the Glassfish application server, Netbeans IDE and tutorial source code, instructions are found here.
answers question: http://stackoverflow.com/q/22857180
has comment: http://stackoverflow.com/comment/34959990
score: 0
has comment: http://stackoverflow.com/comment/34958789
has comment: http://stackoverflow.com/comment/34961860
type: Answer

http://stackoverflow.com/comment/34925577
has text: Well how can I create a costum TableModel from the annotations?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22887192

http://stackoverflow.com/a/22898685
score: 0
type: Answer
has body: To write data into a file, you should first create it, or, check if it exists.Otherwise, an IOException will be raised. Writing in C:\ is denied by default, so in your case even if you created the file you will get an IOException with an Access denied message. public static void main(String[] args) throws IOException { File output = new File("data.txt"); if(!output.exists()) output.createNewFile(); try { DataOutputStream out = new DataOutputStream(new FileOutputStream(output)); for (int i = 0; i &lt; 10; i++) { out.write(i); } } catch (IOException ioe) { System.out.println("No file exist"); } }
answers question: http://stackoverflow.com/q/22898539

http://stackoverflow.com/q/22933561
answer count: 2
has comment: http://stackoverflow.com/comment/35008932
accepted answer: http://stackoverflow.com/a/22933938
score: 0
has comment: http://stackoverflow.com/comment/35009328
has comment: http://stackoverflow.com/comment/35008694
has title: Specifying directory path for data base connectivity
possible better answer: http://stackoverflow.com/a/22934047
has body: I have a Dynamic web project ,in that i am creating config.properites file for Data base connectivity. SampleProject -&gt;WebContent -&gt;WEB_INF -&gt;config.properties -&gt;Index.jsp i am reading Connectivity Details from configuration file in Index.jsp as follows Properties props = new Properties(); FileInputStream in = new FileInputStream("WEB-INF/config.properties"); props.load(in); in.close(); String driver = props.getProperty("driver"); String url = props.getProperty("url"); String username = props.getProperty("username"); String password = props.getProperty("password"); class.forName(driver); Connection con = DriverManager.getConnection(url, username, password); but it's throwing org.apache.jasper.JasperException: An exception occurred processing JSP page /Index.jsp at line 66 63: 64: 65: FileInputStream in1 = 66: new FileInputStream("WEB-INF/config.properties"); 67: props.load(in1); 68: in.close(); 69: Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:553) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:447) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) root cause java.io.FileNotFoundException: WEB-INF/config.properties (No such file or directory) java.io.FileInputStream.open(Native Method) java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:137) java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:96) exception.. can anyone help me how to give the directory path?
has answer: http://stackoverflow.com/a/22934047
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35009445
has answer: http://stackoverflow.com/a/22933938
tagged with: java
tagged with: mysql
type: Question

c#
tags question: http://stackoverflow.com/q/22939344
tags question: http://stackoverflow.com/q/22813318
tags question: http://stackoverflow.com/q/22826674
tags question: http://stackoverflow.com/q/22946591
tag name: c#
tags question: http://stackoverflow.com/q/22859544
tags question: http://stackoverflow.com/q/22953714
tags question: http://stackoverflow.com/q/22940392
tags question: http://stackoverflow.com/q/22906588
tags question: http://stackoverflow.com/q/22870917
tags question: http://stackoverflow.com/q/22948704
tags question: http://stackoverflow.com/q/22933292
tags question: http://stackoverflow.com/q/22900456
tags question: http://stackoverflow.com/q/22967626
tags question: http://stackoverflow.com/q/22941081
tags question: http://stackoverflow.com/q/22927541
type: Tag
tags question: http://stackoverflow.com/q/22870898
tags question: http://stackoverflow.com/q/22821554
tags question: http://stackoverflow.com/q/22968085
tags question: http://stackoverflow.com/q/22813994
tags question: http://stackoverflow.com/q/22874483
tags question: http://stackoverflow.com/q/22899191
tags question: http://stackoverflow.com/q/22929460
tags question: http://stackoverflow.com/q/22870200

http://stackoverflow.com/comment/35019228
type: Comment
comment on: http://stackoverflow.com/a/22939321
type: AnswerComment
score: 0
has text: Perhaps that is true but it is a little late to make changes know, especially since i really have not had any exposure to the HttpServer API. My application is in javaFX and everything that is complicated is done there. I just need to be able to access a function that will return a double based on two double parameters, that is the only thing i need the java integration for. It may be quick and dirty, but at this stage in my development phase and given the simplicity of the request, this is all i need.

http://stackoverflow.com/q/22917572
type: Question
has comment: http://stackoverflow.com/comment/34982431
answer count: 1
tagged with: jtable
score: 0
has answer: http://stackoverflow.com/a/22929094
accepted answer: http://stackoverflow.com/a/22929094
has body: How can I select only the first cell of every row in a jtable, one at a time while the other cells cant be selected? My code is: jTable5.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e){ int i=jTable5.getSelectedColumn(); System.out.println(i); if(i==0) { jTable5.setCellSelectionEnabled(true); jTable5.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); } else{ jTable5.setCellSelectionEnabled(false); } } }); Still,while moving on the cell of second column,it first select that cell and then deselect it.
tagged with: swing
type: AnsweredQuestion
tagged with: row
tagged with: java
has title: How to select only the first cell of every row in a jtable, one at a time while the other cells cant be selected

http://stackoverflow.com/a/22875102
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22873658
type: Answer
upvote count: 2
has body: If you look at one of the implementations of CtClass, like CtClassType, you will see that getMethods() is implemented that way: public CtMethod[] getMethods() { HashMap h = new HashMap(); getMethods0(h, this); return (CtMethod[])h.values().toArray(new CtMethod[h.size()]); } According to the HashMap javadoc: This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time. So, you have absolutely no guarantee in what order you will get the methods. For the fields, the code is a lot more complicated, but it seems that the raw class file is read as an InputStream: DataInputStream in = new DataInputStream( new FileInputStream(args[0])); ClassFile w = new ClassFile(in); And the fields are created as they are read from this stream: fields = new ArrayList(); for (i = 0; i &lt; n; ++i) addField2(new FieldInfo(cp, in)); So, the fields are created in the order they are in the class file. However, reading the JVM Specification and the Java Language Specification, I see no reference to the fields order in the generated class; this sentence from the Java Specification even seems to indicate that the fields order is not important: Using their scheme, here is a list of some important binary compatible changes that the Java programming language supports: [...] Reordering the fields, methods, or constructors in an existing type declaration. So I think that you have absolutely no guarantee on the fields order too. I tried to run javassist.tools.Dump on a test class I created with a large number of fields and methods, and it seems that fields and methods are printed in the source order, but I still think that nothing guarantee it.
accepted answer of: http://stackoverflow.com/q/22873658
score: 2

http://stackoverflow.com/q/22938738
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22939069
tagged with: java
has title: Using BufferedReader and Scanner to read text
has body: I am studying Java and using BlueJ so my question relates to part of an assignment I have been asked to do. Some of it works but I am having problems with other parts. I will include everything that I have done in the class so far but first here are the requirements: Prompt user to select an appropriate file // done and working Use BufferedReader and Scanner objects to read a file line by line // done and assume working! As each line containing the name and age of a runner is read, a new Runner object should be created and its instance variable set as follows: // Class Runner already created // Class MathatonAdmin - current class. 3a) name - can be set directly using the value from the file. // tested with System.out.println and all values (in display panel) are shown (*). 3b) ageGroup - can be worked out from the given age: runners under 18 should be categorised as junior, 55 and older as senior, all else as standard. // tested with System.out.println and all values (in display panel) are shown (*). 3c) The instance of Runner should be added to the list referenced by the instance variable runners. Essentially when I run the test code provided: MarathonAdmin ma = new MarathonAdmin(); ma.readInRunners(); I am supposed t o see a list of runners when I inspect ma; currently one the name and age of a single person is listed. So I need help with 3a - 3c. How do I create a new instance of Runner with said variables, then add the instance Runner to the list in runners? I have tried a for loop in while loop but since I am guessing the for loop I do not get the required list in the variable ma. I am using System.out.println for testing that I at lest have the correct file. Any help or advice will be appreciated. The class MarathonAdmin: import java.util.*; import java.io.*; import ou.*; /** * MatharthonAdmin Class * * @author Stephen Berry * @version 28/03/14 */ public class MarathonAdmin { // instance variables private String runners; private String age; /** * Constructor f…
has answer: http://stackoverflow.com/a/22958549
type: Question
tagged with: bluej
answer count: 3
downvote count: 0
tagged with: bufferedreader
favorite count: 0
has answer: http://stackoverflow.com/a/22939139
upvote count: 2

http://stackoverflow.com/comment/34911122
comment on: http://stackoverflow.com/q/22879490
score: 0
type: Comment
type: QuestionComment
has text: i am stucked in the loop logic.not able to implement.

http://stackoverflow.com/a/22914154
has body: Actually, you should create/initialize objects if and only if you need them. Assuming that you create an array of your objects and each index initially holds a (object-)reference, a user of you api could get the feeling that there is actual data stored in that array. But the truth is, you have a bunch of redundant references to nowhere and because of that no NpE is thrown. That will possibly create some issues where a NpE would have clearly shown "nothin in here"
upvote count: 1
has comment: http://stackoverflow.com/comment/34973286
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22913851
has comment: http://stackoverflow.com/comment/34973528
has comment: http://stackoverflow.com/comment/34973180
type: Answer
has comment: http://stackoverflow.com/comment/34973271
has comment: http://stackoverflow.com/comment/34973379

http://stackoverflow.com/q/22837139
type: UnansweredQuestion
tagged with: loops
type: Question
linked to: http://stackoverflow.com/q/10056729
tagged with: java
has answer: http://stackoverflow.com/a/22960355
answer count: 2
has answer: http://stackoverflow.com/a/78020857
has body: I having a really hard time finding a plateau within an array. What I'm looking for is length and location of the longest sequence of equal values where the numbers on both sides are smaller. Now I know there could be two or more valid plateaus with same length ideally I would like to print the plateau with a higher value. I have created an array[40] and a Random obj. To fill the array, once I have filled it I know I will need a loop to check the indexes. But thats where the confusion comes in. I have tried using a for loop to find the plateau but my results would just increase the value stored within the index. Any points in the right direction I would greatly appreciate it. import java.util.Random; public class Plateau { public static void main(String[]args) { int[] array1 = new int[40]; Random genrator = new Random(); for (int i = 0; i &lt; array1.length; i++) { array1[i] = genrator.nextInt(21 - 1); } for(int i = 0; i &lt; array1.length; i++) { System.out.print(array1[i] + " "); } System.out.println("\n"); for (int i = 0; i &lt; array1.length; i++) { if (array1[i] &lt; array1[i] + 1) { System.out.println(array1[i] + " "); } } } }
score: 0
has title: Finding plateau in Java Array
has comment: http://stackoverflow.com/comment/34833997

http://stackoverflow.com/a/22885411
has comment: http://stackoverflow.com/comment/34921836
upvote count: 2
has comment: http://stackoverflow.com/comment/34924243
has comment: http://stackoverflow.com/comment/34924340
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34923453
has comment: http://stackoverflow.com/comment/34923570
accepted answer of: http://stackoverflow.com/q/22885156
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22885156
has comment: http://stackoverflow.com/comment/34924271
has comment: http://stackoverflow.com/comment/34924051
has comment: http://stackoverflow.com/comment/34924892
has comment: http://stackoverflow.com/comment/34923847
has comment: http://stackoverflow.com/comment/34924102
has body: Use char[] ppaswd = pass.getPassword(); instead of String ppaswd = pass.getText(); because The method getText() from the type JPasswordField is deprecated. As @MadProgrammer says: The password is stored in a char array and you never convert it back to a String. Strings live in the JVM for the life of JVM, making easier for nasty people examine the String pool and find the passwords. Use a Map to store username/password. Map<String, char[]> map = new HashMap<String, char[]>(); put some initial values map.put("test", "12345".toCharArray()); map.put("admin", "admin".toCharArray()); Here is the modified code public void actionlogin() { blogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { String puname = txuser.getText(); char[] ppaswd = pass.getPassword(); if (map.keySet().contains(puname) && Arrays.equals(map.get(puname), ppaswd)) { JOptionPane.showMessageDialog(null, "Correct Information", "Correct", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(null, "No Password/ID Found on System", "Incorrect", JOptionPane.INFORMATION_MESSAGE); txuser.setText(""); pass.setText(""); txuser.requestFocus(); if (radNew.isSelected()) { if (!puname.equals("") && ppaswd.length > 0) { map.put(puname, ppaswd); } JOptionPane.showMessageDialog(null, "Re-enter your password and ID to confirm", "Information Saved", JOptionPane.INFORMATION_MESSAGE); } } } }); }
has comment: http://stackoverflow.com/comment/34924849
has comment: http://stackoverflow.com/comment/34924879
has comment: http://stackoverflow.com/comment/34923751
has comment: http://stackoverflow.com/comment/34924216
score: 1
has comment: http://stackoverflow.com/comment/34923420
has comment: http://stackoverflow.com/comment/34924432
has comment: http://stackoverflow.com/comment/34924832

http://stackoverflow.com/a/22896495
has comment: http://stackoverflow.com/comment/34941795
accepted answer of: http://stackoverflow.com/q/22896428
score: 0
answers question: http://stackoverflow.com/q/22896428
type: AcceptedAnswer
type: Answer
has body: This is because your while loop is infinite. The loop does not modify iAddDiceRoll2, so it is never going to be equal to 7. Could it be that you forgot the braces around the body of the loop? I am talking about this loop: while (iAddDiceRoll2 != 7) if (iAddDice == iAddDiceRoll2) {sResults.concat("Congratulations, you win!"); break; }else{ sResults = "Point is " + iAddDice + "\n"; } And I think you meant this: while (iAddDiceRoll2 != 7) { if (iAddDice == iAddDiceRoll2) {sResults.concat("Congratulations, you win!"); break; }else{ sResults = "Point is " + iAddDice + "\n"; } iDice1 = (int) (Math.random() *6+1); iDice2 = (int) (Math.random() *6+1); iAddDiceRoll2 = iDice1 + iDice2; sResults.concat("You rolled " + iAddDiceRoll2 + "\n"); }

http://stackoverflow.com/q/22846942
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34852023
tagged with: class
has answer: http://stackoverflow.com/a/22847333
score: 0
has comment: http://stackoverflow.com/comment/34853040
answer count: 1
has title: How do I invoke a method on an instance of a class that isn't yet defined?
has body: I have a class called Dev, that contains a method called addToTasksAssigned that adds tasks to an ArrayList public void addToTasksAssigned(String newTask){ tasksAssigned.add(newTask); } In my task class, I have a method called setAssignedDev. I want this to add the input of this function to the list of tasks assigned in Dev: public void setAssignedDev(String newDev){ this.assignedDev=newDev; newDev.addToTasksAssigned(getProject()); //getProject() here is just the task name } I understand that I cannot call upon a class that doesn't exist yet, which is why the code doesn't work. Is there a way of restricting the 'String newDev' input so that it has to be an instance of the Dev class? Is there no way of referencing instances of classes from other classes? Thanks
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34852004
type: UnansweredQuestion
tagged with: instance
tagged with: methods

http://stackoverflow.com/comment/34903692
type: Comment
type: QuestionComment
score: 0
has text: @MikkelLøkke The trade-off isn't that you get 'less accurate digits', whatever that means. The trade-off is that you get 53 *bits* of precision, *in binary radix,* which is *incommensurable* with decimal radix, i.e. with *any* specific number of decimal digits other than those that agree with the negative powers of two.
comment on: http://stackoverflow.com/q/22860598

http://stackoverflow.com/comment/34835976
has text: You cant post the image, but you can always post the link of the image to other image server. We will updated the image in your question. :)
comment on: http://stackoverflow.com/q/22838251
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34910703
score: 0
type: Comment
type: QuestionComment
has text: Could you give me an example of an explicit join using the above code?
comment on: http://stackoverflow.com/q/22846983

http://stackoverflow.com/comment/34952164
score: 0
type: QuestionComment
type: Comment
has text: You cannot store that many digits in the observable universe.
comment on: http://stackoverflow.com/q/22902200

http://stackoverflow.com/q/22905396
has comment: http://stackoverflow.com/comment/34965844
type: Question
has comment: http://stackoverflow.com/comment/34961609
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34960612
has comment: http://stackoverflow.com/comment/34989770
has body: I have this code that outputs the tfidf for all words in each file in the directory. I'm trying to transfer this to a matrix where each row correspond to each file in the directory and each column to all words in the files and I have some difficulty in doing it and i need some help. what i get is a java.lang.NullPointerException when i try to output the matrix. The values start to appear but for some reason they stop and the null error generates. this is the code public class TestTF_IDF { public static void main(String[] args) throws UnsupportedEncodingException, FileNotFoundException{ //Test code for TfIdf TfIdf tf = new TfIdf("E:/Thesis/ThesisWork/data1"); //Contains file name being processed //String file; tf.buildAllDocuments(); int numDocuments = tf.documents.size(); Double matrix[][] = new Double[numDocuments][]; int documentIndex = 0; for (String file : tf.documents.keySet()) { // System.out.println("File \t" + file); Map&lt;String, Double[]&gt; myMap = tf.documents.get(file).getF_TF_TFIDF(); int numWords = myMap.size(); matrix[documentIndex] = new Double[numWords]; int wordIndex = 0; for (String key : myMap.keySet()) { Double[] values = myMap.get(key); matrix[documentIndex][wordIndex] = values[2]; wordIndex++; //System.out.print("file="+ file+ "term=" +key + values[2]+" "); } documentIndex++; for(int i=0; i&lt;numDocuments;i++){ for(int j=0; j&lt;numWords;j++){ System.out.print("file="+ file+ matrix[i][j]+ " "); //error here } } } }//public static void main(String[] args) }//public class TestTF_IDF Any ideas. Thanks
has title: java.lang.NullPointerException output term frequency-inverse document frequency (tfidf) matrix java
score: 0
tagged with: matrix
answer count: 1
has comment: http://stackoverflow.com/comment/34962490
has comment: http://stackoverflow.com/comment/34985659
tagged with: tf-idf
has comment: http://stackoverflow.com/comment/34968998
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22914331
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/34987452

http://stackoverflow.com/a/22907065
score: 0
type: Answer
has body: "I suspect methodB is what most people would choose but why?" not really, methodA updates field month in object d1,same as method methodB will do, and as method methodB returns passed object, return statement is redundant which means most people actually go with methodA
answers question: http://stackoverflow.com/q/22906907

http://stackoverflow.com/a/22958446
answers question: http://stackoverflow.com/q/22957431
downvote count: 0
score: 1
upvote count: 1
has body: With subtaction DateFormat df = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss.SSSS", Locale.ENGLISH); System.out.println( df.parse(line2).getTime() - df.parse(line1).getTime() );
type: Answer

http://stackoverflow.com/q/22860865
score: 0
has comment: http://stackoverflow.com/comment/34877048
answer count: 1
has comment: http://stackoverflow.com/comment/34877141
has comment: http://stackoverflow.com/comment/34877480
tagged with: exception
has answer: http://stackoverflow.com/a/22861248
accepted answer: http://stackoverflow.com/a/22861248
has comment: http://stackoverflow.com/comment/34876822
has title: Exception in thread "main" java.util.NoSuchElementException?
type: Question
type: AnsweredQuestion
has body: i am trying to extract value from web site and inserting value in my db when i am going to insert data in my db i am getting exeception Exception is : Exception in thread "main" java.util.NoSuchElementException here is my code public class ScrapCom { Statement st = null; Connection cn = null; public static void main(String args[]) throws InterruptedException, ClassNotFoundException, SQLException { int j = 0; WebDriver driver = new HtmlUnitDriver(BrowserVersion.getDefault()); String sDate = "27/03/2014"; 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("Jo"); 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")); String htmlTableText = findElement.getText(); // do whatever you want now, This is raw table values. 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); StringTokenizer str = new StringTokenizer(htmlTableText); while (str.hasMoreElements()) { for (int i = 0; i &lt; 4; i++) { String no = str.nextElement().toString(); String city = str.nextElement().toString(); String mandi = str.nextElement().toString(); String price = str.nextElement().toString(); Class.forName("com.mysql.jdbc.Driver"); Connection cn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mandi", "root", ""); //insert them into the database PreparedStatement ps = cn.prepareStatement("insert into commoditywise values(?,?,?,?)"); ps.setString(1, no); ps.setString(2, city); ps.setString(3, mandi); ps.setString(4, pr…
tagged with: java

http://stackoverflow.com/a/22928944
answers question: http://stackoverflow.com/q/22928858
score: 0
type: Answer
has body: Once you switch to the iframe, Selenium's point of reference is everything contained in the iframe. To check if Selenium has the correct reference, test for an element inside of the iframe. As a side note, you can simplify your switchTo: driver.switchTo().frame("previewFrame");

http://stackoverflow.com/comment/35045327
type: AnswerComment
comment on: http://stackoverflow.com/a/22936708
has text: what is the value of <%=uploadFilePath%>/<c:out value='${filename}'/>
type: Comment
score: 0

http://stackoverflow.com/a/22867919
answers question: http://stackoverflow.com/q/22858125
has body: restricted access - yes the reason is that JavaFX is on the extension classpath hence it is treated as an implementation detail of the VM by Eclipse Runtime problem is because JavaFX packages ARE NOT part of any EE hence you can not find them in an OSGi-Env It does not make sense to use launch a JavaFX-Application inside an SWT-IDE plugin there you use an FXCanvas which will lead to your next problem because this is not on ANY classpath at all because it depends on SWT (you find it in your jre/lib/jfxswt.jar) My suggestion is: Do yourself some a favor and install e(fx)clipse e.g. you can get an all in one download from http://efxclipse.bestsolution.at/install.html or use the update-site from http://www.efxclipse.org/install.html and follow https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2 if you want to go pure fx (no swt involved) then https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial3 and https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial4 are probably interesting to you
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/34858874
type: QuestionComment
has text: @Ordous Interesting to hear about this Joda-Time 1.6. Sounds suspicious. If you can extract the exact signature of `compareTo()` via reflection at runtime and the argument type of this method is `Object` then you have the 1.6-version of joda-`DateTime`.
type: Comment
comment on: http://stackoverflow.com/q/22810331
score: 0

http://stackoverflow.com/comment/34837316
type: QuestionComment
has text: @SotiriosDelimanolis Yes I know, but aren't Spring's ControllerAdvice and ExceptionHandler implemented using AOP for exactly the same purpose?
comment on: http://stackoverflow.com/q/22838951
score: 0
type: Comment

http://stackoverflow.com/q/22961140
has comment: http://stackoverflow.com/comment/35058470
type: Question
tagged with: exception
tagged with: cryptography
linked to: http://stackoverflow.com/q/16653754
score: 0
tagged with: java
answer count: 2
has title: Chat Application - Cryptography
has comment: http://stackoverflow.com/comment/35058468
has comment: http://stackoverflow.com/comment/35057850
has comment: http://stackoverflow.com/comment/35087529
has body: I have created a chat application and to finish it I have to implement some Cryptography algorithm to secure the messages between server - client. My implementation is: 1.Client creates kaypair (public and private key) and sends public key to server. 2.Server gets public key and creates symmetric key encrypted with the public key. 3.Server sends the encrypted key to Client. 4.Client unlocks symmetric key with private key. 5.Client and Server communicate with Symmetric key. This part of the code is where the server gets the public key and sends the symmetric key encrypted else if(msg.type.equals("pubKey")){ pubKey = msg.content; //get public key String key = Arrays.toString(crypt.geteKey()); clients[findClient(ID)].send(new Message("symmKey", "SERVER", key, msg.sender));//! //send symmetric key encrypted with public key } Key encryption method: public void keyEncryption() throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException{ Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); eKey = cipher.doFinal(key.getBlowfishKeyBytes()); //symmetric key encrypted with public key //System.out.println("2. cipherText= " + bytesToHex(symmKey)); } How I get encrypted symmetric key from server: else if(msg.type.equals("symmKey")){ symmKey = (String) msg.content; //get encrypted symmetric key (must unlock with private key) } The Server Message class: (Client Message class has "object content" instead of String) package com.socket; import java.io.Serializable; public class Message implements Serializable{ private static final long serialVersionUID = 1L; public String type, sender,content, recipient; public Message(String type, String sender, String content, String recipient){ this.type = type; this.sender = sender; this.content = content; this.recipient = recipient; } @Override public String toString(){ return "{type='"+type+"', sender='"+sender+"', content='"+content…
has comment: http://stackoverflow.com/comment/35058096
has answer: http://stackoverflow.com/a/22961691
type: UnansweredQuestion
tagged with: chat
has answer: http://stackoverflow.com/a/42325733
has comment: http://stackoverflow.com/comment/35057963

http://stackoverflow.com/a/22916086
type: Answer
answers question: http://stackoverflow.com/q/22914446
has body: Keeping properties files in Artifactory is a good practice. Make sure to tie them with the application binaries by using properties (e.g. build-name, build-number, etc). You can automate this by using build integration features of Artifactory and tagging the artifacts and the properties files during the deployment.
score: 0

http://stackoverflow.com/q/22909099
tagged with: java
has comment: http://stackoverflow.com/comment/34964236
type: Question
has answer: http://stackoverflow.com/a/22909132
has answer: http://stackoverflow.com/a/22909122
has comment: http://stackoverflow.com/comment/34964069
score: 0
answer count: 3
has title: My Android App Crashes on Launch
has body: I'm trying to build a basic app that displays newstories (currently hardcoded into the Strings.xml file). But it keeps crashing on launch, even though there are no errors being shown in the code. Here's the Java part of my code (I can also supply any other files, or even a zipped copy of my workspace if that'll help anyone) package cara.app; import android.os.Build; import android.os.Bundle; import android.annotation.SuppressLint; import android.app.Activity; import android.content.res.Resources; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { final Resources res = getResources(); final TextView textView = new TextView(null); final Button next = (Button) findViewById(R.id.LinearLayout1); @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button button = (Button) findViewById(R.id.LinearLayout1); button.setText("" + res.getString(R.string.News) + "\n\n" + res.getString(R.string.Story_Title_1) + "\n\n" + res.getString(R.string.Story_Title_2) + "\n\n" + res.getString(R.string.Story_Title_3) + "\n\n" + res.getString(R.string.Story_Title_4) + "\n\n" + res.getString(R.string.Story_Title_5)); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { OpenNews(); } }); // Make sure we're running on Honeycomb or higher to use ActionBar APIs if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { // Show the Up button in the action bar. getActionBar().setDisplayHomeAsUpEnabled(true); } } public void selfDestruct(View view) { // Boom } @SuppressLint("NewApi") @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; } public void OpenNews() { // Create the text view textView.setTextSize(4…
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22909156

http://stackoverflow.com/q/22951431
possible better answer: http://stackoverflow.com/a/22951772
tagged with: android
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22952422
type: Question
has answer: http://stackoverflow.com/a/22951571
has answer: http://stackoverflow.com/a/22951772
accepted answer: http://stackoverflow.com/a/22951571
has comment: http://stackoverflow.com/comment/35041022
has body: Alright so I'm trying to have dynamic buttons setup up, I've got the dynamic imaging to be setup through a switch and I'm trying to figure out what I need to put in the (View v) field of setting a specific method, below is the parts of my code that will be using this function: This is the method that I use to set the image resource to the imageview on the current activity: (i removed case 2+ etc as its the same code with different resource) public void setActivity(ImageView activityNum, int activity) { switch (activity) { case 1: activityNum.setImageResource(R.drawable.hello); activityNum.setOnClickListener(Hello(View v)); break; case 2: etc... } } This is the method which plays the sound I have set, as it is just now in the xml code if i have " android:onClick="Hello" " this method works fine, but I am trying to figure out how to set the previous method where it is required and not just static. I assume I need to put the current activity in which would be activity_wednesday however I am not sure how to implement this. public void Hello(View v) { player12 = MediaPlayer.create(this, R.raw.hello); player12.start(); }
score: 0
answer count: 3
has title: How to use setOnClickListener what to put in View v for a preset method?

http://stackoverflow.com/comment/34958916
has text: edited my question. i create this interface to notify me when asyntask finished its execution. so i want to do when asyntask done (in sqlite helper class) its exection, then i need to populate my database but i want to do this in sqlite helper class not in mainactivity.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22905950

android-custom-view
tags question: http://stackoverflow.com/q/22862337
tag name: android-custom-view
tags question: http://stackoverflow.com/q/22869750
type: Tag

http://stackoverflow.com/comment/34963548
type: QuestionComment
has text: It might be worthwhile to take a look at the Disruptor library http://lmax-exchange.github.io/disruptor/ which provides a circular buffer implementation for java, avoiding locking in most/all cases.
type: Comment
comment on: http://stackoverflow.com/q/22843397
score: 0

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

http://stackoverflow.com/q/22820177
tagged with: user-interface
answer count: 1
has answer: http://stackoverflow.com/a/22821805
has title: Weird layout using GridBagConstraints
tagged with: swing
has comment: http://stackoverflow.com/comment/34804649
has comment: http://stackoverflow.com/comment/34804890
type: AnsweredQuestion
has body: I have several methods which create their own component, JButton or JLabel in a JPanel. Then I have a separate method which adds all these JPanels the the JFrame. I also use gridx and gridy on the JPanels to position them how I want. This is: lookreply on the left, then top right the title and below in a 2X2 table quit, restart, pickup and hello. However my current code when run displays a weird, random layout. The lookreply is on the left, but then to the right is quit, a space, restart then hello all vertical. pickup and title aren't seen. I dont know why this is happening. Please see my code below.: public class GUI extends JPanel { /** * Creation of variables used throughout the GUI Class. */ //JPanel panel = new JPanel(new GridBagLayout()); private static final long serialVersionUID = 1L; public static void main(String[] args) { GUI g = new GUI(); g.create(); } private void create() { JFrame screen = new JFrame("Dungeon of Doom"); screen.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); screen.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); //set size to full screen. screen.setExtendedState(Frame.MAXIMIZED_BOTH); //Add all JPanes to screen screen.add(lookReply(), c); c.gridy = 0; c.gridx = 0; screen.add(title(), c); c.gridy = 0; c.gridx = 1; c.gridwidth = 2; screen.add(quit(), c); c.gridy = 1; c.gridx = 1; screen.add(restart(), c); c.gridy = 1; c.gridx = 2; screen.add(pickup(), c); c.gridy = 2; c.gridx = 1; screen.add(hello(), c); c.gridy = 2; c.gridx = 2; screen.setVisible(true); } One of the methods (quit) private JPanel quit() { JPanel quitPanel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); JButton quit = new JButton("QUIT"); quitPanel.add(quit, c); return quitPanel; } All the other methods are pretty much the same except the title is a a JLabel and the table iterates to create a 5x5 table of JLabel within its own JPanel. Any help is appreciated!
accepted answer: http://stackoverflow.com/a/22821805
tagged with: java
type: Question
tagged with: gridbaglayout
tagged with: layout
score: 0

http://stackoverflow.com/a/22948160
answers question: http://stackoverflow.com/q/22919153
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22919153
score: 1
has comment: http://stackoverflow.com/comment/39463488
has comment: http://stackoverflow.com/comment/35421247
has comment: http://stackoverflow.com/comment/35414565
type: Answer
has comment: http://stackoverflow.com/comment/35419400
upvote count: 1
has body: Consider updating your classes in the following way (the assumption is that PROPERTY access is used): public class Item implements Serializable { @OneToMany(cascade = CascadeType.ALL, mappedBy = "item") //non-owning side public Set&lt;ItemCost&gt; getCosts() { return costs; } } public class ItemCost implements Serializable { private Item item; @ManyToOne //owning side @JoinColumn(name = "itemId") //the foreign key (the primary key of "Item") @MapsId("itemId") //is shared with the compound primary key of "ItemCost" public Item getItem() { return item; } public void setItem(Item item) { this.item = item; } } Additionally you would need to set up bidirectional relationship, i.e. em.getTransaction().begin(); Item item = new Item("A Jar"); // item.addCost(new Date(), 7); ItemCost itemcost = new ItemCost(new Date(), 7); itemcost.setItem(item); //owning side item.getCosts().add(itemcost); //non-owning side em.persist(item); em.getTransaction().commit(); The above will produce: INSERT INTO Item (id, Name) VALUES (1, 'A Jar') INSERT INTO ItemCost (cost, startDate, itemId) VALUES (7, 2014-04-08 22:50:00, 1) Side notes (regarding your compound primary key class): Don't use setter methods on compound primary key class specified with @EmbeddedId or @ClassId annotation (once it has been constructed it should not be changed), according to Effective Java, Item 15: Minimize mutability: An immutable class is simply a class whose instances cannot be modified. All the information contained in each instance is provided when is created and is fixed for the lifetime of the object. (...) To make class immutable, follow these five rules: Don't provide any methods that modify the object's state Ensure that the class can't be extended Make all fields final Make all fields private Ensure exclusive access to any mutable components. I believe a compound primary key class fits perfectly into this rule. Specify @Temporal annotation for java.util.Date and java.util.Calendar persistent fields, accor…

http://stackoverflow.com/comment/35185807
has text: PERFECT! Now anyone interested in this topic can easily test and learn from your sample code, thanks ! I wish someday these "wheels" [ topPercentFromRange, topPercent, topN ... ] you've invented can be part of the standard Java language feature, and being improved upon, so we don't have to carry them around in our own libraries.
type: AnswerComment
comment on: http://stackoverflow.com/a/22855465
type: Comment
score: 2

http://stackoverflow.com/comment/34937341
comment on: http://stackoverflow.com/a/22894021
has text: sorry didn't saw that you were using Spring 2.5
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22926852
has comment: http://stackoverflow.com/comment/34997132
favorite count: 0
has answer: http://stackoverflow.com/a/22927819
tagged with: swing
has comment: http://stackoverflow.com/comment/34997179
type: AnsweredQuestion
upvote count: 0
has title: MenuListener or ActionListener for menu item
tagged with: java
has body: Here is my code: menuBar = new JMenuBar(); file = new JMenu("File"); options = new JMenu("Options"); help = new JMenu("Help"); editOptions = new JMenu("Change settings..."); close = new JMenu("Exit"); close.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { System.exit(1); } }); However, this doesn't work. I've also tried using a menuListener like such: menuBar = new JMenuBar(); file = new JMenu("File"); options = new JMenu("Options"); help = new JMenu("Help"); editOptions = new JMenu("Change settings..."); close = new JMenu("Exit"); close.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent arg0) { System.exit(1); } @Override public void menuDeselected(MenuEvent arg0) { } @Override public void menuCanceled(MenuEvent arg0) { } }); But that exited as soon as the menu "exit" was highlighted. I need it to exit when clicked on. Any ideas?
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/34997105
score: -1
has comment: http://stackoverflow.com/comment/34997106
has comment: http://stackoverflow.com/comment/34997220
accepted answer: http://stackoverflow.com/a/22927819
answer count: 1
downvote count: 1

http://stackoverflow.com/a/22857812
has comment: http://stackoverflow.com/comment/34872203
answers question: http://stackoverflow.com/q/22856888
type: Answer
has body: EDIT: answer below does not reflect original question. Please ignore, taken to comments. public static void main(String[] args) { // open filechooser at user's current location (this will be in your // eclipse workspace if running from eclipse (/NetBeans) JFileChooser jfc = new JFileChooser(System.getProperty("user.dir")); // just for safety; we're saving files anyhow jfc.setMultiSelectionEnabled(false); jfc.setDialogTitle("Enter file name and select location . ."); // null should be the name of the parent JFrame int returnVal = jfc.showSaveDialog(null); if(returnVal == JFileChooser.APPROVE_OPTION) { String path = jfc.getSelectedFile().getAbsolutePath(); writeToCustomFile(path); } } public static void writeToCustomFile(String path) { File f = new File(path); // redundancy check, feel free to remove if(!f.getPath().equals("")) { // create parent directories if they don't exist f.getParentFile().mkdirs(); try { f.createNewFile(); System.out.println("File created"); } catch (IOException e) { e.printStackTrace(); System.out.println("Failed to create file"); } } }
has comment: http://stackoverflow.com/comment/34872631
score: 0

http://stackoverflow.com/q/22833515
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/22833857
type: AnsweredQuestion
tagged with: rounding
tagged with: java
accepted answer: http://stackoverflow.com/a/22833857
tagged with: decimal
possible better answer: http://stackoverflow.com/a/22833653
score: 1
has answer: http://stackoverflow.com/a/22833653
has title: Rounding to 6 decimal places using Math.round method in Java android
answer count: 3
has answer: http://stackoverflow.com/a/32089509
has body: I'm using double i2 = value * 2.23694; i2 = (double)(Math.round(i2 * 100)) / 100; for rounding doubles. But it rounds to only 2 decimal places. I want it to be 6 decimal places. Is there any way to use Math.round and have 6 decimal places?
tagged with: android
has comment: http://stackoverflow.com/comment/34828226
favorite count: 0
upvote count: 3

processbuilder
tags question: http://stackoverflow.com/q/22825870
tag name: processbuilder
tags question: http://stackoverflow.com/q/22838283
tags question: http://stackoverflow.com/q/22953760
tags question: http://stackoverflow.com/q/22942408
type: Tag

http://stackoverflow.com/a/22829336
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22829269
has comment: http://stackoverflow.com/comment/34820717
upvote count: 1
has comment: http://stackoverflow.com/comment/34820668
has body: Your directory structure is important that where you have placed the file and provide that path to welcome-file. hope it helps
type: Answer

http://stackoverflow.com/q/22945257
has title: JGit: How to squash commits
tagged with: squash
answer count: 1
has answer: http://stackoverflow.com/a/22948520
favorite count: 0
has body: Any suggestions on how to use RebaseCommand, MergeCommand or any other command in JGit to squash commits? I cannot find many examples and the documentation is not very helpful. A simple example I want to squash the following tree: A-----B------C------D------E------F------G------H Into this one: A----Z-----H Where Z is the squashed commit of B, C, D, E, F, and G. Any suggestions and useful resources are appreciated.
upvote count: 4
tagged with: git
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/26029698
tagged with: jgit
score: 4
accepted answer: http://stackoverflow.com/a/22948520

http://stackoverflow.com/a/22828531
answers question: http://stackoverflow.com/q/22828426
score: 3
type: AcceptedAnswer
downvote count: 0
has body: Wrap the image a icon in a JLabel and wrap that label in a JPanel with a GridBagLayout (this layout will keep the image/label centered). Create another JPanel with a BorderLayout, adding the image panel to the WEST and the text component to the CENTER Add just that JPanel from 2 to to the JOptionPane. Example import java.awt.*; import javax.swing.*; public class TestImageCenter { public static void main(String[] args) { ImageIcon icon = new ImageIcon(TestImageCenter.class.getResource("/resources/images/ooooo.png")); JLabel iconLabel = new JLabel(icon); JPanel iconPanel = new JPanel(new GridBagLayout()); iconPanel.add(iconLabel); JPanel textPanel= new JPanel(new GridLayout(0, 1)); for (int i = 0; i &lt; 15; i++) { textPanel.add(new JLabel("Hello, StackOverfkow")); } JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(textPanel); mainPanel.add(iconPanel, BorderLayout.WEST); JOptionPane.showMessageDialog(null, mainPanel, "Center Image Dialog", JOptionPane.PLAIN_MESSAGE); } }
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22828426

http://stackoverflow.com/q/22847879
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22847939
tagged with: arraylist
upvote count: 1
accepted answer: http://stackoverflow.com/a/22847939
type: AnsweredQuestion
tagged with: java
has title: User Defined Index for an ArrayList of IDs
type: Question
has body: I'm in a situation where (in Java) I need to define an arraylist of generated ids. I don't know how many would be generated at any given time, but I do know that when one is generated, the user who generated it would need to set a custom index, and be able to retrieve it by that index. What would be the generally accepted standard way of storing and working with a data structure like this? An arraylist of arrays?

http://stackoverflow.com/a/22890907
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34931816
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22890875
has body: getParentView return type is an interface ViewParent you can test if it is actually a View (or do not test, if you are sure), and downcast it to View.
answers question: http://stackoverflow.com/q/22890875

http://stackoverflow.com/q/22907085
tagged with: opengl
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/c
type: Question
has title: OpenGL: push/pop matrix VS translate forth and back
upvote count: 1
answer count: 1
favorite count: 0
has body: I'd like to know what is faster (pseudocode): glPushMatrix() glTranslate2f(x, y) // do drawing glPopMatrix() or glTranslate2f(x, y) // do drawing glTranslate2f(-x, -y) The drawing part is not expected to translate nor move, it's just drawing vertices.
has answer: http://stackoverflow.com/a/22907165
accepted answer: http://stackoverflow.com/a/22907165
downvote count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/34785075
comment on: http://stackoverflow.com/q/22809624
has text: Using a message queue would provide a more resilient design and also allow for load-balancing
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22875308
accepted answer: http://stackoverflow.com/a/22875334
has body: My problem is that I've to write a code where a MAC direction must be written via keyboard and then, the code must recognize it to mount a "Magic Packet". Let me show some code so you can understand better my problem and maybe reach some solution. static String realMAC[] = new String [6]; static String mac; //that's the written string private DatagramPacket buildWOLPacket(InetAddress address,String MAC) { String splittedMAC[] = new String[12]; final int SIZE = 6 + 6 * 16; // See above for this magic number byte data[] = new byte[SIZE]; for (int i = 0; i &lt; 6; i++) { data[i] = (byte) 0xff; } //Method where each character written //is stored into a char array (realMAC[]) for (int i = 0 ; i&lt;12; i++) { String replacedMAC = MAC.replace(":", ""); //Here I delete all the : from the MAC adress introduced via keyboard. if (i == 12) splittedMAC[i] = replacedMAC.substring(i,(i)); else splittedMAC[i] = replacedMAC.substring(i,(i+1));} And now the piece of code that is giving me problems //All the (byte) 0x00 and so on are examples of a MAC direction and how to convert it if it is predefined data[6 * i + 0] = Byte.parseByte(realMAC[0]); //(byte) 0x00; data[6 * i + 1] = Byte.parseByte(realMAC[1]); //(byte) 0x1A; data[6 * i + 2] = Byte.parseByte(realMAC[2]); //(byte) 0x09; data[6 * i + 3] = Byte.parseByte(realMAC[3]); //(byte) 0x07; data[6 * i + 4] = Byte.parseByte(realMAC[4]); //(byte) 0x8c; data[6 * i + 5] = Byte.parseByte(realMAC[5]); //(byte) 0xe9; My problem comes when converting the realMAC[] into bytes because of the x and letters from (0x8c, for example) because parseByte only accepts ints and ascii code. How could I tranform that string in hex form into bits? Thank you so much.
has title: How to transform hexadecimal string into Byte. Java
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22875334
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22875365
has answer: http://stackoverflow.com/a/22875365
tagged with: java

http://stackoverflow.com/comment/34987135
type: Comment
comment on: http://stackoverflow.com/a/22912787
has text: Your previous solution was quite well but something mess up, becouse as you can see it is impossible to Have 3 the same pair in four statements. Pair: 9 5 Pair: 9 5 Pair: 604 600 Pair: 9 5. The position of deleted lines didn't changed.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22933293
answers question: http://stackoverflow.com/q/22932251
score: 0
has body: 10 x 4bytes = 40 bytes The maximum size for the object store is 256 MB of compressible, nonvolatile, RAM storage. The size of the object store can be changed to customize the amount of persistent storage available for applications and their related data. default Object = 4bytes in x32bit and 8bytes in x64bit It is depend on what items of object are holding. Since you are not assign any items in object so the Heap will be calculate by default Object = 4bytes x 10 = 40bytes.
type: Answer

http://stackoverflow.com/comment/35037163
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22880275
has text: That's more complicated, but in most cases you can simplify it by asserting not that "the file must be readable only by the owner" but that "the file must have the same permissions I originally assigned it". That is, you check that there is exactly one ACE and that the ACE has the correct security principal. You might also like to check that the right user still owns the file. (Make sure these requirements are well documented or sysadmins will get very cross!)

http://stackoverflow.com/q/22870361
tagged with: maven
accepted answer: http://stackoverflow.com/a/22870553
has body: I created a jar file for utility files and added it as a dependency for my main project. When I run mvn install to build my main project, the correct utility jar is used in my unit tests. However, when I later run the main project jar using java -jar supervisor.jar, I get a java.lang.NoClassDefFoundError: caused by java.lang.ClassNotFoundException: com.seeq.utilities.process.OperatingSystem. In my unit tests, OperatingSystem is used and the tests run fine, so I am assuming that the utility jar is not found when by java when using java -jar. Is that the issue and how could I fix it? Exception in thread "main" java.lang.NoClassDefFoundError: com/seeq/utilities/process/OperatingSystem at com.seeq.supervisor.util.ProcessManager.buildCommand(ProcessManager.java:78) at com.seeq.supervisor.util.ProcessManager.<init>(ProcessManager.java:27) at com.seeq.supervisor.Supervisor.start(Supervisor.java:40) at com.seeq.supervisor.Main.main(Main.java:21) Caused by: java.lang.ClassNotFoundException: com.seeq.utilities.process.OperatingSystem at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 4 more How I added the dependency in my pom.xml: com.seeq.utilities seeq-utilities 1.0 system <systemPath>${project.basedir}/../common/libraries/java/seeq-utilities/target/seeq-utilities-1.0.jar</ systemPath>
score: 0
tagged with: java
tagged with: noclassdeffounderror
has title: ClassNotFoundException when running executable jar
linked to: http://stackoverflow.com/q/364114
has answer: http://stackoverflow.com/a/25495264
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22870553
tagged with: jar
possible better answer: http://stackoverflow.com/a/25495264
type: Question
linked to: http://stackoverflow.com/q/999489
answer count: 2

http://stackoverflow.com/comment/35035799
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22946404
type: Comment
has text: I just tried it as you suggested. String fails with "Permission denied" being output on error stream. String array succeeds.

http://stackoverflow.com/a/22937556
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22937461
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35015960
score: 2
has comment: http://stackoverflow.com/comment/35015715
has comment: http://stackoverflow.com/comment/35015912
has body: Why not just remove 0x if the string starts with it? There's no need to use a regular expression for this - just a combination of startsWith and substring is simpler to understand (IMO): String hexString = response.getResult(); if (hexString.startsWith("0x")) { hexString = hexString.substring(2); } int value = Integer.parseInt(hexString, 16);
answers question: http://stackoverflow.com/q/22937461

http://stackoverflow.com/comment/35047369
type: Comment
comment on: http://stackoverflow.com/a/22954927
score: 0
has text: what is your java version 1.5/6/7?
type: AnswerComment

http://stackoverflow.com/comment/35043478
has text: Leave out the #Chapter3. The purpose of putting a filename in Content-Disposition is to give the user a default filename to save this as. You can't save files with a # in the filename.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22949347
type: Comment

http://stackoverflow.com/comment/34851217
has text: See [Math.pow()](http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#pow%28double,%20double%29).
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22846447
type: QuestionComment

http://stackoverflow.com/q/22829269
tagged with: http-status-code-404
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/2386031
has answer: http://stackoverflow.com/a/22829719
accepted answer: http://stackoverflow.com/a/22829719
type: Question
has answer: http://stackoverflow.com/a/22829336
has comment: http://stackoverflow.com/comment/34820760
score: 7
tagged with: java
duplicate of: http://stackoverflow.com/q/2386031
has comment: http://stackoverflow.com/comment/34820897
has comment: http://stackoverflow.com/comment/34820687
has answer: http://stackoverflow.com/a/22829348
answer count: 3
tagged with: java-ee-6
upvote count: 7
has title: HTTP status - 404 Resource not found exception in JSP
tagged with: jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/22829348
has body: I have been stuck up with running hello world program in JSP.When i start my server it showing resource not found exception. please help me to solve this problem. I have mentioned my code below index.jsp: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here web.xml <?xml version="1.0" encoding="UTF-8"?> MySample index.jsp
has comment: http://stackoverflow.com/comment/34820507

http://stackoverflow.com/a/22923636
answers question: http://stackoverflow.com/q/22923518
has comment: http://stackoverflow.com/comment/71888699
has body: Image image = new ImageIcon(bufferedImage).getImage(); That's the way I usually do it... OR Image image = (Image) bufferedImage;
upvote count: 1
downvote count: 3
score: -2
has comment: http://stackoverflow.com/comment/35009355
has comment: http://stackoverflow.com/comment/126212357
type: Answer

http://stackoverflow.com/q/22878562
has answer: http://stackoverflow.com/a/22879097
has title: unable to display all info from the database through jsp
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22879097
answer count: 1
downvote count: 0
tagged with: jsp
has body: My requirement is to insert artist details and his picture through jsp into oracle database and retrieve back information and picture through another jsp program. artist table has five columns, four are varchar2 and fifth column is blob type. I have successfully inserted and successfully able to retrieve but the problem it displays only image. Below is the code. I am stuck. I need help. Please suggest me. PreparedStatement ps=con.prepareStatement("select * from artist"); ResultSet rs=ps.executeQuery(); while(rs.next()){ %> artist fast name: <%=rs.getString(1) %> artist middle name: <%=rs.getString(2) %> artist last name <%=rs.getString(3) %> artist job <%=rs.getString(4) %> artist image <img src=" <% Blob bl=rs.getBlob(5); byte[] image=bl.getBytes(1, (int)bl.length()); response.setContentType("image/jpeg"); OutputStream o = response.getOutputStream(); o.write(image); o.flush(); o.close(); } %>" height="100" width="100" alt="bye"/> <% con.close();
favorite count: 0
linked to: http://stackoverflow.com/q/2340406

http://stackoverflow.com/q/22918910
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
tagged with: spring
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35019879
has comment: http://stackoverflow.com/comment/35023340
has comment: http://stackoverflow.com/comment/34987910
tagged with: spring-batch
score: 0
has title: Spring scheduler batch + scaling batch
has body: I have a spring scheduler batch configurate sucessful and also a spring scaling batch configurated sucessful. How can I configure a scheduler batch with a scaling batch? At the moment the step1 is not reachable: Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: The element [step1] is unreachable Offending resource: class path resource [applicationContext.xml] Thanks! &lt;bean id="targetSync" class="org.jscsi.batch.TargetSync" /&gt; &lt;batch:job id="targetSyncJob"&gt; &lt;batch:step id="step0"&gt; &lt;batch:job ref="partitionJob"/&gt; &lt;/batch:step&gt; &lt;batch:step id="step1"&gt; &lt;batch:tasklet ref="targetSync" /&gt; &lt;/batch:step&gt; &lt;/batch:job&gt; ... targetSync ... &lt;!-- Scaling Spring Batch --&gt; &lt;bean id="blockJscsiPartitioner" class="org.jscsi.batch.BlockJscsiPartitioner" scope="step" /&gt; &lt;bean id="taskExecutorPartition" class="org.springframework.core.task.SimpleAsyncTaskExecutor" /&gt; &lt;job id="partitionJob" xmlns="http://www.springframework.org/schema/batch"&gt; &lt;step id="masterStep"&gt; &lt;partition step="slave" partitioner="blockJscsiPartitioner"&gt; &lt;handler grid-size="10" task-executor="taskExecutorPartition" /&gt; &lt;/partition&gt; &lt;/step&gt; &lt;/job&gt; &lt;step id="slave" xmlns="http://www.springframework.org/schema/batch"&gt; &lt;tasklet ref="blocksProcessor" /&gt; &lt;/step&gt; &lt;bean id="blocksProcessor" class="org.jscsi.processor.BlocksProcessor" /&gt;

http://stackoverflow.com/q/22814504
tagged with: collections
has answer: http://stackoverflow.com/a/22814669
type: Question
has title: Java generics compiler error assigning to JavaFX collection
score: 0
has body: Consider the following code: public interface ListDisplayObj { public String getListDisplayString(); } public class BusinessObject implements ListDisplayObj { ... public String getListDisplayString() { return "Example String"; } } public class DBUtilityClass { public ObservableList&lt;BusinessObject&gt; getMyBusinessObjects() { ObservableList&lt;BusinessObject&gt; toReturn = FXCollections.observableArrayList(); // add some values to list return toReturn; } } public class JavaFXGuiController implements Initializable { @FXML private ListView&lt;ListDisplayObj&gt; listItems; @Override public void initialize(URL url, ResourceBundle rb) { ObservableList&lt;ListDisplayObj&gt; objsForList = DBUtilityClass.getMyBusinessObjects(); listItems.setItems(objsForList); ... } } The assignment in initialize() is generating an "incompatible types" compile error between the return type of the getMyBusinessObjects() function and the objsForList type. What am I doing wrong?
answer count: 1
tagged with: generics
tagged with: interface
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/34862126
comment on: http://stackoverflow.com/q/22852347
score: 1
has text: What is stored in `field[i]`? What is the full exception message?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22948553
tagged with: c++
has comment: http://stackoverflow.com/comment/40242446
has title: Issue with writing FaceRecognizer for Java with OpenCV 2.4.8
has comment: http://stackoverflow.com/comment/35063927
tagged with: java
type: Question
tagged with: opencv
tagged with: java-native-interface
score: 0
answer count: 1
tagged with: jniwrapper
has comment: http://stackoverflow.com/comment/35050475
linked to: http://stackoverflow.com/q/21880941
type: UnansweredQuestion
has body: I have been given a project based around face recognition written in JavaCV to be improved. The idea was to either rewrite the program using C++ or write JNI bindings to still use Java. I did some research and according to the official website OpenCV as of version 2.4.4 has bindings for Java and Python. And so, since the official website stated so I decided to go with it. Please note I haven't programmed in C++ before nor have I written any JNI wrappers in the past. If the official website didn't state that it includes bindings for Java I would just write it with C++ using Qt Digia. This way or another I did everything else that I wanted to do with the Java project and was left with the face recognition part. Unfortunately according (Relevant question #1, Relevant question #2) I found out that there is a bug with FaceRecognizer and that JNI wrapper for face recognition has to be written by hand. I found a pretty good jni c++ java tutorial and I tried to use that with the code mentioned in Relevant question #1 linked above. The screenshot below shows what I have got right now. The code is as follows: LBPHFaceRecognizer.java import org.opencv.contrib.FaceRecognizer; public class LBPHFaceRecognizer extends FaceRecognizer { static{ System.loadLibrary("opencv_java248"); System.loadLibrary("facerec"); } private static native long n_createLBPHFaceRecognizer(); public LBPHFaceRecognizer() { super(n_createLBPHFaceRecognizer()); } FaceRecognizer facerec = new LBPHFaceRecognizer(); } LBPHFaceRecognizer.c // facerec.dll #include "jni.h" #include "opencv2/contrib/contrib.hpp" extern "C" { JNIEXPORT jlong JNICALL Java_org_matxx_n_createLBPHFaceRecognizer(JNIEnv* env, jclass, jint); JNIEXPORT jlong JNICALL Java_org_matxx_n_createLBPHFaceRecognizer(JNIEnv* env, jclass, jint) { try { cv::Ptr&lt;cv::FaceRecognizer&gt; ptr = cv::createLBPHFaceRecognizer(); cv::FaceRecognizer * pf = ptr.get(); ptr.addref(); //don't let it self-destroy here.. return (jlong) pf; } catch (...) { jclass je…
linked to: http://stackoverflow.com/q/21761641
has answer: http://stackoverflow.com/a/22949261

http://stackoverflow.com/comment/34900414
type: Comment
has text: Yes'm but have you found the correct solution or a hack that will sot working in ten minutes...if you've solved the problem and don't want any more correspondence, delete the question
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22870365

http://stackoverflow.com/comment/34930510
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22814196
has text: @brian not able to delete ,m getting NullPointerException little worried.

http://stackoverflow.com/comment/34978946
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22916966
type: Comment
has text: @Arran, I looked it up, and apparently, I'm mistaken. Thanks.

http://stackoverflow.com/comment/35063419
type: Comment
comment on: http://stackoverflow.com/a/22964177
score: 0
type: AnswerComment
has text: removed it but same result

http://stackoverflow.com/a/22911279
has comment: http://stackoverflow.com/comment/71278682
score: 4
has body: The FXMLLoader.load(URL) method is a static method. So when you execute FXMLLoader loader = new FXMLLoader(); Parent root = loader.load(getClass().getResource("sample.fxml")); you are not loading the FXML file from the instance of the FXMLLoader that you constructed ("loader"). (You're actually invoking the static method through an object reference.) Hence the loader's controller never gets initialized. You need FXMLLoader loader = new FXMLLoader(getClass().getResource("sample.fxml")); Parent root = loader.load(); This constructs a loader with a location specified, and then the load() method, which is not a static method, is properly invoked on the FXMLLoader instance. Then System.out.println(loader.getController()); will give the correct result.
has comment: http://stackoverflow.com/comment/71278665
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22910611
type: Answer
has comment: http://stackoverflow.com/comment/71366326
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22910611

http://stackoverflow.com/q/22967497
tagged with: java
has comment: http://stackoverflow.com/comment/35070042
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35069281
has title: Eclipse how to select needed file for debug if one source file mentions from two projects within workspace
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23054379
has comment: http://stackoverflow.com/comment/35069658
has body: I have same structure of maven project parent / child1 / child2 / child3 ... ... Thus in my workspace I see next view of projects: parent child1 child2 child3 ... therefore file child1/src/MyClass.java can be found from parent child1 But from child1 it is file of source code from parent it is just file where I cannot navigate over classes. My problem - when I make debug - Eclipse uses version from parent - and it is very inconvenient. How can I say Eclipse to use version from child1 manually ? P.S I tryed to mark code path from parent as source - but I cannot make it( right click on parent project: UPDATE view from parent: view from child: There are different icons.
has comment: http://stackoverflow.com/comment/35070140
type: AnsweredQuestion
score: 0
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/23054379
type: Question

http://stackoverflow.com/q/22964342
has answer: http://stackoverflow.com/a/22964371
favorite count: 0
possible better answer: http://stackoverflow.com/a/22964371
has answer: http://stackoverflow.com/a/22964507
downvote count: 1
has answer: http://stackoverflow.com/a/22964383
type: AnsweredQuestion
score: 3
has title: Enum NullPointerException
tagged with: enums
tagged with: java
has answer: http://stackoverflow.com/a/22964468
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/22964405
has answer: http://stackoverflow.com/a/22964413
has answer: http://stackoverflow.com/a/22964370
tagged with: nullpointerexception
has body: Could anyone explain why public class Testabut{ enum ThreeColors{RED, BLUE, green; public void woowoo(){ System.out.println("woo");} } ThreeColors color; class Innerclass{ Innerclass(){ color.woowoo(); } } generates a null pointer exception at the invocation of woowoo() ? The instance of color should be reachable, no?
answer count: 7
accepted answer: http://stackoverflow.com/a/22964370

http://stackoverflow.com/q/22872659
has answer: http://stackoverflow.com/a/22872877
tagged with: loops
has comment: http://stackoverflow.com/comment/34899614
has comment: http://stackoverflow.com/comment/34899220
tagged with: fibonacci
accepted answer: http://stackoverflow.com/a/22872877
tagged with: java
has body: I need to make a method that returns the nth integer in the fibonacci series, the code that I wrote returns every second integer from the series when printed in a table. The int fib used in the method is the row number multiplied by the column number, could you guys help? private int fibonacci(int fib){ int a = 1, b = 1; while(a &lt; fib){ b+=a+=b; } return b+=a+=b; } private int fibonacci(int fib){ int fibn = 0; fibn =(int)((Math.pow((1+Math.sqrt(5)), fib)-Math.pow((1-Math.sqrt(5)), fib))/(Math.pow(2, fib)*Math.sqrt(5))); return fibn; } * | 1 2 3 4 5 -------------------------------- 1 | 1 1 2 3 5 2 | 1 3 8 21 55 3 | 2 8 34 144 610 4 | 3 21 144 9876765
tagged with: methods
type: AnsweredQuestion
answer count: 1
has title: Fibonacci method return nth number in sequence
type: Question
has comment: http://stackoverflow.com/comment/34898798
has comment: http://stackoverflow.com/comment/34899999
tagged with: return
score: 0
has comment: http://stackoverflow.com/comment/34899312

http://stackoverflow.com/q/22926107
tagged with: java
possible better answer: http://stackoverflow.com/a/22926299
has comment: http://stackoverflow.com/comment/34995856
has answer: http://stackoverflow.com/a/22926299
has comment: http://stackoverflow.com/comment/34995871
has comment: http://stackoverflow.com/comment/34995769
type: Question
has answer: http://stackoverflow.com/a/22926166
has comment: http://stackoverflow.com/comment/34995902
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22926166
has comment: http://stackoverflow.com/comment/34996209
tagged with: regex
favorite count: 0
has body: I have a java regular expression given by my CS2 instructor that checks if a word is repeated: \\b(\\w+)\\s+\\1\\b How can I modify this to check if a word is repeated twice as in "hello hello hello" or "hello world hello hello" If possible, I'd just like to be pointed in the right direction, not an outright solution (after all, I need to learn this). I think my problem is that I don't understand word boundaries well.
has comment: http://stackoverflow.com/comment/34995770
has comment: http://stackoverflow.com/comment/34996067
upvote count: 1
has comment: http://stackoverflow.com/comment/34995754
has comment: http://stackoverflow.com/comment/34995782
has comment: http://stackoverflow.com/comment/34995976
has title: Regular Expression to match word repeated twice (i.e. hello hello hello)
type: AnsweredQuestion
tagged with: word-boundary
score: 1

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/22890760
tag name: bytecode-manipulation

http://stackoverflow.com/q/22817312
has title: I want to update a file(textfile) when user changes the data in JTable on clicking the update button?
has comment: http://stackoverflow.com/comment/34799996
upvote count: 0
tagged with: jtable
has answer: http://stackoverflow.com/a/22817735
tagged with: file-io
type: Question
type: AnsweredQuestion
score: -1
favorite count: 0
tagged with: swing
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/22817735
tagged with: java
has body: I have Jtable with column names "item","price","quantity"and "reorder" the requirement is such that when user make the changes in the any of these above fields and clicks the update button and the updated data should be write in to the text file (I have created a textfile "MyFile.txt"). How?

http://stackoverflow.com/a/22841432
has body: score1 is where you already did the conversion. Integer.parseInt(score1TextField.getText()); was correct.
accepted answer of: http://stackoverflow.com/q/22841383
answers question: http://stackoverflow.com/q/22841383
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34842077
has comment: http://stackoverflow.com/comment/34841752
type: Answer
has comment: http://stackoverflow.com/comment/34841828

http://stackoverflow.com/a/38789604
has comment: http://stackoverflow.com/comment/131447890
type: Answer
has comment: http://stackoverflow.com/comment/81794874
has body: With Java 7 and up, a one liner using Files: String text = "Text to save to file"; Files.write(Paths.get("./fileName.txt"), text.getBytes());
has comment: http://stackoverflow.com/comment/81250276
has comment: http://stackoverflow.com/comment/81997688
answers question: http://stackoverflow.com/q/22859453
has comment: http://stackoverflow.com/comment/66404955
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22859453
has comment: http://stackoverflow.com/comment/64949756
has comment: http://stackoverflow.com/comment/138272240
score: 115
upvote count: 115
has comment: http://stackoverflow.com/comment/66403044

http://stackoverflow.com/q/22832265
has comment: http://stackoverflow.com/comment/34827976
type: Question
has comment: http://stackoverflow.com/comment/34828839
has comment: http://stackoverflow.com/comment/34826403
tagged with: java
tagged with: rich-text-editor
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34826633
upvote count: 1
has comment: http://stackoverflow.com/comment/34826708
favorite count: 0
tagged with: eclipse-rcp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34826998
has body: I have got some problem in application with editor, i am opening editors for showing file content. Now the problem is that when i open a file in editor and change the file content from backend and now when i open a new editor with that file then it shows file content same as that editor which is first open. Ideally required if resource is change in backend then it must show at editor too. but it is not happening in my case. @IMP: I am useing CTabItem Item as a container on editor and adding page in it. On finding the reason i think this statement i am using creating problem: fileStore = EFS.getLocalFileSystem().getStore(new Path(filePath)); As it can be seen it is singleton class and it is returning opened instance not new one. But ideally there should be resource change event that should reload the file as eclipse does. If i implement IResourceChangeListener then what should i do to get reload sequence. Update IFileStore fileStore = null; pageeditor = findEditorFromReference(); fileStore = EFS.getLocalFileSystem().getStore( new Path(filePath)); fileStore = fileStore.getChild(""); //just assume reference to the code. openEditor = new Editor();//just reference of working EditorInput editorInput = new EditorInput( fileStore, lineNo, filePath, title); Integer pageIndexNo = pageeditor.getPageIndexNo(file .getName()); if (pageIndexNo == -1) { pageeditor.addPage(openEditor, editorInput, file .getName(), file.getName());
has comment: http://stackoverflow.com/comment/34827536
has title: Editor is not reloading file in eclipse RCP application
tagged with: editor
has comment: http://stackoverflow.com/comment/34877517
downvote count: 0
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/34826668

http://stackoverflow.com/q/22861161
has title: CANNOT_FIND_FACELET_TAGLIB for xmlns:jsf="http://xmlns.jcp.org/jsf"
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/7546219
favorite count: 0
has answer: http://stackoverflow.com/a/29352506
duplicate of: http://stackoverflow.com/q/7546219
type: UnansweredQuestion
has body: I'm trying to make a custom tag in jsf, here is my code: WEB-INF/tag/test.xhtml: <cc:interface> <cc:attribute name="value" type="java.lang.String" default="#000000" /> </cc:interface> <cc:implementation> </cc:implementation> the problem is that eclipse doesn't recognize xmlns:jsf="http://xmlns.jcp.org/jsf" it give me a warning says: NLS missing message: CANNOT_FIND_FACELET_TAGLIB in: org.eclipse.jst.jsf.core.validation.internal.facelet.messages so what is the problem. Note: all the other Namespaces work fine unless this one
tagged with: jsf
downvote count: 0
score: 1
type: Question
tagged with: jakarta-ee
tagged with: java
tagged with: http://stackoverflow.com/tag/xhtml
tagged with: jsf-2

http://stackoverflow.com/comment/34946290
has text: @MarkoTopolnik hmm thats what it said in my book. Will double check it now!
comment on: http://stackoverflow.com/q/22898906
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22874312
has title: How to name Fragment tags
has comment: http://stackoverflow.com/comment/34902039
type: Question
has comment: http://stackoverflow.com/comment/34910513
tagged with: android-fragments
tagged with: java
has body: I've discovered that I can make my Android application much more performant by using tags. This is great, however, I cannot find any documentation on what an Android fragment tag should look like. I could imagine any number of ways: String tag = "MyClass"; String tag = myFragment.toString(); Etc... Is there a standard or method which has been accepted and documented, or are we left to our own devices to try and develop tags?
score: 0
has comment: http://stackoverflow.com/comment/34902488
has comment: http://stackoverflow.com/comment/34902107
tagged with: android
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22909831
downvote count: 0
score: 4
upvote count: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22909298
type: Answer
has body: Based on the JPQL Language reference, in the COUNT function, the path expression that is the argument to the aggregate function must terminate in a state-field. The path expression argument to COUNT may terminate in either a state-field or a association-field, or the argument to COUNT may be an identification variable. So try something like this select COUNT(i.&lt;field&gt;) from IssueRingReqsBrit i where i.ringDataRequest = 'I' and i.onRingIssue = 'Y' and i.noCardIssued = 0 COUNT returns Long. Make use you are returning the resulat in a Long.
answers question: http://stackoverflow.com/q/22909298
has comment: http://stackoverflow.com/comment/34965441

http://stackoverflow.com/comment/35026463
type: QuestionComment
has text: It means that the junit.textui package is on your current classpath. Possibly added by something else, since you seem to be surprised at this. You could check what "echo $CLASSPATH" says.
score: 4
comment on: http://stackoverflow.com/q/22943216
type: Comment

http://stackoverflow.com/q/22849995
has body: This is strange and I am not sure how to explain clearly. Please bear with me and look the code snippets for details. I implemented a singleton using enum. The enum has a private constructor in which I am doing few operations and validations before constructing the object. For all these validations I am throwing some exceptions (like IllegalArgumentException). My test cases consists of tests for both negative and positive scenarios. Whenever there are more than 2 test cases with such mix of negative and positive test cases, I get following exception: java.lang.NoClassDefFoundError: Could not initialize class com.blah.blah.SingletonClass. Please check the complete code below. I am using following tech stack: JDK 1.7_51 Spring 4.0.0.RELEASE testng 6.8.7 SingletonUsingEnum.java public enum SingletonUsingEnum { INSTANCE; // Logger private final Logger logger = LoggerFactory.getLogger(SingletonUsingEnum.class); private SingletonUsingEnum() { final MyConfig myConfig = MyConfigManager.getMyConfig(); if(myConfig == null) { throw new IllegalArgumentException("MyConfig is null"); } if(StringUtils.isBlank(myConfig.getConfigValue())) { throw new IllegalArgumentException("myConfig.configValue value null/empty"); } if(StringUtils.isBlank(myConfig.getOtherConfigValue())) { throw new IllegalArgumentException("myConfig.otherConfigValue null/empty"); } logger.info("This is a singleton using enum"); } } MyConfig.java public class MyConfig { private String configValue; private String otherConfigValue; public MyConfig(final String configValue, final String otherConfigValue) { this.configValue = configValue; this.otherConfigValue = otherConfigValue; } public String getConfigValue() { return configValue; } public String getOtherConfigValue() { return otherConfigValue; } } MyConfigManager.java public class MyConfigManager { private final static ConcurrentMap myConfigHolder = new ConcurrentHashMap(); public static void registerMyConfig(final MyConfig myConfig) { myConfigHolder.put("myConfig…
has answer: http://stackoverflow.com/a/22850112
has comment: http://stackoverflow.com/comment/34858168
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22850112
tagged with: enums
score: 1
tagged with: java
upvote count: 1
tagged with: unit-testing
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/41834616
tagged with: singleton
has title: Unit testing for Singleton through Enum throws java.lang.NoClassDefFoundError
possible better answer: http://stackoverflow.com/a/41834616
favorite count: 0
tagged with: testng

http://stackoverflow.com/comment/62640306
type: QuestionComment
has text: Dead link, found it again [Code Conventions for the Java Programming Language](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html)
type: Comment
comment on: http://stackoverflow.com/q/22929851
score: 0

http://stackoverflow.com/comment/34959371
has text: Yes I'm pretty sure, Hibernate will automatically create a field.
type: AnswerComment
comment on: http://stackoverflow.com/a/22881774
score: 0
type: Comment

http://stackoverflow.com/a/22810063
upvote count: 1
has body: If you want multiple cards, you should put them in a set or on a stack or something of the like. Just use a LinkedList&lt;Karte&gt; and add each new Karte on it. You shouldn't think you can give each card a separate variable name when you don't know the number of cards beforehand. If you do know the number of cards and the names they should have, just do Karte eins = new Karte(...) Karte zwei = new Karte(...) Karte drei = new Karte(...) ... Karte homo = new Karte(KREUZ, ASS) Karte schauen = new Karte(PIK, ZEHN)
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22809855

http://stackoverflow.com/q/22945131
tagged with: weka
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35030524
has answer: http://stackoverflow.com/a/22945985
has body: L=40 i:Classifier_name=meka.classifiers.multilabel.BR i:Classifier_ops=[-W, weka.classifiers.rules.ZeroR] i:Classifier_info= i:Dataset_name=PlainAbstractsBehavioralDomainLabels i:Type=ML i:Threshold=0.2289156626506024 i:Verbosity=1 v:N_train=247.0 v:N_test=3.0 v:LCard_train=1.8461538461538463 v:LCard_test=0.0 v:Build_time=2.79 v:Test_time=0.005 v:Total_time=2.795 [0, 0, 0]:[0.05622489959839357, 0.012048192771084338, 0.08433734939759036] [0, 0, 0]:[0.05622489959839357, 0.012048192771084338, 0.08433734939759036] [0, 0, 0]:[0.05622489959839357, 0.012048192771084338, 0.08433734939759036] I got this result in text file from machine learning and how can I only display those data in another text file or any files: 1. 0.05622489959839357, 0.012048192771084338, 0.08433734939759036 2. 0.05622489959839357, 0.012048192771084338, 0.08433734939759036 3. 0.05622489959839357, 0.012048192771084338, 0.08433734939759036
has title: How can I extract those data below and display in another file
has comment: http://stackoverflow.com/comment/35029664
tagged with: text
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/4716503
accepted answer: http://stackoverflow.com/a/22945985
type: Question
has comment: http://stackoverflow.com/comment/35029649

http://stackoverflow.com/comment/34994087
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22923706
type: Comment
has text: @malekh Because Swing is a single threaded framework, like most GUI frameworks. `actionPerformed` is called within the context of the EDT, meaning that until the method exists, it can't process the next series of events (including paint events). This is just how it works.

http://stackoverflow.com/a/22953012
has body: amountInvested, annualRate are always the same. you are not incrementing or decrementing these values in the loop. So, they will always remain the same. Also, the formula to caculate the interest is incorrect, you are not using year variable anywhere. it should be, do { interest = amountInvested * (annualRate / 100) * year; total = amountInvested + interest; year++; System.out.println("Yearend account balance " + total + " Invested this year " + amountInvested + " Annual return " + interest + " number of years " + year); } while (total &lt; MAX_INVESTMENT &amp;&amp; year &lt; 6);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22952939

http://stackoverflow.com/q/22868332
has answer: http://stackoverflow.com/a/22868412
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22868558
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34890480
has body: I want to use objects in Java, but even I read some tutorials, I don't get it. public class FileIO { FileIO parameter[] = new FileIO; public ArrayList&lt;ArrayList&lt;String&gt;&gt; ReadSettings() { parameter.add(param.get(1)); } private FileIO add(String string) { parameter = string; return parameter; } } The problem is: Type mismatch: cannot convert from String to FileIO I can understand it, but I can't change the type to String. Anyway not really, because then, I cant use the add methode. It would be great if anybody could briefly explain it to me. I'm sure it's a classic beginner question.
tagged with: object
tagged with: java
score: -1
has title: Problems with object's types
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/34890465
favorite count: 0
has comment: http://stackoverflow.com/comment/34890404

http://stackoverflow.com/comment/34959051
comment on: http://stackoverflow.com/a/22904610
score: 0
type: AnswerComment
has text: i think it is single map in my java....Map map = new HashMap(); map.put(key, values) --in for loop . The key values are coming from webservice on the basis of user who logged in. hope this answer ur question ....
type: Comment

http://stackoverflow.com/comment/117543238
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/33547873
has text: in a very simplified view a stub is a "list of matchers" where the list might be realized via a stack or whatever else you like to have.
score: 0

session
tags question: http://stackoverflow.com/q/22828752
tags question: http://stackoverflow.com/q/22919329
tags question: http://stackoverflow.com/q/22852988
tags question: http://stackoverflow.com/q/22949507
tags question: http://stackoverflow.com/q/22905828
tags question: http://stackoverflow.com/q/22938748
type: Tag
tags question: http://stackoverflow.com/q/22942368
tags question: http://stackoverflow.com/q/22834156
tags question: http://stackoverflow.com/q/22839798
tags question: http://stackoverflow.com/q/22879367
tags question: http://stackoverflow.com/q/22936660
tags question: http://stackoverflow.com/q/22923996
tags question: http://stackoverflow.com/q/22811420
tag name: session
tags question: http://stackoverflow.com/q/22817012
tags question: http://stackoverflow.com/q/22902952
tags question: http://stackoverflow.com/q/22898944

http://stackoverflow.com/comment/34952689
has text: You have a NullPointerException on line 45 in setUpMain() method.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22902443
score: 0

http://stackoverflow.com/q/22890798
accepted answer: http://stackoverflow.com/a/22890994
type: Question
has title: java.util.EmptyStackException
tagged with: java
has comment: http://stackoverflow.com/comment/34931675
has comment: http://stackoverflow.com/comment/34931938
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22890994
has body: I have the following part of code to initialize an array of stack: vDec.setRoute(new Stack[vDec.getIndexes().length]); for(i=0;i&lt;vDec.getIndexes().length;i++){ vDec.getRoute()[i]=new Stack&lt;&gt;(); } I get java.util.EmptyStackException when I am checking if it is empty inside a while loop but not before it. So for this part: if(vDec.getRoute()[(int)IndexVeh.peek()].isEmpty()){ System.out.println("it works"); } while((cDec.getVisitedBy()[crtCust]==-1)&amp;&amp;(!Distance.empty())){ if(vDec.getRoute()[(int)IndexVeh.peek()].isEmpty()){ do something I first get as output it works and then the exception.
has comment: http://stackoverflow.com/comment/34931842
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34931863
tagged with: stack

http://stackoverflow.com/comment/35067753
score: 0
comment on: http://stackoverflow.com/q/22966183
has text: It's impossible to guess with the current state of your question. You need to provide more code. What is `cntctus`? Where is it initialized. What two classes are you referring to? How are you currently trying to access fields from one class to the other. YOur code doesn't show _any_ of that, and those are all critical points we need to see.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22852167
has answer: http://stackoverflow.com/a/22852327
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22852317
favorite count: 0
type: Question
score: 0
tagged with: java
answer count: 3
upvote count: 1
tagged with: methods
downvote count: 1
has answer: http://stackoverflow.com/a/22852281
has answer: http://stackoverflow.com/a/22852317
has title: Methods Help in Java
possible better answer: http://stackoverflow.com/a/22852281
has body: public static void main(String[] args) { int i = 0; i = rollDice(11); System.out.print(" \nThe number of rolls it took: " + i); i = rollDice(5); System.out.print(" \nThe number of rolls it took: " + i); } public static int rollDice(int desiredNum) { int dice1 = 0; int dice2 = 0; Random rand = new Random(); int sum = 0; int count = 0; do { dice1 = rand.nextInt(6) +1; dice2 = rand.nextInt(6) +1; sum = dice1 + dice2; count++; } while(sum != desiredNum); return count; } } Im wanting to make it where the user can enter their own desired sum of the numbers to be rolled .Also I'm wanting it to display the value of each rolled die as its rolled. It needs to allow the user to call the rollDice method as many times as they want to. Heres my exmaple output EX- Please enter the Desired number: 8 Roll 1: 4 6 Sum: 10 Roll 2: 3 5 Sum: 8 It took 2 rolls to get the Desired number. The original code above WAS a lab i had to do a few weeks ago. But we have just started this. And im trying to get ahead of the class. And this community helps alot. Thanks in advance.

http://stackoverflow.com/comment/35355894
score: 0
has text: @Takendarkk i have described my problem now
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22966155

http://stackoverflow.com/comment/35084263
type: Comment
type: QuestionComment
score: 0
has text: @Servy OK, I see the distinction you're drawing. The thing is, if I had stopped after I'd read the initial pages I read, I would have included lots of details of the form "This site says X, which I interpret to mean XYZ, but that can't be right because it disagrees with observed behavior W..." But because I persisted until I was actually able to answer my question, it no longer seemed useful to include the things I initially found confusing or misunderstood.
comment on: http://stackoverflow.com/q/22968085

http://stackoverflow.com/comment/34891751
comment on: http://stackoverflow.com/q/22868648
has text: possible duplicate of [f:convertDateTime displays wrong Date](http://stackoverflow.com/questions/2689245/fconvertdatetime-displays-wrong-date)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34828226
score: 0
has text: What do you expect? If you round a number, you're removing all decimal places. After that, when you're dividing it with 100, the only possible result is two decimal places!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22833515

http://stackoverflow.com/q/22947818
has comment: http://stackoverflow.com/comment/35034766
has title: Is there a way to continuously update a method in an Android application?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35035056
linked to: http://stackoverflow.com/q/6266625
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35036298
has answer: http://stackoverflow.com/a/22949043
has body: I'm trying to create an app where you can enter in a series of button presses as a password. When you press the first button, a method would keep track of how much time has elapsed, and at 5 seconds, the button press data is stored. long recordingTime = 0; boolean isRecording = false; // start timer for total recording time if(!isRecording) { isRecording = true; recordingTime = System.currentTimeMillis(); } public void update() { long currentTime = 0; // get current time currentTime = System.currentTimeMillis(); // check if timer is over 5 seconds if(currentTime - recordingTime &gt;= 5000) { isRecording = false; Context context = getApplicationContext(); CharSequence text = "Max password time reached."; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } }
tagged with: java
has comment: http://stackoverflow.com/comment/35036003
type: Question
has comment: http://stackoverflow.com/comment/35036160

http://stackoverflow.com/q/22828133
has title: Should we use Java Component in Mule, if component is already available? Mule Performance and Optimization
tagged with: mule
tagged with: transformer-model
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22867411
has body: It is accepted that we should use available Mule Components to achieve particular functionality rather then, using Custom Java Transformers. The case is that i already have Mule component to perform particular functionality, But instead of using that, i introduced Java Transformer to achieve the same functionality. I need a comparison between performance of two, as i am unable to find some speed issue. but still i want to know: Will it deteriorates performance? Will it make application slow in future? I am unable to get answer for the same in forums. If anyone could comment on same.
has answer: http://stackoverflow.com/a/22867411
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/34861215
type: QuestionComment
has text: Well as pointed out it seems like some kind of post-processing is what you will want here. Either simple rule-based or like a low-pass filter ("blur"). It would be easier to present a working answer for you if we had a [simple driver program](http://stackoverflow.com/help/mcve) to work with.
score: 0
comment on: http://stackoverflow.com/q/22850996
type: Comment

http://stackoverflow.com/q/22815448
tagged with: xsd
type: AnsweredQuestion
score: 2
linked to: http://stackoverflow.com/q/11463231
tagged with: java
has body: I'm integrating on a Large Enterprise Platform and the vendor likes to update their XML format frequently, although they have promised that changes will continue to be backwards-compatible. I have an XSD that works...now...but I'd like to deploy that schema with our application code and not have to redeploy for every web service update. As an additional impetus, the (JVM-based) configuration language has very nice XSD type importing. As a fallback, I can extract specific elements using XPath queries, but that's much less pleasant. How can I continue to parse evolving XML against a schema file that is outdated but not obsolete? I'm looking for something like a 'loose parse' option or 'ignore unknown tags' that will get me access to the parts of the document that our application currently knows and cares about. Any new tags can be discarded - from the business standpoint, they're irrelevant.
has answer: http://stackoverflow.com/a/22844219
type: Question
has title: Parse XML with an outdated XSD
tagged with: gosu
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22844219
favorite count: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
upvote count: 2

http://stackoverflow.com/comment/34795720
type: Comment
comment on: http://stackoverflow.com/a/22815057
has text: I might still be wrong in my estimations of "more efficient" or "faster", but at least it will remove some doubt here I hope :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34996224
comment on: http://stackoverflow.com/q/22926377
type: Comment
type: QuestionComment
has text: What is wrong with your current code?
score: 0

http://stackoverflow.com/comment/34992357
has text: Hmm, I removed all the requests except one and now it works properly (showing the dialog only once). Does that mean that it is showing the dialog for each downloaded file? How can I make it show only once when all of the files have downloaded?
type: Comment
comment on: http://stackoverflow.com/q/22923907
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34952769
type: Comment
has text: No thats printed in the first try-catch line: System.out.println(acctException.toString())
comment on: http://stackoverflow.com/a/22902502
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34918034
has text: I guess the bottom line is that `commandName` should name the attribute in your model that is to be used. Nothing more, nothing less.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22880749

http://stackoverflow.com/q/22817860
answer count: 1
type: UnansweredQuestion
tagged with: android
score: 0
tagged with: java
has body: I am trying to connect from a android emulator to a application on my desktop and send a line of text. My app is able to connect to the server, but when ever i try to read data its always null Server application running on my desktop: ServerSocket ss = new ServerSocket(9001); Socket cs = ss.accept(); if (cs.isConnected()) { System.out.println("Client connected."); } BufferedReader reader = new BufferedReader(new InputStreamReader(cs.getInputStream())); String str = reader.readLine(); System.out.println("Data:" + str); Client application running in android app emulator: InetAddress addr = InetAddress.getByName("10.0.2.2"); Socket socket = new Socket(addr, 9001); if (socket.isConnected()) { Log.d("APP", "socket connected"); } PrintWriter pw = new PrintWriter(new OutputStreamWriter(socket.getOutputStream())); String str = "this is a sample"; pw.write(str); I can see that the isConnected function of the socket on both the client and server turns true. But the Data printed on the server is always null. Thanks
type: Question
has title: data received on server from android app always null
has answer: http://stackoverflow.com/a/22818080

http://stackoverflow.com/q/22870027
has body: I have a java.nio.channels.ServerSocketChannel which I initialised as follows: while(true) { ServerSocketChannel channel = ServerSocketChannel.open(); InetSocketAddress serverSocket = new InetSocketAddress(host,port); channel.bind(serverSocket); SocketChannel ch = channel.accept(); // Later on when I have read off data from a client, I want to shut this // connection down and restart listening. channel.socket().close(); //Just trying to close the associated socket // too because earlier approaches failed channel.close(); } When I send the first message from client it is successfully delivered to server and the client program exits. Then trouble begins. When I initialise the client again and try to establish at the same port and address of the server as I did the first time, I get a java.net.BindException: Address already in use: connect exception even though I closed the associated channel/socket. I have been renewing the ServerSocketChannel and InetSocketAddressobjects because as my client instance has to shut down after a write, I have to disengage that channel and since I cannot reuse a channel after it has been closed, I have to make a new object everytime. My theory is since the channel reference is reassigned each time, the orphaned object becomes GC meat, but since the close() method apparently is not working properly, the channel is still alive and until GC collects it my port will be hogged. Nevertheless I tried keeping the initialisation of ServerSocketChannel and InetSocketAddress objects before the while loop, but this did not help, and the same exception occurred after the first write, as before. ServerSocketChannel channel = ServerSocketChannel.open(); InetSocketAddress serverSocket = new InetSocketAddress(host,port); channel.bind(serverSocket); while (true) { SocketChannel ch = channel.accept(); //read from a client } For clarity , here is how I connect from the client: SocketChannel ch=SocketChannel.open(); ch.bind(new InetSocketAddress("localhost", …
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/22870258
favorite count: 0
tagged with: sockets
tagged with: garbage-collection
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/52157090
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/52157090
accepted answer: http://stackoverflow.com/a/22870258
upvote count: 1
has title: java.nio.channels.ServerSocketChannel not closing properly
type: Question
has answer: http://stackoverflow.com/a/22870268
tagged with: nio

http://stackoverflow.com/a/22900192
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22899934
answers question: http://stackoverflow.com/q/22899934
downvote count: 0
score: 3
upvote count: 3
has body: The first thing to note is when you use the + with two operands where one of the two operands is a String, the result of the expression is a String. Therefore, in the following method invocation expression System.out.println("Mult:" + test1(4)); you are invoking the PrintStream#println(String) since out is a variable of type PrintStream. Note how the method accepts a single String argument. Therefore, the String has to be resolved from the String concatenation of "Mult:" + test1(4) For that to happen, the test1(4) method has to be executed. public static int test1(int n){ System.out.println("N:" + n); return n*2; } This method again uses PrintStream#println(String) but with the argument "N:" + n This is another String concatenation that produces the String value "N:4" for this particular invocation. The produced String value is then used as an argument to the println(..) method which outputs it to your program's standard output. The method then returns the value 8, since 4 * 2 = 8. That return value is the value of invoking the test1(4) method. So System.out.println("Mult:" + test1(4)); is equivalent to System.out.println("Mult:" + 8); Then String concatenation occurs, transforming "Mult:" + 8 into the String value "Mult:8" That String is then used as the single argument to the println(..) method which outputs it to your program's standard output.

http://stackoverflow.com/comment/34935742
type: QuestionComment
has text: So it seems I could do that with sbt-assembly. However, would it be enough to create a package using 'dist' sbt command?
score: 0
comment on: http://stackoverflow.com/q/22892975
type: Comment

http://stackoverflow.com/q/22811807
accepted answer: http://stackoverflow.com/a/22812112
type: AnsweredQuestion
answer count: 1
has body: I wrote a code to zip files in a selected directory but it does not search the sub-directories for files, I found a loop that I inserted but that still does not seem to work. If someone could please assist where I can ammend my code so it searches all the folders in the path inserted. Please see code below: import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import javax.swing.JOptionPane; public class List { private static void getFiles(File folder, java.util.List&lt;File&gt; list) throws FileNotFoundException, IOException { String v_days; // number of days inserted v_days = JOptionPane.showInputDialog("Enter duration of days back that should be archived? (Numerical Value)"); folder.setWritable(true); File[] files = folder.listFiles(); long purgeTime = System.currentTimeMillis() - ((long)Integer.parseInt(v_days) * 24 * 60 * 60 * 1000); //Calculate how old files must be before they get archived try { for (int j = 0; j &lt; files.length; j++) { if (files[j].lastModified() &lt; purgeTime ) { list.add(files[j]); if (files[j].isDirectory()) { getFiles(files[j], list); { byte[] buffer = new byte[4096]; // create byte buffer String zipFileName = files[j].getAbsolutePath() + ".zip" ; //Create the final zip name of the file String zipFileFullPath = files[j].getAbsolutePath() ; //Get the full path of the normal file before being zipped System.out.println("Starting with file: " + zipFileFullPath ); System.out.println("File name will be: " + files[j].getAbsolutePath() + ".zip") ; FileOutputStream fos = new FileOutputStream(zipFileName); //Add the final zip name to the output stream ZipOutputStream zos = new ZipOutputStream(fos); //Add the final zip name to the output stream FileInputStream fis = new FileInputStream(files[j]); //Add the current file for the iteration into the input st…
type: Question
has title: Code zips files in directory but not subdirectory
has answer: http://stackoverflow.com/a/22812112
score: 0
tagged with: java

http://stackoverflow.com/comment/34984793
has text: Vishrant, for example "my_url.htm"
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22920125
type: QuestionComment

http://stackoverflow.com/q/22850519
answer count: 2
has body: the dao layer of my application need a hibernate reference. so all the dao bean need it. I config each, I wander if there are a way to inject a bean to a set of bean in spring? like pointcut expression.
accepted answer: http://stackoverflow.com/a/22856449
has title: How to inject one bean to a set of bean in spring?
score: 0
possible better answer: http://stackoverflow.com/a/22850595
has answer: http://stackoverflow.com/a/22850595
has answer: http://stackoverflow.com/a/22856449
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/comment/34980989
has text: Is there a missing `}` ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22918392

http://stackoverflow.com/comment/34970039
has text: Ok now that i get the solution i realised how simple it is :/ thanks nonetheless
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22911923
type: Comment

http://stackoverflow.com/q/22822417
upvote count: 1
favorite count: 0
downvote count: 0
has body: I was trying to implement singleton pattern in Robocode. But unfortunately, when new round starts, every time a new object (which is singleton) is created. Do you know if it is possible to use singleton pattern in Robocode? If not, could you explain me why?
has answer: http://stackoverflow.com/a/22822538
accepted answer: http://stackoverflow.com/a/22822538
tagged with: robocode
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 1
has title: Singleton pattern in Robocode

http://stackoverflow.com/q/22841656
has answer: http://stackoverflow.com/a/22841902
type: Question
accepted answer: http://stackoverflow.com/a/22841836
tagged with: java
has answer: http://stackoverflow.com/a/22841836
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34842500
has body: I'm just starter at coding . I wanna write a game code and I have a problem : I want to call an object of one class in another class but there is a eror with my code. I have three classes : Game , Player , commandReader. class Player : public class Player{ public void moveUp(){ ... } } I had been created an object of class Player in Game class: public class Game{ public Player player; private Game(){ player = new Player; } // methods omitted } I want to call object "player" in another class named commandReader : public class commandReader{ public readCommand(String command){ if(command == "Up"){ player.moveUp(); } } } but there is a error when I run the code. the object player is unknown for class commandReader. I should mention that I don't wanna create another object of class Player in class commandReader and I just use the one that has been created in the Game class. how should I call that?
has comment: http://stackoverflow.com/comment/34842351
has answer: http://stackoverflow.com/a/22841914
has title: how to call object of one class that has been created in another class?
possible better answer: http://stackoverflow.com/a/22841902
type: AnsweredQuestion

http://stackoverflow.com/q/22910880
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22944296
upvote count: 1
tagged with: web-services
linked to: http://stackoverflow.com/q/14937710
tagged with: playframework-2.1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22944296
type: Question
has title: How to send request parameters with same parameter-name
has body: This question is an extension to How do I set params for WS.post() in play 2.1 Java My web service request handler is as follows @POST @Path("/requestPath") public String addChallengersToLeague( @FormParam("name") String name, @FormParam("values") List values); since WSRequestHolder accepts a Map&lt;String, String&gt; in setQueryParameter method, I am not able to send parameter list with same name. I can send request from POSTMAN with multiple parameters having name 'values'and it works fine. Can you suggest how to do the same using play? I am using play 2.1.3 Thanks in advance.

http://stackoverflow.com/comment/35002473
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22929851
has text: @RaulGuiu, just because of the publish time.
score: 0

http://stackoverflow.com/comment/34892359
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22868431
has text: @JanDvorak you are right. Still it's both starting with a flag ;-) Was trying to keep the comment from exploding.
type: QuestionComment

http://stackoverflow.com/comment/35027053
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22943135
score: 0
has text: @queenbee - not converting the code, but using JNI or similar to include the C++ code in your java.

http://stackoverflow.com/comment/34878921
type: QuestionComment
comment on: http://stackoverflow.com/q/22861853
has text: You can have both, there should be no problem. Show your code for the `IDoubleClickListener`.
score: 0
type: Comment

http://stackoverflow.com/comment/34797913
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22815568
has text: If I do that, newArray will change once I change array. You are not making a copy, just changing the reference of array.
score: 0

http://stackoverflow.com/a/22833456
score: -1
answers question: http://stackoverflow.com/q/22833135
has body: onActivityResult() is only work in Activity Class. First you extends Activity then after use onActivityResult() after onCreate().
upvote count: 0
type: Answer
downvote count: 1

http://stackoverflow.com/a/22938969
has comment: http://stackoverflow.com/comment/35023788
has body: ou can use setRowCount(int rowCount) on you table dataModel. which will sets the number of rows in the model. If the new size is greater than the current size, new rows are added to the end of the model If the new size is less than the current size, all rows at index rowCount and greater are discarded. For Example: DefaultTableModel dtm = (DefaultTableModel) tabel1.getModel(); dtm.setRowCount(100); // though I would use some variable here tabel1.setModel(dtm); Please find the explanation here.
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/35024308
accepted answer of: http://stackoverflow.com/q/22938649
has comment: http://stackoverflow.com/comment/35026030
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22938649
downvote count: 0
has comment: http://stackoverflow.com/comment/35019906

http://stackoverflow.com/a/22917349
has comment: http://stackoverflow.com/comment/34980389
type: Answer
has comment: http://stackoverflow.com/comment/34980323
accepted answer of: http://stackoverflow.com/q/22917265
answers question: http://stackoverflow.com/q/22917265
score: 0
has comment: http://stackoverflow.com/comment/34980051
has body: The problem is that you are using Android's R file, instead you should use "your.package.name.R.Img1", that way the reference will point to the right R file ImageView imgVw = (ImageView) findViewById(your.package.name.R.id.Img1); Replace "you.package.name" with whatever string you are using in the manifest file: &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="your.package.name" Hope it Helps! Regards!
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34980738

http://stackoverflow.com/comment/34892432
comment on: http://stackoverflow.com/q/22869360
score: 0
type: Comment
type: QuestionComment
has text: Are you trying to import a `serial` module within a module also named `serial`?

http://stackoverflow.com/comment/34889758
comment on: http://stackoverflow.com/a/22847143
score: 0
type: AnswerComment
has text: @LuiggiMendoza I disagree. The core of the answer was 1.) what is the mechanism to change the ordering and 2.) how to jump through the hoops to set it up. I couldn't possibly answer how to code `compare()` since the OP did not include their domain classes or how they wanted them sorted.
type: Comment

http://stackoverflow.com/comment/34825114
type: Comment
type: QuestionComment
has text: @Christian : its because of the uppercase that you are telling me this ? ps : I edited. And if I ask here maybe I searched before coming here :D
comment on: http://stackoverflow.com/q/22831890
score: 0

http://stackoverflow.com/q/22886813
type: AnsweredQuestion
tagged with: java
has body: Write a program the reads whole numbers from a text file and then sorts the numbers. Then using the binary search algorithm from your notes (week6) Ask the user to enter a number and display what position the number is or not found if the number is not in the list. my code so far: import java.util.Arrays; public class myBinarySearch { public static void main(String[] args) { int i; int target, found; int[] numArray = {36, 27, 29, 15, 16, 39, 11, 31}; Arrays.sort(numArray); for(i=0; i &lt;numArray.length; i++) System.out.print(numArray[i] + " "); System.out.print("\nEnter the number you are searching for: "); target = ReadKb.getInt(); found = theBinarySearch(numArray, target); if(found == -1) System.out.println("Number not found"); else System.out.println("Number: " +target +" found at position: " +found); } //Method searching using binary search algorithm private static int theBinarySearch(int []numArray, int target) { int mid,bottom,top; mid=0; bottom=0; top=numArray.length-1; while (top&gt;= bottom) { mid=(top +bottom)/2; if(target==numArray[mid]) break; else if(target&lt;numArray[mid]) top=mid-1; else bottom=mid+1; } if(target==numArray[mid]) return mid; else return -1; } } and the txt document: numbers.txt 55 12 88 33 25 5 3 23 64 21
type: Question
answer count: 2
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22886929
has answer: http://stackoverflow.com/a/22886921
accepted answer: http://stackoverflow.com/a/22886921
has answer: http://stackoverflow.com/a/22886929
tagged with: search
score: 0
tagged with: binary
has title: binary search from txt excercise

http://stackoverflow.com/comment/34943876
type: Comment
has text: @OliCharlesworth Oops. Red face over here! Kind of silly though; it ought to exist, because it would behave differently from `&=`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22897582

http://stackoverflow.com/comment/34945780
type: Comment
type: QuestionComment
has text: `table[i].length` returns the length of each individual one dimensional array inside the two dimensional array `table` on each iteration of the outer most `for` loop.
comment on: http://stackoverflow.com/q/22898625
score: 0

http://stackoverflow.com/a/22881817
has body: You should use interfaces. Make an interface something like: public interface Something { void doSomething(GameObject object); } Where doSomething is the method which will be called (In this case could be objectCollision) same for interface name (ObjectCollider(?)). then let GameScene implement it public class GameScene implements Something and implement the method. In the Player class, add a listener to this: public class Player { private Something listener; And in the constructor ask for the listener: public Player(Something listener) { this.listener = listener; } Then to invoke it, just use listener.doSomething(object); Example: public void Collision(GameObject object) { if(object instanceof Coin) { //throws an event here listener.doSomething(object); } } To create the Player object with this constructor you just need to do: Player player = new Player(this); // if you implement the method in the class
score: 9
answers question: http://stackoverflow.com/q/22881661
downvote count: 0
upvote count: 9
type: Answer

http://stackoverflow.com/a/22930712
has body: Regarding the problem as to why your parsing code doesn't work when running from android, I can only assume that the html retrieved might be different, but that is only a guess. You need to debug the code when running it from you android. A solution might be to output the retrieved html to a log file and see if there is a difference. Regarding showing your message using Toast: String text = "Found " + StringArray.size() + " images at the url: " + html; Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show(); NOTE: you don't need to increment the count variable, you can just see how big the StringArray list is, by calling StringArray.size()
has comment: http://stackoverflow.com/comment/35042160
type: Answer
answers question: http://stackoverflow.com/q/22928496
score: 0

http://stackoverflow.com/comment/35066756
comment on: http://stackoverflow.com/q/22964985
score: 0
has text: Hmm, I forgot about the shared cache. A simple find would probably return the stale instance from the cache. So you probably should evict the instance first: sessionFactory.evict(MyEntity.class, entity.getId()), then find it, then merge your instance. If you are using optimistic locking with @Version, you will have to update the version field on your entity to match the latest version.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34961630
score: 0
has text: @HamidShatu i updated the question with my main activity code
comment on: http://stackoverflow.com/q/22907586
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22839798
tagged with: nginx
has comment: http://stackoverflow.com/comment/34840649
has comment: http://stackoverflow.com/comment/34838962
tagged with: session
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20623099
tagged with: servlets
has comment: http://stackoverflow.com/comment/34839507
has title: Same JSESSIONID but different Session Object
type: Question
score: 0
tagged with: tomcat7
tagged with: java
has comment: http://stackoverflow.com/comment/34839156
has body: I have an Java Http Servlet and trying to store things into the session. I have checked the request header and the same JSESSIONID is being sent each request. However, every time, the session object (id) is different AND it contains none of the properties that we set in the last request. More details: This works fine with just Tomcat7, but when I try to use nginx as a frontloader, the cookie is still sent, but the session object is still different. Looks like the request URL is a fully-qualified domain. Any ideas on what would be causing this or how to debug? Thanks!
has comment: http://stackoverflow.com/comment/34838752

http://stackoverflow.com/a/22817374
has comment: http://stackoverflow.com/comment/34823089
has body: The syntax you provide isn't so terribly wrong, actually, but may not turn out like you expect. The query: -record_id:123 Is not very useful. Lucene does not support pure negative queries. Lucene needs to have something to search for, if it is only given things not to match, it will match nothing. Since your goal appears to be just filtering to only documents with recordState = DRAFT, having been given a valid query, it would be reasonable to return no results, since the user entered query isn't really any good. A query like: +recordState:DRAFT +(-record_id:123 anotherfield:terms) would be just fine, and: +recordState:DRAFT +(+record_id:123) The + inside the parentheses isn't really necessary, but it will also work without any problems. If you want to detect a pure negative query like this, either by analyzing the query string, or iterating a BooleanQuery return from the parser, something like: BooleanQuery query = (BooleanQuery)parser.parse; BooleanClause[] clauses = query.getClauses(); if (clauses.length == 1 &amp;&amp; clauses[0].getOccur() == BooleanClause.Occur.MUST_NOT) { booleanQuery.add(clauses[0]); } else { booleanQuery.add(query, BooleanClause.Occur.MUST); } Which might deal with the very specific case, but keep in mind, if the user can create a query of arbitrary complexity, they can just as well create the same issue nested somewhere in the query. Also, the query parser is not guaranteed to return a BooleanQuery, so that's a bit of an assumption.
accepted answer of: http://stackoverflow.com/q/22816297
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22816297
score: 2
upvote count: 2

http://stackoverflow.com/comment/35274771
score: 0
has text: Does the GUI show up when you run the project within NetBeans?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22880095

http://stackoverflow.com/a/22863697
has comment: http://stackoverflow.com/comment/34883934
accepted answer of: http://stackoverflow.com/q/22863339
answers question: http://stackoverflow.com/q/22863339
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34883403
has body: Why not to make Your ScanResultsDialog couple of extra methods: public void setText(String msg) { textArea.settext(msg); }; // good public JTextArea getTextArea() { return textArea; }; // bad Tough I'd consider later highly undecommended -- why should You do something with dialog's inner objects from outside? Seems to be a bad idea.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34981535
has text: Please post the stacktrace
score: 2
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22918704

http://stackoverflow.com/a/22839992
type: Answer
has body: Here's an alternative to your Programs.I've verified this myself, so you can be assured that it will work. Important thing you need to know, is that any file can be compiled only if you have a main method for that file(ie in that class). so here's a detailed 'How to do it': PlayerDemo.java: package Java.ACP.Cricket; class Player{ //class members &amp; methods } class PlayerDemo{ public static void main(String[] args){ System.out.println("Player Class"); } } CricPlayerDemo.java: package Java.ACP.Cricket; class CricPlayer extends Player{ // class members &amp; methods } class CricPlayerDemo{ public static void main(String[] args){ System.out.println("CricPlayer Class"); } } Main.java: package Java.ACP.Cricket; class Main{ public static void main(String[] args){ System.out.println("Main Class"); //use other class objects here directly. } } In E: , do following stepwise: 1&gt; javac PlayerDemo.java (this creates Player.class &amp; PlayerDemo.class) 2&gt; copy Player.class to Cricket folder. 3&gt; javac CricPlayerDemo.java (this creates CricPlayer.class &amp; CricPlayerDemo.class) 4&gt; copy CricPlayer.class to Cricket folder. 5&gt; javac Main.java 6&gt; copy Main.class to Cricket folder. 7&gt; now,also in E:, java Java/ACP/Cricket/Main Instead of compiling from E:, you can also compile from Cricket,to avoid copying class files,but it wont work for CricPlayerDemo.java, as CricPlayer extends Player(whose location is acc to package) so you'll have to compile CricPlayerDemo from E:
answers question: http://stackoverflow.com/q/22838489
score: 0

http://stackoverflow.com/q/22906028
tagged with: servlets
has comment: http://stackoverflow.com/comment/34959007
type: AnsweredQuestion
tagged with: selenium-firefoxdriver
has title: Not able to create FirefoxDriver instance in a servlet
type: Question
has answer: http://stackoverflow.com/a/22906263
score: 0
tagged with: java
tagged with: selenium
answer count: 1
has body: I had created a java application for selenium webdriver. FirefoxDriver driverff= new FirefoxDriver(); used to create a new Firefox instance. This is working fine. I want to create a java web application to do the same. I have embeded the same code in the servlet class in the doget() method and it throws java.lang.NoClassDefFoundError: org/openqa/selenium/firefox/FirefoxDriver Can someone tell me how i can fix this? From an end to end perspective, what oi want to achieve is that a web page (done using servlets) has some buttons which when clicked need to open a selenium web driver and run the selenium scripts. I am assuming the java application for web-driver can be called using servlet. If there is some other alternative to achieve this, please do suggest.
accepted answer: http://stackoverflow.com/a/22906263

http://stackoverflow.com/q/22843639
has body: I am trying to create an @XmlAdapter to split words in a mixed List into objects of a Wrapper class called Word. This field may also contain instances of an extension of Word called Group. The idea is that this: Some text and a <g>group of words</g> and more would be equivalent to: span.getContent().add(new Word("Some"); span.getContent().add(new Word("text"); span.getContent().add(new Word("and"); span.getContent().add(new Word("a"); span.getContent().add(new Group("group of words"); span.getContent().add(new Word("and"); span.getContent().add(new Word("more"); I am fighting with all the possible combinations ox XmlMixed and XmlAdapter I can think of but no luck! This is my latets adapter which doesn't work at all: public class SpanAdapter extends XmlAdapter<List<Word>, List> { @Override public List<Word> marshal(List v) throws Exception { List<Word> list = new ArrayList<>(); for (Object o : v) { if (o instanceof String) { String s = (String) o; StringTokenizer st = new StringTokenizer(s, " "); while (st.hasMoreElements()) { Word word = new Word(); word.setValue(st.nextToken()); list.add(word); } } else if (o instanceof Group) { list.add((Group) o); } } return list; } @Override public List unmarshal(List<Word> v) throws Exception { List list = new ArrayList<>(); for (Word w : v) { if(w instanceof Group){ list.add(w); } else{ list.add(w.getValue()+ " "); } } return v; } } And my span class: @XmlRootElement(name = "span") public class Span extends AudioComponent implements Item.Component { private List<Word> value = new ArrayList(); @XmlMixed @XmlElementRefs({ @XmlElementRef(type = Group.class), @XmlElementRef(type = Word.class) }) @XmlJavaTypeAdapter(SpanAdapter.class) public List<Word> getValue() { return value; } public void setValue(List<Word> value) { this.value = value; } } Word and Group are just wrappers of String. Group extends Word. I am using MOXY in case it helps. Thank you in advance!
accepted answer: http://stackoverflow.com/a/22933423
type: AnsweredQuestion
tagged with: java
has title: JAXB @XmlMixed and @XmlAdapter
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/22933423
answer count: 1
score: 0
tagged with: moxy
tagged with: xmladapter

http://stackoverflow.com/comment/96236322
score: 1
type: Comment
comment on: http://stackoverflow.com/a/41542026
has text: Apache Commons-IO's DirectoryWalker is about as fast Files.walkFileTree. https://docs.leponceau.org/java-examples/java-evaluation/org.apache.commons.io.FileWalkerPerfTest.html vs https://docs.leponceau.org/java-examples/java-evaluation/tests.java.nio.file.FilesWalkFileTreePerfTest.html
type: AnswerComment

http://stackoverflow.com/q/22816326
has answer: http://stackoverflow.com/a/22816937
has comment: http://stackoverflow.com/comment/34797056
has body: i need to get an array of Works for this json string: [ { "worktypes": [ { "works": [ { "price": "22,22", "code": "A00011", "name": "name 2" }, { "price": "22,22", "code": "A00011", "name": "name 3" }, { "price": "22,22", "code": "A00011", "name": "name 4" }, { "price": "11", "name": "aa", "code": "aa" }, { "price": "12,22", "name": "Nombre", "code": "A00112" }, { "price": "22", "name": "asdads", "code": "asdasd" }, { "price": "11", "name": "yy", "code": "yy" } ], "name": "Pompas" } ] } ] I try this: List&lt;Work&gt; works = gson.fromJson(value.toString(), new TypeToken&lt;List&lt;Work&gt;&gt;() {}.getType()); But dont get anyone..whats wrong? PD:Work is a class with the price, code and name values.
has title: Extract objects from this Json string with GSON
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
upvote count: 1
type: Question

http://stackoverflow.com/q/22853775
favorite count: 0
has answer: http://stackoverflow.com/a/22854132
has comment: http://stackoverflow.com/comment/34864549
has answer: http://stackoverflow.com/a/22853830
has comment: http://stackoverflow.com/comment/34869055
has comment: http://stackoverflow.com/comment/34864622
has answer: http://stackoverflow.com/a/22854101
type: UnansweredQuestion
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/22854043
has comment: http://stackoverflow.com/comment/34865687
has title: How do you Bubble Sort Largest to Smallest
has comment: http://stackoverflow.com/comment/34864663
tagged with: java
has body: Sorry am kind of lame at this. I've looked on here for a way to Bubble sort so that I can get an array to go from largest number to smallest. I've found some error in my current iteration of the sort, I can't seem to get the array to sort once it compares a smaller number to a bigger number. Here what I am using thus far. //bubble sort for(int i=0;i&lt;size;i++) { for(int v=1;i&lt;(size-i);i++) { if(arrInt[v-1]&lt;arrInt[v]) { temp = arrInt[v-1]; arrInt[v-1]=arrInt[v]; arrInt[v]=temp; } } }
answer count: 6
has answer: http://stackoverflow.com/a/22854093
type: Question
has answer: http://stackoverflow.com/a/22854250
downvote count: 0
tagged with: sorting
has comment: http://stackoverflow.com/comment/34864584

w3c
type: Tag
tag name: w3c
tags question: http://stackoverflow.com/q/22881415

http://stackoverflow.com/a/76052106
type: Answer
answers question: http://stackoverflow.com/q/22904573
score: 0
has body: For any uber jar generated dependency-reduced-pom.xml will contain provided dependency by a run time provider. To simply understand while running an application inside tomcat you may not need to provide Servlet jar which contain classes such as Servlet.class dependencies. It will be provided by Selected Run Time environment.

http://stackoverflow.com/a/22899772
answers question: http://stackoverflow.com/q/22895279
has comment: http://stackoverflow.com/comment/34970724
type: Answer
has comment: http://stackoverflow.com/comment/34971991
has body: The parser is not responsible for getting something from somewhere, the parser just parses the stuff you feed to him. So create something dedicated like an AsyncTask (runs in background) which gets the stuff for you, then an AsyncTask to parse the stuff. You really should check out AsyncTask. See my example ... (it should work, I didn't actually test it ... :) And you should probably have a look at the Google Volley library, easier HTTP stuff. Update : I included the fragment, (check the onCreateView, although you should maybe look for a better place than onCreateView to start your task), how the xml handler can be used to get the document and some comments how you can access the document...(again, it should work, I didn't test this and it is only to show you how to do it...) import java.io.IOException; import java.io.StringReader; import java.io.UnsupportedEncodingException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import android.app.Fragment; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class GameFragment extends Fragment { // All static variables public static final String URL = "http://api.androidhive.info/pizza/?format=xml"; // XML node keys static final String KEY_ITEM = "item"; // parent node static final String KEY_ID = "id"; static final String KEY_NAME = "name"; static final String KEY_COST = "cost"; static final String KEY_DESC = "description"; private static cla…
score: 0
has comment: http://stackoverflow.com/comment/34952498
has comment: http://stackoverflow.com/comment/34972062
has comment: http://stackoverflow.com/comment/34983544
has comment: http://stackoverflow.com/comment/34953529
has comment: http://stackoverflow.com/comment/34971613
has comment: http://stackoverflow.com/comment/34980713
accepted answer of: http://stackoverflow.com/q/22895279
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34972593
has comment: http://stackoverflow.com/comment/34961009

http://stackoverflow.com/a/22867204
has comment: http://stackoverflow.com/comment/34888725
downvote count: 0
answers question: http://stackoverflow.com/q/22866925
type: Answer
score: 1
has body: Here to check if you have a toString method in your object : import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class TemplateHelper { public static void main(String [] args){ int a = 3; try { objToString(a); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void objToString(Object object) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException{ Class c = object.getClass(); Method[] methods = c.getMethods(); for (Method method : methods) { if(method.getName().equals("toString")){ System.out.println(method.getName()); //THERE IS toString in object break; } } } }
upvote count: 1
has comment: http://stackoverflow.com/comment/34888661

http://stackoverflow.com/q/22872484
type: Question
has comment: http://stackoverflow.com/comment/34914728
score: 10
has answer: http://stackoverflow.com/a/63178014
has comment: http://stackoverflow.com/comment/34899157
tagged with: eclipse
has answer: http://stackoverflow.com/a/67543750
tagged with: javafx-8
answer count: 3
has body: I've been struggling with this problem a lot now and I can't seem to figure it out. I need some way of displaying Emoji's (as in WhatsApp) in a JavaFX Application. I tried it with awt and Swing and I haven't had any success now (EDIT: swt works but probably just for Mac's) I tried it with extended Unicode and Codepoints but this didn't help. I hope it's even possible, because Windows usually doesn't let you display Emoji's (I myself use a Mac). Today I stumbled over this post about Emoji's in JavaFX 8. There a guy says he has implemented a way of displaying Emoji's in JavaFX by extending the javafx.scene.text.TextFlow class. There is also a link to a little presentation and from the 57th slide upwards it explains these so called EmojiFlow objects a little. However I can't seem to find a download! Thanks to everyone answering, I've been struggling so long with this one, maybe it even is impossible Here is a little not working example: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.VBox; import javafx.scene.text.Text; import javafx.scene.text.TextFlow; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage stage) { VBox root = new VBox(); // I used TextFlow here because the article suggested // extending this class, but I know it's not working // just like this TextFlow textFlow = new TextFlow(new Text("Should be alien smiley: " + (char) 0xF47D)); // casting a hex number to a char is equal to using "\uF47D" root.getChildren().add(textFlow); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } }
has answer: http://stackoverflow.com/a/26847576
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34898758
type: UnansweredQuestion
has title: JavaFX: How can I display Emoji?
has comment: http://stackoverflow.com/comment/34913691
tagged with: java
tagged with: javafx
upvote count: 10
tagged with: emoji

http://stackoverflow.com/q/22938201
has title: Infinispan MongoDb CacheStore Exception
has body: I want to use MongoDb as cachestore for Infinispan but getting following exception It is different form the question Exception using mongodb as infinispan cache store since the method b.loader() is not availabe in infinispan 7.0 jar i just figured out the turn around by using b.persistence.addStore() but still getting the exception as mentioned in the question Code-- ConfigurationBuilder b = new ConfigurationBuilder(); b.loaders().addStore( MongoDBCacheStoreConfigurationBuilder.class).host( "localhost" ) .port( 27017 ) .timeout( 1500 ) .acknowledgment( 0 ) .username( "mongoDBUSer" ) .password( "mongoBDPassword" ) .database( "infinispan_cachestore" ) .collection( "entries" ); final Configuration config = b.build(); MongoDBCacheStoreConfiguration store = (MongoDBCacheStoreConfiguration) config.loaders().cacheLoaders().get(0); EmbeddedCacheManager cacheManager=new DefaultCacheManager(); cacheManager.defineConfiguration("usersCache", config); //DefaultCacheManager manger=new DefaultCacheManager(config); Cache&lt;String, String&gt; usersCache = cacheManager.getCache("usersCache"); Exception:-- log4j:WARN No appenders could be found for logger (org.jboss.logging). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Exception in thread "main" org.infinispan.CacheException: Unable to invoke method public void org.infinispan.loaders.CacheLoaderManagerImpl.start() on object of type CacheLoaderManagerImpl at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:207) at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:889) at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:658) at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:647) at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.…
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/22934135
has comment: http://stackoverflow.com/comment/35056621
score: 0
tagged with: mongodb
answer count: 1
type: UnansweredQuestion
tagged with: infinispan
has comment: http://stackoverflow.com/comment/35022175
has answer: http://stackoverflow.com/a/22938446
duplicate of: http://stackoverflow.com/q/22934135

http://stackoverflow.com/q/22881053
has comment: http://stackoverflow.com/comment/34914930
has comment: http://stackoverflow.com/comment/34915144
tagged with: php
has title: FATAL EXCEPTION: AsyncTask #1, android remote database registration
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34913865
tagged with: mysql
has comment: http://stackoverflow.com/comment/34914748
type: Question
has comment: http://stackoverflow.com/comment/34913928
answer count: 1
has answer: http://stackoverflow.com/a/22881099
accepted answer: http://stackoverflow.com/a/22881099
score: 0
has comment: http://stackoverflow.com/comment/34914873
tagged with: android
has body: I've been trying to build a registration system for android using php and mysql but i have come across an error that i am unable to fix. Could someone have a look at it and see if they spot anything that i don't please. register code: public class RegisterActivity extends Activity implements OnClickListener { private EditText user, pass; private Button mRegister; // Progress Dialog private ProgressDialog pDialog; // JSON parser class JSONParser jsonParser = new JSONParser(); private static final String LOGIN_URL = "http://95.85.22.140/webservice/register.php"; private static final String TAG_SUCCESS = "success"; private static final String TAG_MESSAGE = "message"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); user = (EditText)findViewById(R.id.registerUsername); pass = (EditText)findViewById(R.id.registerPassword); mRegister = (Button)findViewById(R.id.btnRegisterDetails); mRegister.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub new CreateUser().execute(); } class CreateUser extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ boolean failure = false; @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(RegisterActivity.this); pDialog.setMessage("Creating User..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected String doInBackground(String... args) { // TODO Auto-generated method stub // Check for success tag int success; String username = user.getText().toString(); String password = pass.getText().toString(); try { // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("username", username)); params.add(new BasicNameValuePair("password", password)); Log.d("request!", "st…

http://stackoverflow.com/q/22809348
answer count: 3
score: 5
downvote count: 0
favorite count: 0
has title: how to Manually shuffle the array list
accepted answer: http://stackoverflow.com/a/22837773
possible better answer: http://stackoverflow.com/a/22809431
has answer: http://stackoverflow.com/a/22809431
type: AnsweredQuestion
has body: I have an arraylist contains some values that are in an order (correct positions), Now I want to swipe/set/manual shuffle change the values into disorder of the arraylist. Below image can give my idea.Change Array-II to Array-I. To shuffle we can use collection.shuffle(), but here I have a text file, in that text file i wrote a original position as well as current position of the data in the array on to the text file. for example imaging, we have a text file name MyFile.txt, I wrote data in that like this, "original_position~Current_position" for example 0~0 1~2 2~4 3~3 4~1 so, based on the above data i would to shuffle/ set the array.
has answer: http://stackoverflow.com/a/22809388
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22837773
upvote count: 5
tagged with: arraylist

http://stackoverflow.com/q/22838452
answer count: 0
downvote count: 0
tagged with: java
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/34836357
score: 4
has title: Tomcat Embedded - ClassNotFoundException: JspServlet
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/34836618
has comment: http://stackoverflow.com/comment/34836463
type: UnansweredQuestion
tagged with: maven
upvote count: 4
has body: i want to use Tomcat to test some web services (using maven). The Tomcat is running with maven @ test. When i try to deploy my war, i directly get a ClassNotFoundException for JspServlet. The jasper jars are in the classpath and i debugged through the code. Try to load the class with loadClass() -> get this error, Class.forName() is working... Maybe someone has an idea My test Class: @BeforeClass public static void setUp() throws Exception { wsdlURL = new URL(address + "?wsdl"); String appBase = "./target"; tomcat = new Tomcat(); tomcat.setPort(Integer.parseInt(System.getProperty("port"))); tomcat.setBaseDir("."); tomcat.getHost().setAppBase(appBase); StandardServer server = (StandardServer) tomcat.getServer(); AprLifecycleListener listener = new AprLifecycleListener(); server.addLifecycleListener(listener); Context app = tomcat.addWebapp("/service", warFile.getAbsolutePath()); app.addSecurityRole("AllRole"); tomcat.start(); } Parts of my pom.xml: org.apache.maven.plugins maven-surefire-plugin 2.10 warFile ${project.build.finalName} port 9101 <classpathDependencyExcludes> <classpathDependencyExclude>javax:javaee-web-api</classpathDependencyExclude> </classpathDependencyExcludes> [...] org.apache.tomcat.embed tomcat-embed-core ${tomcat.version} test org.apache.tomcat.embed tomcat-embed-logging-juli ${tomcat.version} test org.apache.tomcat.embed tomcat-embed-jasper ${tomcat.version} test org.apache.tomcat tomcat-jasper ${tomcat.version} test org.apache.tomcat tomcat-jasper-el ${tomcat.version} test org.apache.tomcat tomcat-jsp-api ${tomcat.version} test org.apache.tomcat tomcat-servlet-api ${tomcat.version} test I tried tomcat version 7 and 8. Maybe someone has an idea why the jasper package is ignored?

http://stackoverflow.com/comment/110625761
type: Comment
comment on: http://stackoverflow.com/a/32319955
score: 0
type: AnswerComment
has text: @Savior JVM. There is a parent context. Here we're talking about how to shut down a Spring boot application. You normally don't shut down web applications this way. So this mechanism is usually used for short lived applications that do something then need to stop. By default, Spring boot will just keep on running even after you finished your batch processing so that's where you would want to use this mechanism.

http://stackoverflow.com/comment/34797550
score: 0
comment on: http://stackoverflow.com/q/22816422
type: Comment
type: QuestionComment
has text: I want to make sure "uppers" are only uppercase letters and so on with the others. I define what I want them to be at String uppers = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String lowers = "abcdefghijklmnopqrstuvwxyz"; String digits = "0123456789"; String symbols = "`~!$%^&*()_+{}|:<>?/.,';][=-"; String total = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789`~!$%^&*()_+{}|:<>?/.,';][=-";

http://stackoverflow.com/q/22954916
type: Question
has answer: http://stackoverflow.com/a/22955034
answer count: 1
tagged with: ubuntu
score: 0
tagged with: linux
has body: i have written a application that communicates via zeroMQ with another application. On my development machine running Ubuntu 13 is all well and working. I do have zeroMQ 4.4.0 installed, also the jzmq java binding did compile without errors. But on our testing/production server i get this. The application starts up and from requestInit() it tries to request it's configuration from the main configuration manager over zeroMQ. bs@server-01:~/$ java -Djava.library.path=/usr/local/lib -jar /home/bs/opengraphchild/jar/opengraph.jar 5000 opengraph1 Params = 5000 Params = opengraph1 Starting Test service ... Running TestService.requestInit() Exception in thread "main" java.lang.UnsatisfiedLinkError: org.zeromq.ZMQ$Socket.nativeInit()V at org.zeromq.ZMQ$Socket.nativeInit(Native Method) at org.zeromq.ZMQ$Socket.&lt;clinit&gt;(ZMQ.java:521) at org.zeromq.ZMQ$Context.socket(ZMQ.java:451) at bs.core.service.GenericService.initZmqClient(GenericService.java:41) at bs.service.opengraph.OpenGraph.requestInit(OpenGraph.java:131) at bs.service.opengraph.OpenGraph.run(OpenGraph.java:62) at bs.service.opengraph.OpenGraphRunner.main(OpenGraphRunner.java:13) I could not find anything relevant to my issue so i'm asking you guys. Please help :( [don't know if you need to see sourcecode, since it's working on my local machine, but i can add it] output of ldconfig -v | grep zmq /sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once /sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once libzmq.so.3 -&gt; libzmq.so.3.1.0 libjzmq.so.0 -&gt; libjzmq.so.0.0.0 libzmq.so.1 -&gt; libzmq.so.1 /sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: Permission denied output of ldd /usr/local/lib/libzmq.so: linux-vdso.so.1 =&gt; (0x00007fffcdf7c000) librt.so.1 =&gt; /lib/x86_64-linux-gnu/librt.so.1 (0x00007f565a105000) libpthread.so.0 =&gt; /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5659ee8000) libstdc++.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libstd…
type: UnansweredQuestion
tagged with: zeromq
tagged with: java
tagged with: unsatisfiedlinkerror
has title: zeroMQ UnsatisfiedLinkError in java application

http://stackoverflow.com/q/22888022
score: 2
accepted answer: http://stackoverflow.com/a/22888445
has title: Android Publish/Subscribe Singleton Example
upvote count: 2
tagged with: software-design
type: Question
type: AnsweredQuestion
tagged with: android-layout
tagged with: android-fragments
tagged with: java
has body: Can someone provide a simple example of using the Publish/SUbscribe singleton pattern to pass information between fragments. Last week I asked about passing data between fragments for the scenario below and this method was suggested; I can't seem to wrap my head around it. I have an application using the navigation drawer layout, with various "sub applications" that perform standalone functions (for example, a calculators app, with unrelated "sub apps" for income tax calculations, metric/imperial conversions, etc). For a given calculator, I'd have a data entry/selection fragment and a data presentation fragment that displays the calculation in some meaningful type of way. Thus, my only activity in the application is the MainActivity, holding the navigation drawer and content pane. The question is: what is the best way to design the application such that the various calculators pass data to their data representation fragments, say on the click of a button?
has answer: http://stackoverflow.com/a/22888445
downvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/22749483
tagged with: android

http://stackoverflow.com/comment/98547440
type: AnswerComment
type: Comment
has text: Attention! This is NOT providing you with java.util.Date
comment on: http://stackoverflow.com/a/28564046
score: 1

http://stackoverflow.com/a/22939166
has comment: http://stackoverflow.com/comment/35037308
answers question: http://stackoverflow.com/q/22937415
has comment: http://stackoverflow.com/comment/35021328
has comment: http://stackoverflow.com/comment/35037101
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35018824
score: 1
has body: The Registry doesn't have the named class available on its CLASSPATH and/or you haven't set up the codebase correctly, if at all. You don't have to use the codebase feature, but if you do it has to be correct. An easier way out of this may be to start the Registry in the server JVM, via LocateRegistry.createRegistry().
has comment: http://stackoverflow.com/comment/35150926
upvote count: 1
has comment: http://stackoverflow.com/comment/35019335

http://stackoverflow.com/comment/35020178
type: AnswerComment
type: Comment
has text: You slighty misinterpreted that sentence from Effective Java. On average, a hash access is *O(1)*, whereas a linked list (or a degenerate hash table) has *O(n)* access time. So if you have an algorithm that does a hash access *n* times this has *O(n)* average complexity (because *O(n) = O(n) · O(1)*) but *O(n²)* worst case complexity.
score: 1
comment on: http://stackoverflow.com/a/22939713

http://stackoverflow.com/q/22959212
tagged with: servlets
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35054285
possible better answer: http://stackoverflow.com/a/22959297
has answer: http://stackoverflow.com/a/22959297
tagged with: android
has answer: http://stackoverflow.com/a/22964556
has body: after searching around im able to retreive a response from my servlet , but i cant send a parameter (a username and a password parameter) from android to a servlet! My logcat shows this error: 04-0java.lang.ClassCastException: org.apache.http.client.methods.HttpGet cannot be cast to org.apache.http.HttpResponse at com.example.httpgetandroidexample.MainActivity$AsyncTaskRunner.doInBackground(MainActivity.java:76) at com.example.httpgetandroidexample.MainActivity$AsyncTaskRunner.doInBackground(MainActivity.java:1) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) and i cant understand why! Here it is my android main activity: package com.example.httpgetandroidexample; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity { public TextView content; EditText name,pass; String URL,nameValue,passValue; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); name = (EditText)findVie…
has comment: http://stackoverflow.com/comment/35054387
has title: Error while sending a GET Request to a servlet from android
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22964556

http://stackoverflow.com/comment/34869878
has text: you can check this thread (maybe the second answer): [Parsing HTML table data with xpath and selenium in java](http://stackoverflow.com/questions/10323884/parsing-html-table-data-with-xpath-and-selenium-in-java)
score: 0
comment on: http://stackoverflow.com/q/22855131
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/65809266
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22812381
has text: found an answer to this one?

http://stackoverflow.com/comment/34817310
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22827635
type: Comment
has text: :Hey thanks for your suggestion..It worked for me by removing Action listener from my code....

http://stackoverflow.com/q/22841424
has answer: http://stackoverflow.com/a/39276138
has answer: http://stackoverflow.com/a/22846343
upvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/59558707
score: 1
tagged with: java
tagged with: mule
has title: Accessing MuleMessage and a flow variable from Java component
possible better answer: http://stackoverflow.com/a/39276138
type: Question
answer count: 2
downvote count: 0
has body: I have a Java component that receives a payload (JsonData), like this: public String myMethod(JsonData payload) throws IOException { // do things with payload. } This is working fine, but I also need to access a flow variable within the method. I understand that, to do so, I need to run myMessage.getInvocationProperty("my-variable-name"); However, since I'm only passing the payload, I don't have access to the MuleMessage. How can I change my method so I can get access to my message/property? I tried: org.mule.RequestContext.getEvent().getMessage() but it is deprecated. Also, I've read all sorts of answers on this issue but never found a complete answer. Thanks,
accepted answer: http://stackoverflow.com/a/22846343
favorite count: 0

http://stackoverflow.com/comment/35055330
score: 1
comment on: http://stackoverflow.com/q/22959314
has text: Use a SOAPUI tool.... it will help you...http://www.soapui.org/
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22932002
has comment: http://stackoverflow.com/comment/35007355
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: gwt
has comment: http://stackoverflow.com/comment/35024802
score: 1
tagged with: java
has body: I am trying to extract a modelID from a cellList. But i cant find any methods for doing so. At the moment i put data into a list (here is the ModelID) and then send this list to the cellList. I suppose it works in the current state cause the window alert box shows all the items i put into the list. But i would like to extract the ModelID from the chosen item in the CellList. Is this possible? and if yes, how can it be achieved? List&lt;String&gt; newData = new ArrayList&lt;String&gt;(); for (ModelInfo modelInfo : getModelInfoList()) { int modelID = modelInfo.getModelID(); int modelCreator = modelInfo.getModelCreator(); String modelName = modelInfo.getModelName(); String modelCreationDate = modelInfo.getModelCreationDate(); newData.add("ModelID:" + modelID + "Creator: " + modelCreator + " Diagram name: " + modelName + " Diagram creation date " + modelCreationDate); } And a selection handler // Add a selection model to handle user selection. final SingleSelectionModel&lt;String&gt; selectionModel = new SingleSelectionModel&lt;String&gt;(); cellList.setSelectionModel(selectionModel); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { String selected = selectionModel.getSelectedObject(); if (selected != null) { //Extract MODELID TODO Window.alert("You selected: " + selected); } } }); Best regards, Kerrai
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/35005968
has title: Get information from a selected CellList item
favorite count: 0

http://stackoverflow.com/comment/61000548
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22944556
score: 0
has text: Could you provide an [SSCCE](http://sscce.org/) (including sample JSON)? If you can I can probably help resolve this. GSON has no problem with classes that contain fields of the same type, and similarly shouldn't have an issue with resolving `E` to `BBB` (or whatever type it should be). At least with the snippets you've provided I see no need to use a custom deserializer.

http://stackoverflow.com/a/22947868
has body: Firstly, you need to have all the appropriate Apache POI component jars and their dependencies on your classpath. Secondly, you then need to import the POI classes. Once you've downloaded Apache POI, and added the components to your classpath, your code would then look something like: import org.apache.poi.ss.usermodel.*; public class POIExample { public static void main(String[] args) { File f = new File("F://myFile.xlsx")); Workbook wb1 = WorkbookFactory.create(f); Sheet sheet = wb.getSheetAt(0); for (Row row : sheet) { System.out.println("\n"); for (Cell cell : row) { System.out.println("Found Cell"); } } } }
score: 0
answers question: http://stackoverflow.com/q/22946769
type: Answer

http://stackoverflow.com/comment/34789355
comment on: http://stackoverflow.com/q/22809793
score: 0
has text: You may need to call `root.refreshLocal` to get the workspace to recognize the project.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34910090
score: 0
type: Comment
type: QuestionComment
has text: Do mean an event in Eclipse or an event in your Java program?
comment on: http://stackoverflow.com/q/22878809

http://stackoverflow.com/a/22815081
has comment: http://stackoverflow.com/comment/34796022
has comment: http://stackoverflow.com/comment/34794642
upvote count: 2
score: 1
has comment: http://stackoverflow.com/comment/34794799
downvote count: 1
answers question: http://stackoverflow.com/q/22815017
has comment: http://stackoverflow.com/comment/34795969
has comment: http://stackoverflow.com/comment/34796321
has body: Creating a new array should be more efficient time-wise because it would only allocate empty references. Setting the elements to null would imply walking through the entire array to set references to null (which is default behavior on array creation) which is more time consuming (even if for an array of 6 elements it's totally negligible). EDIT : time-wise is bold because memory-wise is may not be your best option. Since you'll be creating new references, if you instantiate new object, make sure the object of your previous array are garbage collected properly (again, with only 6 elements it must be gigantic objects to see any bad performance impact).
has comment: http://stackoverflow.com/comment/34795351
has comment: http://stackoverflow.com/comment/34795003
type: Answer

http://stackoverflow.com/comment/34880160
type: Comment
type: AnswerComment
has text: that means if my a.java file is in the folder `C:\JAVA\` the MyClass has to be in `C:\JAVA\my\myclass\` ?
comment on: http://stackoverflow.com/a/22840391
score: 0

http://stackoverflow.com/q/22829012
has answer: http://stackoverflow.com/a/22829515
type: AnsweredQuestion
has title: Converting int Array to a string and displaying it in a textarea
tagged with: java
has answer: http://stackoverflow.com/a/22829124
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22829124
tagged with: arrays
score: 0
has body: Hey I just started programming and I need help with converting/displaying my array in the TextArea. The code below is part of my array class. output.setText(array[i]); gives me and error saying "needs String, found int". I'm not sure how to convert it and display the list of random numbers that are inside the array. public void setArray(int x){ for(int i = 0; i &gt; array.length; i++){ array[i] = x; } } public void fillArray(){ int arrayNumbers = randomNumber.nextInt(100)+1; for(int i= 0; i &gt; array.length ; i++){ array[i] = arrayNumbers; output.setText(array[i]); } }
possible better answer: http://stackoverflow.com/a/22829515

http://stackoverflow.com/comment/34962496
type: Comment
comment on: http://stackoverflow.com/q/22907538
score: 0
type: QuestionComment
has text: do you know how to extend some class?

http://stackoverflow.com/comment/34974503
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22914808
has text: [How do you typically read your exception stack traces?](http://stackoverflow.com/questions/12688068/how-to-read-and-understand-the-java-stack-trace)
score: 0

http://stackoverflow.com/comment/34980976
type: Comment
has text: I am living in timezone "Europe/Berlin" and can confirm that actually (in April - see your string, too) we have summer time with offset UTC+02:00. JodaTime is right.
score: 5
comment on: http://stackoverflow.com/q/22917538
type: QuestionComment

http://stackoverflow.com/q/22884138
favorite count: 0
has comment: http://stackoverflow.com/comment/34919721
tagged with: reverse
has answer: http://stackoverflow.com/a/24122788
has title: Use linked list or array to reverse a string in Java?
tagged with: linked-list
has body: I believe that we can use a for loop to reverse a string in Java. Just like below: String[] name = new String[10]; for(int i = name.length; i &gt;0; i--){ System.out.print(name[i-1]); } But another implementation is using LinkedList. So my understanding is to use LinkedList when the client is not sure how long the string array might increase dynamically. Is that correct?
has comment: http://stackoverflow.com/comment/34943975
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34920300
has comment: http://stackoverflow.com/comment/34919639
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/393556
has comment: http://stackoverflow.com/comment/34919536
type: Question
has comment: http://stackoverflow.com/comment/34919613
upvote count: 1
tagged with: arrays
answer count: 1
tagged with: string

http://stackoverflow.com/comment/34868608
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22855997
has text: No.. Actually.. my app is a numerology app.. where user will enter his names in edittext.. and its integer value is added together and displayed.. so I cant make edittext to integer
score: 0

http://stackoverflow.com/comment/34970737
comment on: http://stackoverflow.com/a/22909070
has text: Thank you. As I'm running it on my LocalHost, I'm using "127.0.0.1". I've just input 'newClient("127.0.0.1").setVisible true;' and a new Client window now shows up, but it is not functional, i.e. it doesn't connect to server, cannot send receive messages like it can when I launch Client.Java directly.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34930710
score: 0
comment on: http://stackoverflow.com/a/22890042
has text: @WarrenDew this is about the nature of the language, not its implementation. The fact that you can't call static methods until the class object is available in the classloader is simply the workings of a JVM; not a characteristic of the Java language itself.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35043673
type: QuestionComment
comment on: http://stackoverflow.com/q/22952685
type: Comment
has text: Have you seen this: http://stackoverflow.com/questions/7122019/how-do-i-configure-openfire-to-use-custom-database-using-openfire-xml/7240897#7240897
score: 0

http://stackoverflow.com/comment/34958842
type: Comment
comment on: http://stackoverflow.com/a/22905950
type: AnswerComment
has text: I want to implement interface on sqlite helper class. how should i do that.i am editing my question and posting Asynresponse interface.
score: 0

http://stackoverflow.com/comment/34918108
score: 0
comment on: http://stackoverflow.com/q/22883297
type: Comment
type: QuestionComment
has text: Post your code here. Not on some 3rd party website.

http://stackoverflow.com/comment/34888056
has text: yes, sorry forgot about. obviously that wouldn't compile lol..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22866906
score: 0

http://stackoverflow.com/q/22892675
has answer: http://stackoverflow.com/a/22892853
type: Question
tagged with: javascript
tagged with: applet
has comment: http://stackoverflow.com/comment/34934852
has comment: http://stackoverflow.com/comment/34934780
has comment: http://stackoverflow.com/comment/34934924
has body: Ok. Here is my full code. My problem is that, when trying to use in my javascript/html code the string array "comentarios" I don't know how to "pass" the entire array. I've been working for a few months with applets but I never had to pass a array to "html like code". How can I solve this? Thanks import java.awt.*; import java.awt.event.*; import java.sql.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class ValoracionesDos extends HttpServlet implements SingleThreadModel{ public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ PrintWriter toClient = res.getWriter(); int numRows=3; String comentarios[] = new String[numRows]; comentarios[0]="hello"; comentarios[1]="me"; comentarios[2]="bye"; int i=0; toClient.println(" "); toClient.println(" "); toClient.println(" "); toClient.println(" "); toClient.println(" "); } } The problem is that the javascript array called "myrest" is filled always with the first element of "comentarios" (the java string array). How can i solve this. Thank you
has title: Print java array into HTML code
score: 0
has comment: http://stackoverflow.com/comment/34934727
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/22892853
answer count: 1
has comment: http://stackoverflow.com/comment/34934816
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/35103679
type: QuestionComment
has text: Thanks for your explanation. Sadly, the project I'm working on, uses the returned columnames as properties. But good to know, that the "problem" is in hsqldb. We'll start looking in an other direction for a solution. (lol, I had submitted the first comment by accident, wanted to change it, but was pulled away befor I could commit)
score: 0
comment on: http://stackoverflow.com/q/22962667
type: Comment

http://stackoverflow.com/q/22938100
tagged with: java
has answer: http://stackoverflow.com/a/26303528
type: Question
tagged with: broadcastreceiver
has answer: http://stackoverflow.com/a/23218496
has body: I want get the install referrer value in my MainActivity. For that i am using two class 1) MainActivity 2) ReferrerReceiver I got received install referrer value successfully in ReferrerReceiver class, i tested this using Toast control. But i can not able to pass this value to MainActivity from ReferrerReceiver. Bellow is i tried code. please any one help me. Thanks for advance. 1) MainActivity.java public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tv1 = (TextView) findViewById(R.id.tv1); Intent in1= getIntent(); String ldString = in1.getStringExtra("number"); tv1.setText(ldString); } } 2) ReferrerReceiver.java public class ReferrerReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (!intent.getAction().equals("com.android.vending.INSTALL_REFERRER")) { return; } Bundle bundle = intent.getExtras(); String phoneNumber = bundle.getString("referrer"); Intent i = new Intent(context, MainActivity.class); i.putExtra("number", phoneNumber); context.startActivity(i); } } AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <action android:name="com.android.vending.INSTALL_REFERRER" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/22938287
tagged with: android
favorite count: 0
tagged with: referrer
tagged with: installation
type: UnansweredQuestion
score: 3
has title: how do I get value from BroadcastReceiver activity to main activity
upvote count: 3

http://stackoverflow.com/q/22952618
has answer: http://stackoverflow.com/a/22952649
upvote count: 6
has comment: http://stackoverflow.com/comment/35043076
has answer: http://stackoverflow.com/a/22953466
answer count: 3
has comment: http://stackoverflow.com/comment/35043466
has comment: http://stackoverflow.com/comment/35043438
has title: Parse time with microseconds in Java
tagged with: java
accepted answer: http://stackoverflow.com/a/22953466
type: AnsweredQuestion
downvote count: 0
has body: I am having problems parsing time strings in Java that are in the format of 2013-01-09 09:15:03.000000. In my data, the last three digits are always 0 (meaning the input strings have only millisecond precision), so I passed this format to SimpleDateFormat: formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS'000'"); but formatter.parse("2013-01-09 09:15:02.500000"); throws an exception: Unparseable date: "2013-01-09 09:15:02.500000" at java.text.DateFormat.parse(DateFormat.java:357) Anyone knows how to do it correctly? I can work around by using format yyyy-MM-dd HH:mm:ss.SSS and using substring to get rid of last three digits but that's really hacky. EDIT: can anyone explain why the format string yyyy-MM-dd HH:mm:ss.SSS'000' can't be used to parse time "2013-01-09 09:15:02.500000"
score: 6
favorite count: 0
has answer: http://stackoverflow.com/a/48332094
type: Question
possible better answer: http://stackoverflow.com/a/22952649

http://stackoverflow.com/q/22916621
upvote count: 1
tagged with: dojo
tagged with: selenium-webdriver
tagged with: java
has body: I would like to use getText() for one XPath, need text what is there. //span(contains(@style,'display:none')) XPath is working tested in firebug, I've tried getText, getAttribute, so far no luck
tagged with: selenium
has title: How to getText() for XPath with attribute 'display:none'
tagged with: webdriver
has comment: http://stackoverflow.com/comment/34978303
has answer: http://stackoverflow.com/a/22916750
downvote count: 0
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/22916966
favorite count: 0
has answer: http://stackoverflow.com/a/22916966
accepted answer: http://stackoverflow.com/a/22916750
type: Question
linked to: http://stackoverflow.com/q/11430773
answer count: 2

http://stackoverflow.com/a/22848918
accepted answer of: http://stackoverflow.com/q/22825452
downvote count: 0
has comment: http://stackoverflow.com/comment/67633798
type: AcceptedAnswer
has body: This would probably be simplest with ant-contrib's &lt;if&gt; task: &lt;if&gt; &lt;not&gt; &lt;available file="x.props" /&gt; &lt;/not&gt; &lt;then&gt; &lt;copy file="x.props.template" tofile="x.props" /&gt; &lt;/then&gt; &lt;/if&gt; Edit: I just rediscovered this answer that I gave years ago after a comment was added, and realized that there's a much better solution that doesn't rely on ant-contrib. It's probably way too late to be of much use to the original poster, but I figured I'd offer it up anyway in case it helps someone: &lt;property file="x.props" /&gt; &lt;property name="prop1" value="something" /&gt; &lt;property name="prop1" value="somethingElse" /&gt; &lt;path id="project.class.path"&gt; &lt;pathelement location="${prop1}/important.jar"/&gt; &lt;pathelement location="${prop2}/anotherImportant.jar"/&gt; &lt;/path&gt; No need for an extra template file. Just attempt to load the property file first and set your defaults immediately after that, making use of Ant's inherent property immutability. Conversely, if you really want to use a separate properties file to hold your default values, just do the same thing as above but replace the individual property assignments with another property file load: &lt;property file="x.props" /&gt; &lt;property file="default.props" /&gt;
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/34863798
score: 2
answers question: http://stackoverflow.com/q/22825452

http://stackoverflow.com/a/22938939
has body: FacebookInterface fbInterface is definition not initialization, to initialize class you have to create instance of it. as you have interface, you might need to create class which implements FacebookInterface interface you can use anonymous class FacebookInterface fbInterface = new FacebookInterface(){ @Override public void FacebookShare(){ Gdx.app.log("AndroidGame","Hello Android"); } } that should fix your NullPointerException
has comment: http://stackoverflow.com/comment/35019726
score: 0
has comment: http://stackoverflow.com/comment/35019059
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35020388
has comment: http://stackoverflow.com/comment/35018800
has comment: http://stackoverflow.com/comment/35021293
type: Answer
accepted answer of: http://stackoverflow.com/q/22933715
answers question: http://stackoverflow.com/q/22933715

http://stackoverflow.com/q/22826254
score: 0
tagged with: java
tagged with: rgb
type: Question
has body: I can sucessfully read and write values to an image file which accurately shows an image created. I simply read the values using getRGB(), and then bit shift them into red, green and blue arrays respectively. Then I simply set them back into another BufferedImage object using the setRGB() method. Now, I am trying to alter the pixel values, say the very first pixel of the red array. I then print out the first 5 pixels of the red array and the first value is changed as expected before invoking the setRGB() method, but when I read in that image again the first value is now back to its original value? Does anybody know that using the setRGB() only changes the values in memory, but does not actually write that altered values? EDITS - THIS IS A SAMPLE REPRESENTATION OF MY CODE (this works perfectly due to getting back an image) //READ IN IMAGE BufferedImage imgBuf =null; imgBuf = ImageIO.read(new File("test.jpg")); int w = imgBuf.getWidth(); int h = imgBuf.getHeight(); int[] RGBarray = imgBuf.getRGB(0,0,w,h,null,0,w); //BIT SHIFT VALUES INTO ARRAY for(int row=0; row&lt;h; row++) { for(int col=0; col&lt;w; col++) { alphaPixels[row][col] = ((RGBarray[g]&gt;&gt;24)&amp;0xff); redPixels[row][col] = ((RGBarray[g]&gt;&gt;16)&amp;0xff); greenPixels[row][col] = ((RGBarray[g]&gt;&gt;8)&amp;0xff); bluePixels[row][col] = (RGBarray[g]&amp;0xff); g++; } } //BIT SHIFT VALUES BACK TO INTEGERS for(int row=0; row&lt;h; row++) { for(int col=0; col&lt;w; col++) { int rgb = (alphaPixels[row][col] &amp; 0xff) &lt;&lt; 24 | (redPixels[row][col] &amp; 0xff) &lt;&lt; 16 | (greenPixels[row][col] &amp; 0xff) &lt;&lt; 8 | (bluePixels[row][col] &amp; 0xff); imgBuf.setRGB(col, row, rgb); } } //WRITE IMAGE BACK OUT ImageIO.write(imgBuf, "jpeg", new File("new-test.jpg"));
tagged with: bufferedreader
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22826282
has title: Using setRGB() method in BufferedImage

http://stackoverflow.com/a/22912895
answers question: http://stackoverflow.com/q/22911464
has comment: http://stackoverflow.com/comment/35049943
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35050138
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34971310
has comment: http://stackoverflow.com/comment/35044953
has comment: http://stackoverflow.com/comment/35050197
has body: AMF - there is a built in (de)serializator and works like a charm. Efficient and fast. Check it out.
accepted answer of: http://stackoverflow.com/q/22911464
upvote count: 2

http://stackoverflow.com/q/22965482
score: 0
has comment: http://stackoverflow.com/comment/35095775
tagged with: android-listview
has comment: http://stackoverflow.com/comment/35093296
answer count: 1
has body: I have a class DrawView.java which draw a rectangle and I want to make a ListView of rectangle. I tried to draw the rectangle in getView() method of List adapter but I failed. Can anyone help me in this issue? My class which draw the rectangle is: public class DrawView extends View { Paint paint = new Paint(); public DrawView(Context context) { super(context); } @Override public void onDraw(Canvas canvas) { paint.setColor(Color.BLACK); paint.setStrokeWidth(3); canvas.drawRect(30, 30, 180, 180, paint); paint.setStrokeWidth(0); paint.setColor(Color.CYAN); canvas.drawRect(33, 60, 177, 177, paint ); paint.setColor(Color.YELLOW); canvas.drawRect(33, 33, 177, 60, paint ); } } and my getView() method of custom adapter is: public View getView(final int position, View convertView, final ViewGroup parent) { convertView = mInflater.inflate(R.layout.news_list_item,null); DrawView rl = (DrawView)convertView.findViewById(R.id.drawview); DrawView draw = new DrawView(c); rl=draw; return convertView; } My XML file is news_list_item: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_margin="60dp" android:id="@+id/mainLayout" &gt; &lt;com.example.horizontalscrollview.DrawView android:id="@+id/drawview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" &gt; &lt;/com.example.horizontalscrollview.DrawView&gt; &lt;/LinearLayout&gt;
has comment: http://stackoverflow.com/comment/35065615
has comment: http://stackoverflow.com/comment/35096412
has comment: http://stackoverflow.com/comment/35095381
has title: How to build custom ListView in which each row has rectangles and circles
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35093813
has comment: http://stackoverflow.com/comment/35096266
tagged with: android
linked to: http://stackoverflow.com/q/16333754
has comment: http://stackoverflow.com/comment/35095009
has comment: http://stackoverflow.com/comment/35094494
has comment: http://stackoverflow.com/comment/35093115
tagged with: java
has comment: http://stackoverflow.com/comment/35096960
has comment: http://stackoverflow.com/comment/35094890
has comment: http://stackoverflow.com/comment/35093543
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/35095875
tagged with: android-canvas
has answer: http://stackoverflow.com/a/22966005
has comment: http://stackoverflow.com/comment/35095340

http://stackoverflow.com/q/22898022
score: 1
tagged with: java
tagged with: character-encoding
type: Question
has comment: http://stackoverflow.com/comment/35100232
has body: I retrieved HTML string from an objective site and within it there is a section class="f9t" name="ÓÃ»§Ãû:ôâÈ»12" I know it's in GBK encoding, as I can see it from the FF browser display. But I do not know how to convert that name string into a readable GBK string (such as 上海 or 北京). I am using String sname = new String(name.getBytes(), "UTF-8"); byte[] gbkbytes = sname.getBytes("gb2312"); String gbkStr = new String( gbkbytes ); System.out.println(gbkStr); but it's not printed right in GBK text ???¡ì??:????12 I have no clue how to proceed.
has comment: http://stackoverflow.com/comment/35100304
answer count: 2
downvote count: 0
favorite count: 0
has title: How to convert UTF-8 to GBK string in java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30092265
upvote count: 1
has answer: http://stackoverflow.com/a/22899169

http://stackoverflow.com/a/45496527
answers question: http://stackoverflow.com/q/22860812
type: Answer
has body: I am facing a similar issue, I have two Maven projects in workspace. Main Project is using output JAR of a Helper project as an artifact. Now the problem is that Main project is trying to Reference JUnit library of Helper project (which has older version 4.10) instead of it's own JUnit library having version 4.12. Because of this in-correct referencing I get build errors in main project. Only work around which I found is to close the Helper project and have only Main project open in workspace. Possibly this is an Eclipse bug.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/34858648
comment on: http://stackoverflow.com/a/22850326
type: Comment
score: 1
has text: @christopher is saying the opposite of what you are: "I believe it is the Object Adapter Pattern that is not supported in Java, because Java does not support multiple inheritance. The Class Adapter Pattern works fine because it uses interfaces, which is Java's answer to multiple inheritance."
type: AnswerComment

http://stackoverflow.com/q/22929851
has body: I have found Sun's Java code conventions which were lastly revised in 1999. Is it out of date now?
upvote count: 8
type: Question
has title: Is "Code Conventions for the Java Programming Language" by Sun (1999) out of date?
has comment: http://stackoverflow.com/comment/35004565
has comment: http://stackoverflow.com/comment/62640306
has comment: http://stackoverflow.com/comment/35002693
has comment: http://stackoverflow.com/comment/35002498
has comment: http://stackoverflow.com/comment/35002473
has comment: http://stackoverflow.com/comment/35002433
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35003402
has answer: http://stackoverflow.com/a/22930462
accepted answer: http://stackoverflow.com/a/22930462
tagged with: coding-style
type: AnsweredQuestion
score: 7
tagged with: java

http://stackoverflow.com/comment/34887802
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22866925
has text: Well what would you do if they don't have a custom implementation anyway? You're not really supposed to do such a thing, it works around the purpose of polymorphism.
type: Comment

http://stackoverflow.com/comment/34959426
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22906146
score: 0
has text: Show us what have you tried so far and we can guide you on that.

native
tags question: http://stackoverflow.com/q/22813514
tag name: native
tags question: http://stackoverflow.com/q/22858932
tags question: http://stackoverflow.com/q/22859454
type: Tag
tags question: http://stackoverflow.com/q/22858488
tags question: http://stackoverflow.com/q/22870917
tags question: http://stackoverflow.com/q/22929038

http://stackoverflow.com/a/22894013
has body: To access some property directly, first, declare it as public: public int viewWidth = 0; second, just call it: gameview.viewWidth = ...
answers question: http://stackoverflow.com/q/22893518
score: 0
type: Answer

http://stackoverflow.com/comment/34984270
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22918985
has text: Thanks Luiggi..one more query please....So if we forgot about single user attempting with two tabs in browser at once..What about different users logged in at same time ? so in that case my scenerio will work fine without concurrentHashMap right ? i need concurrenthashmap just because a single user can try logging two or more times at once ...right ?
type: AnswerComment

http://stackoverflow.com/comment/35014469
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22935157
has text: Well i have moved my `nameValue` and `passValue` on the top of the async class and let the `URL` on doInBackground(); also i have modified the log into `Log.i("MyActivity",ex.toString());` and i get a denied internet permission but on my manifest file its everything ok !

http://stackoverflow.com/q/22849916
tagged with: mysql
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34857847
has answer: http://stackoverflow.com/a/22849939
has comment: http://stackoverflow.com/comment/34857858
has comment: http://stackoverflow.com/comment/34857801
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34857736
has body: I have a method that generates and returns an ArrayList. How can i print the ArrayList from other classes? public ArrayList&lt;Printer&gt; selectAllePrinters() { ArrayList&lt;Printer&gt; printers = new ArrayList&lt;&gt;(); try { Connection con = SimpleDataSource.getConnection(); PreparedStatement stat = con.prepareStatement("SELECT * FROM printer;"); ResultSet result = stat.executeQuery(); while (result.next()) { Printer printer = new Printer(); printer.setPrinterid(result.getString("printerid")); printer.setNaam(result.getString("printernaam")); printer.setAantalKl(result.getInt("aantalkleur")); printer.setAantalZw(result.getInt("aantalzwart")); } result.close(); stat.close(); return printers; } catch (SQLException e) { System.out.println(e); return null; } } Thanks in advance!
type: AnsweredQuestion
upvote count: 0
tagged with: println
favorite count: 0
accepted answer: http://stackoverflow.com/a/22849939
type: Question
has comment: http://stackoverflow.com/comment/34857758
score: -1
has title: How do i print a return ArrayList?
tagged with: java

http://stackoverflow.com/q/22899257
has comment: http://stackoverflow.com/comment/34946763
has title: Java How do I output the initial value of a method's variable before it enters the first recursion of the method?
type: Question
possible better answer: http://stackoverflow.com/a/22899306
score: 0
answer count: 2
has body: Any idea on how to print the initial variable used in the classic factorial recursion? Here's what I have. public class factorial{ public static void main(String[] args){ System.out.println("Output:" + initialN(factorial(4))); System.out.println("Answer:24"); } public static int factorial(int n){ if(n == 1){ return 1; } else{ return n*(n-1); } } public static int initialN(int n){ int init = n; System.out.println("N:" + init); return init; } } Right now my output looks like this: N:24 Output:24 Answer:24 But I'm trying to have it show only what n is initially before it enters the second iteration of the factorial method. So N should be showing as 4, not 24. Thanks in advance.
has comment: http://stackoverflow.com/comment/34948041
accepted answer: http://stackoverflow.com/a/22899588
has answer: http://stackoverflow.com/a/22899588
type: AnsweredQuestion
tagged with: recursion
has answer: http://stackoverflow.com/a/22899306
tagged with: java

http://stackoverflow.com/comment/34971576
has text: According to http://en.wikibooks.org/wiki/Norwegian/Numbers, Java 7 should be right. Perhaps a bug fix?
comment on: http://stackoverflow.com/q/22912888
score: 0
type: Comment
type: QuestionComment

azureservicebus
tags question: http://stackoverflow.com/q/22823156
tag name: azureservicebus
type: Tag

http://stackoverflow.com/a/22879255
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22878604
answers question: http://stackoverflow.com/q/22878604
type: Answer
has comment: http://stackoverflow.com/comment/34910702
has body: A couple of introductory remarks: cocI is an odd class name; it should start with a capital letter. The interface you are supposed to implement doesn't use generics effectively. You should be able to use a data type more specific than Object. It is good practice to use the @Override annotation. The solution involves an iterator for the outer collection and an iterator for the inner collection. When the inner iterator runs out of elements, it needs to be replaced with an iterator for the next collection. However, considering that a collection could be empty, the advancement needs to be done in a loop, which I've put in an advanceCollection() helper. import java.util.Collection; import java.util.Iterator; import java.util.NoSuchElementException; public class cocI&lt;T&gt; implements Iterator&lt;T&gt; { private Iterator&lt;Collection&lt;T&gt;&gt; outerIterator; private Iterator&lt;T&gt; innerIterator; public cocI(Collection&lt;Collection&lt;T&gt;&gt; collofColl) { this.outerIterator = collofColl.iterator(); advanceCollection(); } @Override public boolean hasNext() { return this.innerIterator != null &amp;&amp; this.innerIterator.hasNext(); } @Override public T next() { if (this.innerIterator == null) { throw new NoSuchElementException(); } try { return this.innerIterator.next(); } finally { advanceCollection(); } } @Override public void remove() { throw new UnsupportedOperationException(); } private void advanceCollection() { while ((this.innerIterator == null || !this.innerIterator.hasNext()) &amp;&amp; this.outerIterator.hasNext()) { this.innerIterator = this.outerIterator.next().iterator(); } } } There is one slightly tricky piece of code I used: try { return this.innerIterator.next(); } finally { advanceCollection(); } It is roughly equivalent to: T result = this.innerIterator.next(); advanceCollection(); return result;
score: 0

http://stackoverflow.com/a/58238892
score: 0
type: Answer
has body: Try this in Kotlin : val n = NumberFormat.getNumberInstance(Locale.US) n.maximumFractionDigits = 2 n.minimumFractionDigits = 2 And after format your number with : n.format(53508)
answers question: http://stackoverflow.com/q/22877397

http://stackoverflow.com/comment/34974239
has text: I have tried putting a log there, that is why I think it isn't being called.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22914536
score: 0

http://stackoverflow.com/comment/34907637
comment on: http://stackoverflow.com/q/22877473
type: QuestionComment
score: 0
has text: Where is the location of this jar file? Did you make sure your project set up is correct? Paths are all good?
type: Comment

http://stackoverflow.com/q/22843596
tagged with: jsp
has comment: http://stackoverflow.com/comment/34845786
has answer: http://stackoverflow.com/a/22859517
has comment: http://stackoverflow.com/comment/34845831
score: 0
type: UnansweredQuestion
has body: I'm trying to get a User entity from my database in a JSP where I iterate through Messages entity. Each Message contains its author's ID. Here's my servlet's code public class messageServlet extends HttpServlet { @EJB private MessageDAO messageDAO; @EJB private UserDAO userDAO; @Override protected void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException { Long clean_id = Long.valueOf(req.getParameter("id")); UserEntity user = (UserEntity) req.getSession().getAttribute("me"); if (user == null) { response.sendRedirect("login.jsp"); } else { if (clean_id != null) { List<MessageEntity> messages = messageDAO.findByTopic(clean_id); if (messages != null) { req.setAttribute("messages", messages); req.setAttribute("userDAO", new JpaUserDAO()); req.getRequestDispatcher("/message.jsp").forward(req, response); } } else { req.getRequestDispatcher("/message.jsp").forward(req, response); } } } And my message.jsp <%@page import="javax.naming.InitialContext"%> <%@page import="com.forum.entity.UserEntity"%> <%@page import="com.forum.dao.jpa.JpaUserDAO"%> <%@page import="com.forum.entity.MessageEntity"%> <%@page import="com.forum.dao.UserDAO"%> <%@page import="javax.ejb.EJB"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> Category page <%@ include file="navbar.jsp" %> Messages <c:choose> <c:when test="${not empty user}"> <c:forEach items="${messages}" var="message"> <c:out value="${message.getMessage_author_id()}"></c:out> <c:set var="user" value="${userDAO.find(message.getMessage_author_id())}"></c:set> <c:out value="${user.getUser_email()}"></c:out> <c:out value="${message.getMessage_author_id()}"/> <c:out value="${message.getMessage_created()}"/> <c:out value="${message.getMessage_content()}"/> <c:if test="${user_role == 'mod' || user_role == 'admin'}"> Edit Delete </c:if> </c:forEach> </c:when> <c:otherwise> <c:url value="/doLogin" var="loginUrl" /> ${message.getMe…
tagged with: jakarta-ee
has title: Access EJB in JSP gives null pointer
tagged with: java
tagged with: servlets
type: Question
answer count: 1

http://stackoverflow.com/comment/34946474
comment on: http://stackoverflow.com/q/22898845
type: Comment
type: QuestionComment
score: 1
has text: you should calculate total before printing it

http://stackoverflow.com/comment/34831005
has text: can be used only one `<context:property-placeholder />` per application? I have two `<context:property-placeholder />` - one in `Webapp` module and another in `Persistence` module.
score: 0
comment on: http://stackoverflow.com/q/22835321
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22836482
has comment: http://stackoverflow.com/comment/34833706
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34833187
has body: I have finalized my Java/Android project and now I need to comment the codes (mainly classes and important methods). I need to do it by following the best industrial standards as later if someone else need to modify, it should be well staright forward. I read many articles and found 3 main types of java commenting styles. Single line comment (//.....) Block comments (/* ....... */) Doc comments (/** ....... */) I read mainly about the option 2 and 3. Stack overflow discussions So I thought of going with 2nd option as I don't need to generate HTML docs as these classes are not going to use by any other people and this is the implementation of this app. Wonder what are the best practices in block commenting indicating "return" type, "parameters" and "breif description" of the method or class. Would like to hear the best industrial standard practices of the java code commenting. Thanks in advance...!!!
upvote count: 6
has title: Java code commenting best practices
tagged with: java
has answer: http://stackoverflow.com/a/22836568
has answer: http://stackoverflow.com/a/22836924
type: Question
has answer: http://stackoverflow.com/a/22836653
linked to: http://stackoverflow.com/q/3607641
downvote count: 0
tagged with: comments
score: 6
answer count: 3
favorite count: 0

http://stackoverflow.com/a/22846312
answers question: http://stackoverflow.com/q/22845283
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34851480
has comment: http://stackoverflow.com/comment/34852067
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34886110
has comment: http://stackoverflow.com/comment/34889165
has comment: http://stackoverflow.com/comment/34884297
has comment: http://stackoverflow.com/comment/34888460
has body: Just add another to that points to the queue you want camel to post to after it writes to oracle, like so: some.sql.Exception <to uri="some:error:handler:uri" /> <from uri="jms:queue:Q.Customer1"/> header1Value <to uri="oracleQueue:queue:Q.Customer2"/> <to uri="jms:queue:SomeOtherQueue"/>

http://stackoverflow.com/comment/34898571
score: 0
type: AnswerComment
has text: i tried the code and i got it to work, when i inputted the numbers 24,48,52 the program worked, BUT when i tried a number like 50 i get o = 23 and p =2, which is wrong i tried removing the "/2" from "o<n/2" however i still get o = 23 and p =2..........any thoughts?
type: Comment
comment on: http://stackoverflow.com/a/22846881

http://stackoverflow.com/a/22840397
has comment: http://stackoverflow.com/comment/50927436
downvote count: 0
has body: One way is to use a toMap collector: import static java.util.stream.Collectors.toMap; Map&lt;String, String&gt; byNameMap = people.entrySet().stream() .collect(toMap(Entry::getKey, e -&gt; e.getValue().getName()));
type: Answer
score: 29
upvote count: 29
has comment: http://stackoverflow.com/comment/34839879
answers question: http://stackoverflow.com/q/22840170
has comment: http://stackoverflow.com/comment/34839633
has comment: http://stackoverflow.com/comment/34840095
has comment: http://stackoverflow.com/comment/34853394
has comment: http://stackoverflow.com/comment/34853448

http://stackoverflow.com/comment/35009107
type: QuestionComment
comment on: http://stackoverflow.com/q/22933521
has text: sorry for my ignorance, but if each rest ws is served by a servlet or ejb, isn't going already be served by a pool of instances? I mean, the idea of having a pool isn't exactly to provide parallelism without exhausting resources?
score: 0
type: Comment

http://stackoverflow.com/a/22937111
type: Answer
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22936938
answers question: http://stackoverflow.com/q/22936938
has body: More generally, method declarations have six components, in order: Modifiers—such as public, private, etc. The return type—the data type of the value returned by the method, or void if the method does not return a value. The method name—the rules for field names apply to method names as well, but the convention is a little different. The parameter list in parenthesis—a comma-delimited list of input parameters, preceded by their data types, enclosed by parentheses, (). If there are no parameters, you must use empty parentheses. An exception list—to be discussed later. The method body, enclosed between braces—the method's code, including the declaration of local variables, goes here. Oracle Documentation
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/35095862
type: AnswerComment
has text: @Sumit Pal Singh: sleeping does not release the lock associated with a `synchronized` block. Only if your code calls `wait` on the same object you have synchronized on, the lock is released for the waiting time.
type: Comment
comment on: http://stackoverflow.com/a/22960657
score: 0

http://stackoverflow.com/q/22883951
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
tagged with: jtextarea
has answer: http://stackoverflow.com/a/22883986
downvote count: 0
has title: How to add an Document Listener to a JTextArea inside of a JScrollPane?
possible better answer: http://stackoverflow.com/a/22884026
tagged with: documentlistener
linked to: http://stackoverflow.com/q/9560600
favorite count: 0
has answer: http://stackoverflow.com/a/22884026
accepted answer: http://stackoverflow.com/a/22883986
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/59242502
type: AnsweredQuestion
has body: I'm trying to add an Document Listener to a JTextArea, so that when a user presses enter it will read in the last line / the characters since the new line. I tried the following code, but Eclipse doesn't like display.getDocument().addDocumentListener(new AL());. It says No enclosing instance of type ScrollingTextArea is accessible. Must qualify the allocation with an enclosing instance of type ScrollingTextArea (e.g. x.new A() where x is an instance of ScrollingTextArea). How can I add an Action Listener to a JTextArea? Code: package guis; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.ScrollPaneConstants; import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; public class ScrollingTextArea { public static void main ( String[] args ) { JPanel middlePanel = new JPanel (); middlePanel.setBorder(new TitledBorder(new EtchedBorder (), "Display Area" ) ); // create the middle panel components JTextArea display = new JTextArea(16,58 ); JScrollPane scroll = new JScrollPane(display); display.getDocument().addDocumentListener(new AL()); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); //Add Textarea in to middle panel middlePanel.add(scroll); JFrame frame = new JFrame(); frame.add( middlePanel ); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public class AL implements DocumentListener { @Override public void insertUpdate(DocumentEvent e) { // TODO Auto-generated method stub } @Override public void removeUpdate(DocumentEvent e) { // TODO Auto-generated method stub } @Override public void changedUpdate(DocumentEvent e) { // TODO Auto-generated method stub } } }
score: 1

http://stackoverflow.com/comment/34792544
type: QuestionComment
comment on: http://stackoverflow.com/q/22813539
type: Comment
score: 0
has text: @jervine10 Using Hibernate Filters is really a great idea.

http://stackoverflow.com/comment/34881695
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22863341
score: 0
has text: Suppose server has a way to notify? what are options for notifying?

http://stackoverflow.com/a/22891246
answers question: http://stackoverflow.com/q/22891221
type: Answer
has body: You are getting the ArrayIndexOutOfBoundsException: 0 because you are trying to access to the first element of the array args, but this doesn't have any elements. What can you do? You should pass command-line arguments to the program when you launch it. You can check if the length of args is greater than 0 before you access to its elements: if (args.length &gt; 0) // ...
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22891221
score: 0

http://stackoverflow.com/q/22915512
has comment: http://stackoverflow.com/comment/34976969
tagged with: java
tagged with: itemlistener
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22915610
accepted answer: http://stackoverflow.com/a/22915610
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/34976489
has body: I have the following code here: public class A extends Runnable { ArrayList&lt;String&gt; choosenFiles; run(){ /*graphic stuff such as JFrame,JLabel,JButtons*/ } private ButtonListener implements ActionListener { /*options*/ } public class cbListener implements ItemListener { @Override public void itemStateChanged(ItemEvent e) { Checkbox cb = (Checkbox)e.getItemSelectable(); String cbl = cb.getLabel(); if (e.getStateChange() == ItemEvent.SELECTED) { JOptionPane.showMessageDialog(null, "selected:\n" + cbl); choosenFiles.add(cbl); } else if (e.getStateChange() == ItemEvent.DESELECTED) { JOptionPane.showMessageDialog(null, "deselected:\n" + cbl); choosenFiles.remove(cbl); } } } The problem seems to be that CBListener can not reach choosenFile since an AWT-EventQueue-0 java.lang.NullPointerException comes up. Here is the stacktrace: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at FileDownloader.Client.User$cbListener.itemStateChanged(Unknown Source) at java.awt.Checkbox.processItemEvent(Checkbox.java:563) at java.awt.Checkbox.processEvent(Checkbox.java:530) at java.awt.Component.dispatchEventImpl(Component.java:4660) at java.awt.Component.dispatchEvent(Component.java:4488) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:674) at java.awt.EventQueue.access$400(EventQueue.java:81) at java.awt.EventQueue$2.run(EventQueue.java:633) at java.awt.EventQueue$2.run(EventQueue.java:631) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege (AccessControlContext.java:87) at java.security.AccessControlContext$1.doIntersectionPrivilege (AccessControlContext.java:98) at java.awt.EventQueue$3.run(EventQueue.java:647) at java.awt.EventQueue$3.run(EventQueue.java:645) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege (AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:644) at j…
has comment: http://stackoverflow.com/comment/34976809
has comment: http://stackoverflow.com/comment/34976528
has comment: http://stackoverflow.com/comment/34975762
type: AnsweredQuestion
tagged with: inner-classes
score: 1
has comment: http://stackoverflow.com/comment/34976739
upvote count: 1
type: Question
has title: How to modify a class variable through innerclass itemListener?

http://stackoverflow.com/comment/34801139
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22818480
has text: is there any way i can add one and make it work? my main method in project is `run()`
score: 0

http://stackoverflow.com/comment/34960085
comment on: http://stackoverflow.com/q/22906588
score: 1
has text: First, ensure that you use UTF-8 both in java (`input.getBytes("UTF-8")`) and in C# (`ASCIIEncoding.UTF8.GetBytes(wert)` looks suspicious, shouldn't it be `Encoding.UTF8.GetBytes()` to compile at all?).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34992311
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22923855
has text: You should use a `break` rather than instantiating another variable to check whether to break the loop or not.
type: AnswerComment

http://stackoverflow.com/comment/35049640
type: AnswerComment
type: Comment
has text: @yogesh9239 You are welcome! You can mark an answer as accepted if it helped and satisfied you.
comment on: http://stackoverflow.com/a/22955657
score: 0

http://stackoverflow.com/q/22910580
tagged with: rest
answer count: 1
tagged with: jax-rs
has answer: http://stackoverflow.com/a/22916201
score: 0
has title: NoSuchMethodError Exception for setEntity in ContainerResponseFilter
tagged with: nosuchmethoderror
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35052348
tagged with: cxf
tagged with: java
has comment: http://stackoverflow.com/comment/35035031
type: Question
accepted answer: http://stackoverflow.com/a/22916201
has body: I am implementing a JAX-RS filter with CXF and I am trying to edit the Entity of the response. My filter's code is shown below public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { String s = (String) responseContext.getEntity(); responseContext.setEntity(s + "an additional message"); } The problem is that I am getting an NoSuchMethodError when I am running it. Here is my Exception stack javax.ws.rs.InternalServerErrorException: java.lang.NoSuchMethodError: javax.ws.rs.container.ContainerResponseContext.setEntity(Ljava/lang/Object;)V at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleWriteException(JAXRSOutInterceptor.java:385) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:224) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:154) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:85) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271) at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:158) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:243) at org.apache.cxf.transport.servl…
has comment: http://stackoverflow.com/comment/34971925
linked to: http://stackoverflow.com/q/35186

http://stackoverflow.com/comment/34812799
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22824969
has text: The program needs to be non-terminating.
score: 0

http://stackoverflow.com/a/22946335
accepted answer of: http://stackoverflow.com/q/22946215
answers question: http://stackoverflow.com/q/22946215
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35032324
score: 1
upvote count: 1
has body: For a single statement it will remain same, but if you want to group more than one statement in the if block then you have to use curely braces. if("pie"== "pie"){ System.out.println("Hurrah!"); System.out.println("Hurrah!2"); } if("pie"== "pie") System.out.println("Hurrah!"); //without braces only this statement will fall under if System.out.println("Hurrah!2"); //not this one You should see:Blocks A block is a group of zero or more statements between balanced braces and can be used anywhere a single statement is allowed. The following example, BlockDemo, illustrates the use of blocks: class BlockDemo { public static void main(String[] args) { boolean condition = true; if (condition) { // begin block 1 System.out.println("Condition is true."); } // end block one else { // begin block 2 System.out.println("Condition is false."); } // end block 2 } }
type: AcceptedAnswer

http://stackoverflow.com/a/23560321
score: 1
upvote count: 1
downvote count: 0
has body: Method security annotations support Spring EL expressions. In case of your wrapper class, you can use it as follows. @PreAuthorize("hasPermission(#projectWrapper.project, 'write'") public Project updateProject(ProjectWrapper projectWrapper) { // body omitted } And if you have just an object identifier instead of the actual object, you can use pattern below. @PreAuthorize("hasPermission(#id, 'my.package.Project' 'delete'") public void deleteProject(Long id) { // body omitted } You may need to adjust default configuration (e.g. strategy to retrieve object identity and the like) to meet you requirements. See org.springframework.security.acls.AclPermissionEvaluator class for more details.
type: Answer
answers question: http://stackoverflow.com/q/22953397

http://stackoverflow.com/comment/34819032
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22828490
has text: The layout manager is matter of opinion

http://stackoverflow.com/q/22908201
has title: Exception in Native part of openejb
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14708516
tagged with: java
tagged with: openjpa
has comment: http://stackoverflow.com/comment/35026870
has comment: http://stackoverflow.com/comment/34995369
has comment: http://stackoverflow.com/comment/34999546
type: Question
has body: I start a new topic for my problem, as I mentioned some wrong things in an older one. I'm using openejb for writing integration tests for my beans using jpa. Currently I've an Exception in some native calls done by jpa: INFO - Creating subclass and redefining methods for "[class ContextKey, class ContextEntity]". This means that your application will be less efficient than it would if you ran the OpenJPA enhancer. SEVERE - EjbTransactionUtil.handleSystemException: null <openjpa-2.3.0-nonfinal-1540826-r422266:1542644 fatal general error> org.apache.openjpa.persistence.PersistenceException: null at org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(ClassRedefiner.java:96) at org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:176) at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:312) at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:236) at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212) at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59) at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:159) at org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:115) at org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:91) at org.apache.openejb.persistence.JtaEntityManager.persist(JtaEntityManager.java:137) at com.six.ao.atm.database.context.AtmContextBean.persistWithCommit(AtmContextBean.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at su…
has comment: http://stackoverflow.com/comment/34972622
has answer: http://stackoverflow.com/a/26510014
linked to: http://stackoverflow.com/q/8958267
score: 0
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/34988999
tagged with: openejb

http://stackoverflow.com/comment/34807683
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22821711
has text: @Adrian Adamczyk , i would go with Joop Eggen Approach. Since it is just two variables and single Thread game. All you need is static utility methods to get the vector ( x,y) and get x and y as his example and perform the activity

timer
tag name: timer
tags question: http://stackoverflow.com/q/22910104
tags question: http://stackoverflow.com/q/22927429
tags question: http://stackoverflow.com/q/22869081
tags question: http://stackoverflow.com/q/22847844
tags question: http://stackoverflow.com/q/22920663
tags question: http://stackoverflow.com/q/22880742
tags question: http://stackoverflow.com/q/22887254
tags question: http://stackoverflow.com/q/22881308
tags question: http://stackoverflow.com/q/22911611
type: Tag
tags question: http://stackoverflow.com/q/22824582
tags question: http://stackoverflow.com/q/22811985
tags question: http://stackoverflow.com/q/22811277
tags question: http://stackoverflow.com/q/22831511
tags question: http://stackoverflow.com/q/22846580
tags question: http://stackoverflow.com/q/22841949
tags question: http://stackoverflow.com/q/22911569
tags question: http://stackoverflow.com/q/22906131
tags question: http://stackoverflow.com/q/22838321
tags question: http://stackoverflow.com/q/22824817
tags question: http://stackoverflow.com/q/22822786
tags question: http://stackoverflow.com/q/22902290
tags question: http://stackoverflow.com/q/22852591
tags question: http://stackoverflow.com/q/22844032
tags question: http://stackoverflow.com/q/22849474
tags question: http://stackoverflow.com/q/22885891
tags question: http://stackoverflow.com/q/22815972
tags question: http://stackoverflow.com/q/22819680

http://stackoverflow.com/q/22964528
accepted answer: http://stackoverflow.com/a/23040664
downvote count: 1
has body: I'm having trouble running the jar command in cygwin. The input-files parameter isn't treating the directory I'm passing it recursively when I'm referencing it with ".."s in my path. For example, I'm running this in the same directory as the "src" directory. src/ contains my package structure of class and java files. This runs properly and creates a jar containing my source and class files. jar cf jarname.jar src However when I run this next command, I get an empty jar except for a manifest file. jar cf jarname.jar localdir/../src I need to run this from a script that needs to find this directory with a ".." directory so I need the 2nd command to work. Anybody know why this isn't working or have a workaround? I tried using realpath but it complains that it can't find that path at all. I may be using it wrong though.
type: AnsweredQuestion
has title: jar not reading input file directory recursively
tagged with: java
type: Question
upvote count: 0
answer count: 1
tagged with: jar
tagged with: cygwin
has answer: http://stackoverflow.com/a/23040664
score: -1
favorite count: 0

http://stackoverflow.com/comment/34941601
type: AnswerComment
has text: And yes, its for a hackerearth problem :) trying to work out how to make it faster now
type: Comment
comment on: http://stackoverflow.com/a/22896227
score: 0

http://stackoverflow.com/a/22926587
score: 1
has comment: http://stackoverflow.com/comment/35044027
upvote count: 1
has body: Use OR instead of AND Change: String temp = " SELECT * " + " FROM booklist " + " WHERE Title = " + title + " AND Author = \"" + author + "\"" + " AND ISBN = \"" + isbn + "\""; To: String temp = " SELECT * FROM booklist " + " WHERE Title = ? OR Author = ?" + " OR ISBN = ?"; And then set the parameters for prepared statement. pst.setString( 1, title ); pst.setString( 2, author ); pst.setString( 3, isbn ); With the OR if any of the matching records are found then they are fetched. And, if you still want to use AND for comparison and want to not include empty inputs then you have to dynamically prepare the statement in JAVA. StringBuilder sql = new StringBuilder( 1024 ); sql.append( " SELECT * FROM booklist " ); String whereCondition = ""; if( title != null &amp;&amp; title.trim().length() &gt; 0 ) { whereCondition += " title = ?"; } if( isbn != null &amp;&amp; isbn.trim().length() &gt; 0 ) { whereCondition += (whereCondition.length() &gt; 0 ? " AND " : "" ); whereCondition += " isbn = ?"; } if( author != null &amp;&amp; author.trim().length() &gt; 0 ) { whereCondition += (whereCondition.length() &gt; 0 ? " AND " : "" ); whereCondition += " author = ?"; } sql.append( " where " ).append( whereCondition ); pst = con.prepareStatement( sql.toString() ); Now set the prepared parameters like this: And then set the parameters for prepared statement. int paramIndex = 1; if( title != null &amp;&amp; title.trim().length() &gt; 0 ) { pst.setString( paramIndex++, title ); } if( isbn != null &amp;&amp; isbn.trim().length() &gt; 0 ) { pst.setString( paramIndex++, isbn ); } if( author != null &amp;&amp; author.trim().length() &gt; 0 ) { pst.setString( paramIndex++, author ); } Now, you can execute the statement and fetch the resultset.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22925908
downvote count: 0
has comment: http://stackoverflow.com/comment/35037749
accepted answer of: http://stackoverflow.com/q/22925908

http://stackoverflow.com/comment/35032584
comment on: http://stackoverflow.com/q/22946711
score: 0
type: Comment
type: QuestionComment
has text: is it JRE or JDK1.7 installed? if its JRE may be it requires JDK, try installing JDK.

http://stackoverflow.com/comment/34880243
comment on: http://stackoverflow.com/q/22857411
score: 0
type: Comment
type: QuestionComment
has text: Kind of a long shot, but you could add `logLevel := Level.Debug` to `project/plugins.sbt`, and compare the messages (after doing `clean`) between the Mac and Windows version. If all else fails, work in a VM!

http://stackoverflow.com/a/25164109
type: Answer
has body: You can mapping the CREATED column length on the MYTABLE.groovy domain: static mapping = { CREATED column: "CREATED", sqlType: "VARBINARY", length:273 }
score: 0
answers question: http://stackoverflow.com/q/22862183

http://stackoverflow.com/a/22898844
type: Answer
has body: What your problem? If you cannot call tf1.getText() from second class because tf1 is private in first class -> make it public or add public static variable to hold the file name that can refer from second class.
accepted answer of: http://stackoverflow.com/q/22898690
answers question: http://stackoverflow.com/q/22898690
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/22920212
has body: I have been sitting whole day with this problem: I have a String array.After parsing String line str3.split("\\n")); Then I want to make it display with Next/Previous buttons. String text = null; if (rotation){ if (count &lt; fullString.length) { for (int i = count; i &lt;= fullString.length - 1; i++) { text = fullString[i]; ++count; if (text.trim().length() &gt; 0 &amp; !text.isEmpty()){ return text; } } } } if (!rotation) { if (count &gt; 0) { for (int i = count ; i &gt;= 0; i--) { text = fullString[i - 1]; --count; if (text.trim().length() &gt; 0 &amp; !text.isEmpty()){ return text; } } } } It woks, but need to press button twise (If press "Next" after that I should press "Previous" twise). I know, this is the silly question, but I can't find out the problem.
has comment: http://stackoverflow.com/comment/35151234
type: Question
has comment: http://stackoverflow.com/comment/34984949
has title: Array size counting – Android, Java
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23013103
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34984864
has comment: http://stackoverflow.com/comment/35143470
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34984683
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23013103
has comment: http://stackoverflow.com/comment/34984837
has comment: http://stackoverflow.com/comment/35147590
has comment: http://stackoverflow.com/comment/35143295
score: 1
tagged with: java
tagged with: cycle
upvote count: 1

http://stackoverflow.com/q/22911742
score: 0
has title: How can get the actual file from the zipped file?
tagged with: jax-rs
linked to: http://stackoverflow.com/q/5070924
has comment: http://stackoverflow.com/comment/34968630
answer count: 0
type: UnansweredQuestion
has body: I am returning a Zipped file say My_File.txt.zip from the My server side using JAX-RS (Jersey). My server-side is Java. So I am getting the My_File.txt.zip in the client side while downloading. But I want the actual file My_File.txt while downloading in the browser. Is it possible? I am working with Glassfish 3.x. So I there any configuration on Glassfish to do this? Or can i change the configuration in Firefox (or other browsers) to do this? Please suggest me the correct answer. Thanks in advance.
has comment: http://stackoverflow.com/comment/34969102
tagged with: glassfish-3
tagged with: java
type: Question
tagged with: jersey
tagged with: firefox
has comment: http://stackoverflow.com/comment/34968833

http://stackoverflow.com/comment/34997079
type: Comment
comment on: http://stackoverflow.com/a/22907650
type: AnswerComment
has text: Works perfectly apparently when the edit text can't be converted to float the app crashes unless it's a try. Thanks
score: 0

http://stackoverflow.com/a/22913915
type: Answer
has body: An inherently thread safe function, is safe without having to take any specific design decisions regarding threading, it is thread safe simply by virtue of the task it performs as opposed to being redesigned to force thread safety. Say I write the very simple function: int cube(int x) { return x*x*x; } It is inherently thread safe, as it has no way of reading from or writing to shared memory. However I could also make a function which is not thread safe but make it thread safe through specific design and synchronization. Say I have this similar function to before: void cubeshare() { static int x; x = x * x * x; printf("%l", x); } This is not thread safe, it is entirely possible it could have the value of x change between each use (well this is actually unlikely in reality as x would get cached but lets say we are not doing any optimization). We however could make this thread safe like this (this is pseudo code, a real mutex is more complicated): void cubesharesafe(mutex foo) { static int x; lockmutex(foo); x = x * x * x; printf("%l", x); unlockmutex(foo); } This is however not inherently thread safe, we are forcing it to be through redesign. Real examples will often be far more complicated than this but I hope that this gives an idea taken to the most simple possible level. If you have any questions please comment bellow.
upvote count: 9
has comment: http://stackoverflow.com/comment/34992262
score: 9
downvote count: 0
has comment: http://stackoverflow.com/comment/34986261
answers question: http://stackoverflow.com/q/22908520
has comment: http://stackoverflow.com/comment/34984952

http://stackoverflow.com/comment/35028142
comment on: http://stackoverflow.com/q/22944020
has text: I have assignment to optimise that method so that he haven't have so many lines with same contents.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22920498
has comment: http://stackoverflow.com/comment/34985650
has answer: http://stackoverflow.com/a/22920699
has body: I am trying to optimize my code when downloading around 129 reports from a server. All of the reports have different URLs and here is the code I have developed: public static void getReport(String eqID, String reportCode, String reportName, String fileName) throws IOException{ String url = "http://example.com/api?function=getData&amp;eqId=" + eqID; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); Authenticator.setDefault (new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication ("username", "password".toCharArray()); } }); // optional default is GET con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); if(responseCode == 200){ System.out.println("Downloading: " + reportName); File file = new File("C:/Users/fileName); BufferedInputStream bis = new BufferedInputStream(con.getInputStream()); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file.getPath())); int i = 0; while ((i = bis.read()) != -1) { bos.write(i); } bos.flush(); bis.close(); bos.close(); } else if(responseCode == 204){ System.out.println("\nSending 'GET' request to: " + reportName); System.out.println("Response: Successful but report is empty. It will be skipped"); } } The issue is that it's taking too much time to process these downloads. Between all 129 reports its around 25MB and I have a High-Speed Internet Connection. I'm fairly new to downloading files through java and need some help. I call this method 129 times in total. If you can recommend ways to optimize it or just use on HTTP Connection instead of opening 129 individually. Thanks in advance!
has answer: http://stackoverflow.com/a/22920567
has title: Optimize File Download
has comment: http://stackoverflow.com/comment/34985483
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34985584
tagged with: java
tagged with: http
type: Question
accepted answer: http://stackoverflow.com/a/22920567
has comment: http://stackoverflow.com/comment/34985630
has comment: http://stackoverflow.com/comment/34985914
tagged with: get
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34985791
possible better answer: http://stackoverflow.com/a/22920699

http://stackoverflow.com/q/22955574
has body: I am trying to define MEDIUMTEXT datatype declaration, here i am using apache embedded derby dabase. When I try to execute SQL query it is giving exception need some help in tackling this problem. My code: statement s= s.execute("create table t(data MEDIUMTEXT)");
score: 1
tagged with: java
tagged with: derby
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22983807
favorite count: 0
has answer: http://stackoverflow.com/a/27391235
has title: How to define mediumtext datatype using Apache embedded derby database
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22957156
type: Question

http://stackoverflow.com/comment/34949556
score: 3
has text: To with, don't use null layouts, there more work and trouble then they are worth. A simple solution would be to use a JLabel, set its icon property to the background image you want to use, set its layout manager appropriately, and add the rest if your components to it. Search SO for "Swing frame background", there are plenty of examples...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22900685

http://stackoverflow.com/comment/34810253
comment on: http://stackoverflow.com/a/22821755
has text: and also please see update in my answer, I tried to summarize. Hope that helps
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34812370
type: QuestionComment
comment on: http://stackoverflow.com/q/22824675
score: 0
has text: Please include the code that sends the stream to the server. Do you have the correct URL? Do your server logs indicate that a connection was attempted? Are there any errors in the server logs?
type: Comment

http://stackoverflow.com/q/22882307
has title: Updating ResultSet using another java Class
score: 0
tagged with: sql
answer count: 1
type: UnansweredQuestion
tagged with: jdbc
has answer: http://stackoverflow.com/a/22882469
tagged with: mysql
type: Question
has body: I am still learning ResultSet and I was trying to update a ResultSet using another class, but then I was prompted an error. The error is "This result set must come from a statement that was created with a result set type of ResultSet.CONCUR_UPDATABLE, the query must select only one table, can not use functions and must select all primary keys from that table.". My statement is working, and it is in ResultSet.CONCUR_UPDATABLE mode. Here's my sample code: Statement Class: public abstract class Statements extends mysqlConnect { static Statement stmt; static ResultSet patient_details; String sql=null; public void getProfileDetails(String name) throws SQLException{ stmt = con.createStatement(CONCUR_UPDATABLE, TYPE_SCROLL_SENSITIVE); sql="select patient_id, last_name, first_name, middle_name, age, birthdate, gender, height, weight, blood_type, office_location, added_by, picture from patient_table where concat(last_name, \", \", first_name, \" \", middle_name ) like '"+name+"%';"; patient_details = stmt.executeQuery(sql); }//getProfileDetails Controller class: public class Controller extends Statements{ void setLastName(String ln) throws SQLException{ patient_details.absolute(patient_details.getRow()); patient_details.updateString("last_name", ln); patient_details.updateRow(); }//setLastName }//controller
tagged with: java

http://stackoverflow.com/a/22919632
accepted answer of: http://stackoverflow.com/q/22919443
score: 3
answers question: http://stackoverflow.com/q/22919443
has comment: http://stackoverflow.com/comment/34983499
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34983690
type: Answer
downvote count: 0
has body: Include webflow namespace as shown below: &lt;beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:webflow="http://www.springframework.org/schema/webflow-config" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd"&gt;

http://stackoverflow.com/comment/34813668
type: Comment
has text: Thats the quickest solution i have ever gotten from this site; hehe Thanks for the help Tomasz. Problem Solved.
comment on: http://stackoverflow.com/a/22825476
type: AnswerComment
score: 0

http://stackoverflow.com/q/22902111
has answer: http://stackoverflow.com/a/22902195
has answer: http://stackoverflow.com/a/22902132
has answer: http://stackoverflow.com/a/22902190
possible better answer: http://stackoverflow.com/a/22902174
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34952283
has title: How can I find the maximum value within a string?
tagged with: java
type: Question
score: 0
tagged with: max
tagged with: string
has body: For example, if a user were to input "ABZ748FJ9K" as a string, how would I pinpoint the max value of that string (in this case it is 9), and then output it back to the user. Any non-numeric character is supposed to be ignored. I tried doing some if-else ladder, but that would require me to list out every number, and it wasn't behaving the way I wanted it to anyways. I know there must be a better solution. Some help would be greatly appreciated. Thanks! import java.util.Scanner; public class Question{ public static void main(String args[]){ Scanner input = new Scanner(System.in); System.out.println("Please enter a string"); String userInput = input.next(); int finalMax = max(userInput); System.out.println("The maximum value is " + finalMax); } public static int max(String s){ int x = s.length(); int y = 0; for (int i=0; i &lt; x; i++){ if (s.charAt(i) == 9){ y=9; } else if (s.charAt(i) == 8){ y=8; } } return y; } } }
accepted answer: http://stackoverflow.com/a/22902132
answer count: 4
has answer: http://stackoverflow.com/a/22902174

http://stackoverflow.com/a/22858878
type: Answer
answers question: http://stackoverflow.com/q/22858755
has body: Just replace your this line SimpleDateFormat sdf = new SimpleDateFormat("EEEE MMMM dd, yyyy"); with SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); and also this line, sdf = new SimpleDateFormat("EEEE MMMM dd, yyyy"); with sdf = new SimpleDateFormat("yyyy-MM-dd");
score: 0

http://stackoverflow.com/q/22869099
tagged with: spring-test-dbunit
has answer: http://stackoverflow.com/a/22879921
tagged with: dbunit
type: AnsweredQuestion
tagged with: java
tagged with: mysql
tagged with: jdbctemplate
type: Question
accepted answer: http://stackoverflow.com/a/22879921
has body: I'm trying to write an integration test with dbUnit for a table in MySQL that has a column with autoincrement. The integration test looks like: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes={ JdbcRepositoryConfiguration.class, DbUnitConnectionConfiguration.class }) @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, DbUnitTestExecutionListener.class }) @DirtiesContext(classMode=ClassMode.AFTER_CLASS) @DbUnitConfiguration(databaseConnection="dbUnitConnection") public class IntegrationTest { @Autowired private JdbcRepositoryConfiguration configuration; private Loader loader; @Before public void setup() throws JSchException { loader = new Loader(configuration.jdbcTemplate()); } @Test @DatabaseSetup("classpath:dataset.xml") public void loads() throws Exception { assertThat(loader.load(), contains("something")); } } I have the same integration test structure for a table that has no increment column and the test works just fine. The dataset.xml looks like: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;dataset&gt; &lt;sometable id="1" regexp="something" descr="descr" /&gt; &lt;/dataset&gt; Debugging I can see that the actions taken to setup the data are to delete all and to perform an insert, more specifically: insert into sometable (id, regexp, descr) values (?, ?, ?) The error I get is: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'regexp, descr) values (1, 'something', 'descr')' at line 1 For completeness, the DbUnitConfiguration.class has the following spring bean setup: @Bean public IDatabaseConnection dbUnitConnection() throws SQLException, DatabaseUnitException, JSchException { Connection dbConn = configuration.jdbcTemplate().getDataSource().getConnection(); IDatabaseConnection connection = new DatabaseConnection(dbConn) { @Overri…
score: 0
has title: DBunit dataset: column regexp is a reserved word in MySQL
answer count: 1

http://stackoverflow.com/comment/35020015
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22939721
score: 1
has text: Please post the XML/XHTML you're targeting, or a snippet from it so we can make a better suggestion

http://stackoverflow.com/comment/34818536
has text: I believe you misunderstood my question. 1 abstract class having approx 10-15 common methods which are common to each one of 50 classes. Then 50 base classes in different application extending that base class each having approx 10 different method. That is why I planned it like abstract class implementation
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22821755

try-catch-finally
tags question: http://stackoverflow.com/q/22876390
type: Tag
tag name: try-catch-finally

http://stackoverflow.com/q/22876460
has answer: http://stackoverflow.com/a/22876540
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34906351
score: 1
tagged with: sample
has answer: http://stackoverflow.com/a/22876484
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22876484
accepted answer: http://stackoverflow.com/a/22876540
tagged with: database
has title: Easiest Way to Use Database in Sample Java Project?
has body: I'll preface this with: I have very little database experience. I understand the concept of a database and how to use a database within Java, but I have no idea how to create one and my knowledge of SQL is essentially zilch. I am creating a sample project to show off the features of IntelliJ to my company, in the hopes they will convert from Eclipse. One of the big features for our company will be database integration, so I would like to show off the Database tools. To do this, I need a database in the project. It doesn't need to be big or fancy or proper... it just needs to be there. It will never scale up. It will never be more than 10 rows and 4 or 5 columns. Here's my requirements though: It needs to be easy to start the instance via Maven It can't be Derby (no Derby drivers in our Maven repo) It must work with Hibernate and Spring Everything must run through Maven - no IDE specific stuff The database content needs to be persistent so I can push it to the project repository (as in, not an in-memory DB that is deleted as soon as the connection closes) How can I create this? How do I create the file with the DB content? How do I start the instance via Maven? If it is something like HSQLite and the DB content is stored in a *.sql file, how do I do I automate starting an instance and running the file with a single maven command? The key here is easy. I want a dummy (like me) with no idea how to do this to be able to run this project and try it for him or herself. Thanks for any help that's out there! David
has comment: http://stackoverflow.com/comment/122299802
has comment: http://stackoverflow.com/comment/34906417
has answer: http://stackoverflow.com/a/22878169
answer count: 3
linked to: http://stackoverflow.com/q/17587753
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34930611
has comment: http://stackoverflow.com/comment/34934092
tagged with: maven

http://stackoverflow.com/comment/35013404
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22909433
has text: Here, I am directly running the plug-in jar by double clicking on it. When I do so, a cmd pops up and vanishes with message as: `Error: Incorrect commandline argument` Where am I wrong? Is plug-in not executable outside the project?
score: 0

graphene2
tags question: http://stackoverflow.com/q/22966804
tag name: graphene2
type: Tag

http://stackoverflow.com/comment/34857970
type: AnswerComment
score: 0
type: Comment
has text: I have no idea what you mean. I can tell you is that tables are _supposed_ to work with models. If you _really_ want to show how a table works, then you _should_ be showing something about the table model.
comment on: http://stackoverflow.com/a/22849862

http://stackoverflow.com/comment/35048841
type: QuestionComment
comment on: http://stackoverflow.com/q/22955495
has text: You might need your own `JsonDeserializer`. Alternatively, look into mixins.
score: 0
type: Comment

http://stackoverflow.com/q/22955879
has answer: http://stackoverflow.com/a/22968680
favorite count: 0
has title: How to perform the Eclipse->Refactor->Rename function programmatically for Java source code?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35050833
score: 1
tagged with: refactoring
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22957154
type: Question
has body: I have thousands of java files in my Eclipse project. I need to rename these files all. I know I can rename a class interactively in Eclipse, but there're too many classes, how to achieve this programmatically?
tagged with: eclipse
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/34823500
comment on: http://stackoverflow.com/q/22830876
score: 0
type: QuestionComment
type: Comment
has text: try: `Runtime.getRuntime().exec("java -jar "+MYAPP.getName());`

http://stackoverflow.com/comment/34893476
comment on: http://stackoverflow.com/a/22853345
score: 0
type: AnswerComment
type: Comment
has text: I do try -- I think in this case it was more a problem of not having a clear idea of what I was doing or how to find elements by certain references. Using your code and fiddling with Firefox I've worked out how to find the names I need to select them with code (e.g. "a.js-..."), so I'm almost finished with the image/score fetcher :)

http://stackoverflow.com/comment/35039385
type: Comment
has text: Please note that SimpMessagingTemplate is not my class is part of the spring Framework. The documentation does not give more information about how to get an instance of that class. If I try to add the bean in my XML like <bean id="simpMessagingTemplate" class="org.springframework.messaging.simp.SimpMessagingTemplate"/> is expecting a parameter in the constructor (MessageChannel interface) which I am not sure how to link to the current websocket configuration.
score: 5
type: AnswerComment
comment on: http://stackoverflow.com/a/22929132

http://stackoverflow.com/q/22833328
accepted answer: http://stackoverflow.com/a/22833696
type: AnsweredQuestion
tagged with: java
tagged with: swing
downvote count: 1
type: Question
score: 3
linked to: http://stackoverflow.com/q/10523343
has title: Access GUI components from another class
upvote count: 4
has comment: http://stackoverflow.com/comment/34827805
has answer: http://stackoverflow.com/a/22833721
tagged with: user-interface
has body: I'm new to Java and I've hit a brick wall. I want to access GUI components (that have been created in one class) from another class. I am creating a new GUI class from one class, like so; GUI gui = new GUI(); and I can access the components in that class, but when I go to a different class I cant. I really just need to access the JTextAreas to update their content. Could someone point me in the right direction please, any help is greatly appreciated. GUI Class: public class GUI { JFrame frame = new JFrame("Server"); ... JTextArea textAreaClients = new JTextArea(20, 1); JTextArea textAreaEvents = new JTextArea(8, 1); public GUI() { frame.setLayout(new FlowLayout(FlowLayout.LEADING, 5, 3)); ... frame.setVisible(true); } }
has answer: http://stackoverflow.com/a/61976978
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/22833696
possible better answer: http://stackoverflow.com/a/22833509
has answer: http://stackoverflow.com/a/41369622
has answer: http://stackoverflow.com/a/22833509

http://stackoverflow.com/comment/35052145
has text: This didnt work either. friends.js is inserted as a tile in the body.jsp.
type: Comment
comment on: http://stackoverflow.com/a/22945298
score: 0
type: AnswerComment

http://stackoverflow.com/q/22811985
type: Question
accepted answer: http://stackoverflow.com/a/22812386
tagged with: java
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34788727
tagged with: timer
has answer: http://stackoverflow.com/a/22812386
has title: Creating a countdown but displaying (x-1):00 bug
has body: I've created a timer, which allows to input a seconds and minutes, then begins the countdown, when for example as user inputs 2:01 it becomes 1:00 (instead of 2:00) then 1:59, effectively displaying (x-1):00 of the timer. I know the code doesn't seem very nice to look at and has a bunch of if statements to display a leading zero because integer doesn't like having it.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34789491
has comment: http://stackoverflow.com/comment/34789101

http://stackoverflow.com/comment/34960969
score: 0
type: Comment
has text: I resolved the loader problems but I still am back to the original problem. It doesn't start when I click run. I need to type (ns Physics.core) and then (-main). I'll gladly accept this answer when that issue is resolved.
type: AnswerComment
comment on: http://stackoverflow.com/a/22906389

http://stackoverflow.com/q/22923739
has comment: http://stackoverflow.com/comment/34991674
type: Question
has body: I am trying to write a few methods for my homework assignment but I don't know what to do. I've tried a bunch of things but none seemed to work. First Question is how do i take a string I have and return it with no spaces. trim() only eliminates the first and last whitespace of the sentence(getNoSpaceString method). Also I am trying to count the number of digit words my sentence has aka one is 1 digit word. My code is below(digitWordCount method). import java.util.*; public class StringProcessor { private String noSpaces; private String input, noVowels; private String noDigitWords; private int numOfWords = 0, uppercaseLetters = 0, numOfDigits = 0, digitWords = 0; public StringProcessor() { input = ""; } public StringProcessor(String s) { StringTokenizer str = new StringTokenizer(s); numOfWords = str.countTokens(); for (int i = 0; i &lt; s.length(); i++) { if (Character.isUpperCase(s.charAt(i))) uppercaseLetters++; } for (int i = 0; i &lt; s.length(); i++) { if (Character.isDigit(s.charAt(i))) numOfDigits++; } if (str.nextToken().equalsIgnoreCase("one")) digitWords++; } public void setString(String s) { input = s; } public String getString() { return input; } public int wordCount() { return numOfWords; } public int uppercaseCount() { return uppercaseLetters; } public int digitCount() { return numOfDigits; } public int digitWordCount() { return digitWords; } public String getNoSpaceString() { return noSpaces; } public String getNoVowelString() { return noVowels; } public String getNoDigitWordString() { return noDigitWords; } public static void main(String[] args) { String input; Scanner keyboard = new Scanner(System.in); System.out.print("Enter a line of text: "); input = keyboard.nextLine(); StringProcessor str = new StringProcessor(input); System.out.println("\nwords: " + str.wordCount()); System.out.println("uppercase: " + str.uppercaseCount()); System.out.println("digits: " + str.digitCount()); System.out.println("digit words " + str.digitWordCount()); System.out.…
has comment: http://stackoverflow.com/comment/34991527
has answer: http://stackoverflow.com/a/22923856
has title: Text Processing Assignment
accepted answer: http://stackoverflow.com/a/22924341
has answer: http://stackoverflow.com/a/22923863
score: 0
tagged with: string
has answer: http://stackoverflow.com/a/22924341
possible better answer: http://stackoverflow.com/a/22923856
has comment: http://stackoverflow.com/comment/34991560
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22923892
tagged with: java
tagged with: whitespace

http://stackoverflow.com/q/22938802
tagged with: java
type: Question
answer count: 2
tagged with: user-interface
has answer: http://stackoverflow.com/a/22939056
has comment: http://stackoverflow.com/comment/35018269
score: 0
tagged with: io
has answer: http://stackoverflow.com/a/22938912
has comment: http://stackoverflow.com/comment/35018170
has body: I have created a user interface for my sound class. It looks like it should work fine because the sound class works perfectly. I'm not sure why but when i try to run the READ command, I get an error saying no such file or directory exists. The file does exist and it is in the same folder as the program. Heres the code: public class SoundUI { public static void main(String[] args){ Scanner input = new Scanner(System.in); Sound s = new Sound(); final String MENU = "R)ead , W)rite , B)ackwards , L)engthen , S)horten , I)ncrease Vol. ," + "D)ecrease Vol. , Q)uit"; char cmd = ' '; System.out.println(MENU); //User interface commands for sound do{ cmd = input.next().charAt(0); if(cmd == 'R'){ //read System.out.println("Enter file name with quotes around it"); String fileName = input.next(); s.wavRead(fileName); System.out.println(MENU); cmd = input.next().charAt(0); } else if(cmd == 'W'){ //save System.out.println("Name of file you want to save as"); String fileName = input.next(); s.wavSave(fileName); System.out.println(MENU); cmd = input.next().charAt(0); } else if(cmd == 'B'){ //reverse s.reverse(); System.out.println(MENU); cmd = input.next().charAt(0); } else if(cmd == 'L'){ //lengthen s.lengthen(); System.out.println(MENU); cmd = input.next().charAt(0); } else if(cmd == 'S'){ //shorten s.shorten(); System.out.println(MENU); cmd = input.next().charAt(0); } else if(cmd == 'I'){ //increase volume System.out.println("Enter percent"); double percent = input.nextDouble(); s.increaseVol(percent); System.out.println(MENU); cmd = input.next().charAt(0); } else if(cmd == 'D'){ //decrease volume System.out.println("Enter percent"); double percent = input.nextDouble(); s.reduceVol(percent); System.out.println(MENU); cmd = input.next().charAt(0); } } while(cmd !='Q'); //quit } }
has title: User interface does not read file
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35018580

http://stackoverflow.com/a/22814583
has comment: http://stackoverflow.com/comment/34796412
upvote count: 1
has comment: http://stackoverflow.com/comment/34795503
has comment: http://stackoverflow.com/comment/34797228
downvote count: 0
score: 1
has body: if you have similar classes, try to create common interface for them, ie interface HasId { int getId(); } then all what you need is make your classes to implement it, and change your RecordManager to be public class RecordManager&lt;T extends HasId&gt; implements RecordManagerInterface &lt;T&gt; { ... } that means your T has to implement your interface, so your get getRecord method will be much simpler public T getRecord(int id) { for ( T k: record) { if (k.getId() == id) return k; } return null; } EDIT Lets say your common interface will be interface CommonInterface&lt;T&gt; extends Comparable&lt;T&gt; { public int getId(); } then definition of your class will be, ie Person implements CommonInterface&lt;Person&gt; { ... } your RecordManager class RecordManager&lt;T extends CommonInterface&lt;T&gt;&gt; implements RecordManagerInterface&lt;T&gt;{ } and that should fix all your problems with sort
has comment: http://stackoverflow.com/comment/34824692
type: Answer
has comment: http://stackoverflow.com/comment/34796537
answers question: http://stackoverflow.com/q/22813934
has comment: http://stackoverflow.com/comment/34800982

http://stackoverflow.com/q/22937592
has answer: http://stackoverflow.com/a/22937745
has title: Resume interrupted thread
downvote count: 0
possible better answer: http://stackoverflow.com/a/22939038
has answer: http://stackoverflow.com/a/22938725
has answer: http://stackoverflow.com/a/22939038
favorite count: 0
has comment: http://stackoverflow.com/comment/35015860
answer count: 5
has body: I want to resume the work of interrupted thread,please let me know some possible solutions for the same. class RunnableDemo implements Runnable { public void run() { while(thread.isInterrupted()) { try{} catch(Exception e){ //exception caught} } } } If exception is caught, thread is interrupted, but even though exception is caught, i want thread to continue its work, so please suggest me some way to overcome this issue. Thanks in advance
has answer: http://stackoverflow.com/a/22938511
accepted answer: http://stackoverflow.com/a/22937745
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4425350
upvote count: 2
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/22939251
type: Question

http://stackoverflow.com/comment/34862558
score: 0
comment on: http://stackoverflow.com/q/22852538
type: Comment
has text: absolutely once you received the file rest is simple core java nothing special.
type: QuestionComment

http://stackoverflow.com/a/22943032
has body: If you get the name of the class from the user then you first need to attempt to load the class using the static method Class.forName(String name). If the classloader can locate the class (meaning it is in the runtime classpath), then you'll get back an instance of the Class object and can invoke the newInstance() method on that. Note that to do this you must ensure the class has a no-argument constructor, you won't be able to pass arguments to the newInstance() method. After you have your created instance, you could cast it to a known interface or use reflection to find other methods to call to setup data.
answers question: http://stackoverflow.com/q/22942824
score: 0
type: Answer

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/22811218
type: Tag

http://stackoverflow.com/comment/35006484
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22932390
has text: Is that no the point of the ability to override default methods? If the `isEmpty` *can* be calculated easier, then you should provide such implementation in your concrete class. I believe we have the same issue with for example a custom implementaiton of a `LinkedList`, where even though we have default functionality for some methods, we wish to override it for better behaviour. Or am I missing something?

http://stackoverflow.com/comment/35070218
comment on: http://stackoverflow.com/q/22967710
has text: I'd like to understand how i can get the response and print only that !
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34823887
has text: RE: try: Runtime.getRuntime().exec("java -jar "+MYAPP.getName());----- this gives an error: it is undefined for the type string
type: Comment
comment on: http://stackoverflow.com/q/22830876
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36082304
has text: Well, it means that the collumns were still visible in generated file, although no exception ocurred.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22837502

http://stackoverflow.com/q/22925951
tagged with: java
accepted answer: http://stackoverflow.com/a/23061805
upvote count: 21
linked to: http://stackoverflow.com/q/23026408
type: Question
tagged with: spring-messaging
tagged with: stomp
has body: I am configuring Websockets in Spring basically by following the guide provided in the documentation. I am currently trying to send a message from the server to the client as explained in the section "Sending messages from anywhere" Following the example, you can Autowire a class called SimpMessagingTemplate @Controller public class GreetingController { private SimpMessagingTemplate template; @Autowired public GreetingController(SimpMessagingTemplate template) { this.template = template; } @RequestMapping(value="/greetings", method=POST) public void greet(String greeting) { String text = "[" + getTimestamp() + "]:" + greeting; this.template.convertAndSend("/topic/greetings", text); } } However, my current project cannot find the bean "SimpMessagingTemplate". (Intellij: 'Could not autowire. No beans of SimpMessagingTemplate type found'. I have check several examples in the internet but I cannot find how to get Spring to create an instance of SimpMessagingTemplate. How can I Autowire it ? EDIT: I decided to send some more background information. This is my current websocket configuration: &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:websocket="http://www.springframework.org/schema/websocket" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket-4.0.xsd"&gt; &lt;!-- TODO properties to be read from a properties file --&gt; &lt;websocket:message-broker application-destination-prefix="/app"&gt; &lt;websocket:stomp-endpoint path="/new_session" &gt; &lt;websocket:sockjs/&gt; &lt;/websocket:stomp-endpoint&gt; &lt;websocket:simple-broker prefix="/topic"/&gt; &lt;/websocket:message-broker&gt; &lt;/beans&gt; Websocket works with this controller @Controller public class SessionController { private static final Logger log …
has answer: http://stackoverflow.com/a/23166422
downvote count: 0
possible better answer: http://stackoverflow.com/a/25138005
tagged with: javabeans
favorite count: 0
has answer: http://stackoverflow.com/a/25138005
answer count: 5
has answer: http://stackoverflow.com/a/77274288
has title: Could not autowire. No beans of SimpMessagingTemplate type found
tagged with: autowired
has answer: http://stackoverflow.com/a/23061805
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22929132
score: 21

http://stackoverflow.com/comment/34991786
comment on: http://stackoverflow.com/a/22870865
has text: Thanks for the update! That does clarify quite a bit! If EasySignJNI is provided to you, they must also provide you the JAR that contains the native method declarations they used to build the JNI library. Unfortunately, you cannot modify the native method signatures after the library is compiled. So to answer your question; yes, you must recompile the JNI portion to change the package name.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34955623
has text: In this article, [Inheritance of Java](http://java8.in/unit-2-prog-6-inheritance-in-java/), you can refer "Reason to use Inheritance" section...
comment on: http://stackoverflow.com/q/22903565
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34996588
comment on: http://stackoverflow.com/q/22926557
score: 0
type: Comment
type: QuestionComment
has text: i basically want the program to show the same numbers that pops up in the two telephone numbers. I also cant figure out why it emits 5. I am assuming that 5 is in both of the telephone numbers and that the number 5 happens to be the first in telUDM. Im probably wrong but i cant figure out how to display the identical numbers.

http://stackoverflow.com/a/22906024
answers question: http://stackoverflow.com/q/22905696
type: Answer
has body: I have a similar code where i used table and set the value.It may provide you with some hint: private static Font blackFont = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD); private void createSeg_Table(Document document)throws DocumentException,IOException{ PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100); try{ PdfPCell c1 = new PdfPCell(new Paragraph("text you want to show",blackFont)); c1.setVerticalAlignment(Element.ALIGN_LEFT); c1.setBorder(Rectangle.BOX); table.addCell(c1); document.add(table); } catch(Exception ex){ System.out.println(ex); } }
score: 0

http://stackoverflow.com/comment/34832861
type: AnswerComment
score: 0
has text: You need to add a call to the `resources` goal of the `gwt-maven-plugin` (I prefer just configuring `src/main/java` as a `<resource>` BTW) **in the _client_ module** (alternatively, if you `source:jar-no-fork` there, you can also simply add the ` java-source ` dependency on the _client_ module in addition to the ` jar ` one)
type: Comment
comment on: http://stackoverflow.com/a/22835683

http://stackoverflow.com/comment/34892898
comment on: http://stackoverflow.com/q/22868431
has text: @BradLarson I did not suggest to flag this for closure. I was just trying to explain what you just said and why you even then would not edit the title.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22946908
has title: Why declare and instantiate temp object in constructor instead of real object?
has body: Forgive me if this has an answer somewhere; I didn't really know what to search for... Also, my terminology may be off (declare, instantiate, etc) as I am still learning Java and OOP. I was reading the textbook: Data Structures and Abstractions, 3rd Ed by Frank Carrano (Chaper 20: Dictionary Implementation), and I came across a pretty standard looking class containing a private inner class. But there is something about the methodology I don't quite get. I am having a difficult time understanding why you would declare an object (or array of objects) as a field in the outer class, then in the constructor, instantiate a temp object and initialize the field as the temp object rather than just instantiating the attribute itself in the constructor. EDIT: I added the type parameter back into the code... K &amp; V are used for key and value in this case since we are working with dictionaries. I don't know if that is important to the question or not... I have rewritten the code in question here, renaming classes and such so they aren't so localized: public class OuterClass&lt;K, V&gt; implements SomeInterface&lt;K, V&gt; { private InnerClass&lt;K, V&gt;[] foo; // Declare array of inner class object private final static int CAPACITY = 10; // Initial Array Capacity // Outer Class Constructor public OuterClass() { InnerClass&lt;K, V&gt;[] tempFoo = (InnerClass&lt;K, V&gt;[])new InnerClass[CAPACITY]; foo = tempFoo; } // ... private class InnerClass&lt;S, T&gt; { // Inner Class Constructor private InnerClass() { // ... } // ... } } As mentioned, I tried to get rid of any specific details in the code, as I don't think they are relevant to the question. Is there any reason why you wouldn't just do this in the outer class constructor: foo = (InnerClass[])new InnerClass[CAPACITY]; instead of: InnerClass[] tempFoo = (InnerClass[])new InnerClass[CAPACITY]; foo = tempFoo;
has answer: http://stackoverflow.com/a/22947060
has answer: http://stackoverflow.com/a/22947058
has comment: http://stackoverflow.com/comment/35033080
has comment: http://stackoverflow.com/comment/35032934
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35033374
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35033192
has comment: http://stackoverflow.com/comment/35033306
possible better answer: http://stackoverflow.com/a/22947058
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35033144
has answer: http://stackoverflow.com/a/22946968
accepted answer: http://stackoverflow.com/a/22946968
tagged with: objectinstantiation
tagged with: constructor

http://stackoverflow.com/comment/34848209
type: QuestionComment
has text: What's the upper limit of input?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22844843

http://stackoverflow.com/comment/34899982
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22873134
score: 0
has text: Yes, threading will be much more helpful to your program than just running multiple instances. Additionally, please don't post comments as edits to your questions, just edit the question with the additional information. The comments section is for replying to users that have comments on your question.

http://stackoverflow.com/q/22827574
score: 0
answer count: 1
has title: assign hex value for short data type
has comment: http://stackoverflow.com/comment/34817191
has comment: http://stackoverflow.com/comment/34817231
has comment: http://stackoverflow.com/comment/34817183
has answer: http://stackoverflow.com/a/22827655
type: AnsweredQuestion
has body: I know that assigning 0x9d for short data type will work. but when i'm print it out, it displays 157. it should retain as 0x9d because im planning to pass that data to a library which accepts short data type only and should be 0x9d for example. here's the portion of my code where i got the error. short module_id = (short) 0x9d; // defined in system.txt System.out.print("hello: " + String.format("%x", module_id)); roamerLocator.receiveMsg(module_id); } protected void receiveMsg(short moduleId) { try { System.out.println("\ninside: " + moduleId); GctMsg gctMsg = GctLib.receive(moduleId); this is for my ss7 configuration . the defined parameters in ss7 configuration should be accepting 0x9d instead of decimal which is 157. and the "GctMsg gctMsg = GctLib.receive(moduleId);" accepts only short data type
type: Question
has comment: http://stackoverflow.com/comment/34817158
tagged with: java
accepted answer: http://stackoverflow.com/a/22827655

http://stackoverflow.com/a/22813273
downvote count: 0
has comment: http://stackoverflow.com/comment/34820477
type: Answer
accepted answer of: http://stackoverflow.com/q/22811932
answers question: http://stackoverflow.com/q/22811932
upvote count: 1
score: 1
has body: Problem solved by add this in web-app context: encodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true encodingFilter /* and regexp like [a-zA-Zа-яА-Я] work fine.
has comment: http://stackoverflow.com/comment/34803941
type: AcceptedAnswer

http://stackoverflow.com/comment/35011542
comment on: http://stackoverflow.com/q/22935164
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Cannot see final variable content inside anonymous class when debugging in Eclipse an Android app](http://stackoverflow.com/questions/12496842/cannot-see-final-variable-content-inside-anonymous-class-when-debugging-in-eclip)

http://stackoverflow.com/q/22940814
tagged with: java
accepted answer: http://stackoverflow.com/a/22940933
has title: Performace tuning PHP calling Java process
type: Question
linked to: http://stackoverflow.com/q/22870027
answer count: 2
possible better answer: http://stackoverflow.com/a/22941370
has comment: http://stackoverflow.com/comment/35025113
has body: I have a PHP web form that accepts file uploads (image and text), from which text is extracted (OCR and .pdf, .doc, etc stripped to plain text). The text extraction is performed by using exec to invoke a jar file/command line process (I am not in control of the source for either) which returns the text. While testing there is no issue, however, with 5 simultaneous PDF uploads (each about 5MB) the server load maxes out. The entire process (each upload) takes 10-15 seconds and load drops back to normal immediately after. I am assuming the issue is with Java and allocation to the JRE for each exec call; when manually invoking the jar file from the command line it takes about 10 seconds, so nearly the same as a single upload response. Running the extraction as background processes is not possible because the HTTP response contains the 'data' processed from the uploaded files text. I considered forking the process, but that doesn't help with the server load (will probably make it worse). I am hoping to avoid rewriting the service entirely in Java. Is there a way to pre-load the Java process JRE or pipe successive files to the same, or something of the like?
has answer: http://stackoverflow.com/a/22941370
score: 0
has answer: http://stackoverflow.com/a/22940933
tagged with: fork
tagged with: php
type: AnsweredQuestion
tagged with: performance

http://stackoverflow.com/comment/34968519
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22910346
has text: @CandiedOrange you could also simply return an interface with allowed methods from for the builder methods
score: 0

http://stackoverflow.com/q/22922134
type: UnansweredQuestion
downvote count: 0
score: 1
has title: How to detect ambient noise in android using Recorder
favorite count: 0
linked to: http://stackoverflow.com/q/14181449
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/22922229
tagged with: java
upvote count: 1
answer count: 1
has body: I'm trying to detect when there is too much auditory noise. I'm new to Android, and I don't know how to do detect external noise levels. An attempt I tried was to display the value of noise using the recorder methods: getAudioSource and getMaxAmplitude methods. public void startRecording() throws IOException { numeSunet=Environment.getExternalStorageDirectory().getPath()+"/"+System.currentTimeMillis()+".3gp"; recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(Environment.getExternalStorageDirectory().getPath()+"/"+System.currentTimeMillis()+".3gp"); recorder.prepare(); recorder.start(); int x = recorder.getMaxAmplitude(); snt.setText(""+x); }public void stopRecording() { recorder.stop(); recorder.release(); } In my case, y is always 0, and x is always 8. I would appreciate if somebody knows how to detect audio noise levels in android.
tagged with: mediarecorder

http://stackoverflow.com/a/22839383
score: 1
has comment: http://stackoverflow.com/comment/34837799
type: Answer
upvote count: 2
has body: Depending on how you want to implement, iterate: List&lt;String&gt; yourSingleList = new ArrayList&lt;&gt;(); for (List&lt;String&gt; list : yourListOfLists) { //remove entries list.retainAll(yourSingleList); //or remove matching entities list.removeAll(yourSingleList); } Or use an iterator to compare entirely: List&lt;String&gt; yourSingleList = new ArrayList&lt;&gt;(); Iterator&lt;List&lt;String&gt;&gt; lists = yourListOfLists.iterator(); while (lists.hasNext()) { if (!lists.next().equals(yourSingleList) { lists.remove(); } }
downvote count: 1
has comment: http://stackoverflow.com/comment/34837829
accepted answer of: http://stackoverflow.com/q/22839264
answers question: http://stackoverflow.com/q/22839264
type: AcceptedAnswer

http://stackoverflow.com/comment/34805162
has text: What does it print if you do `Log.d("LOG", String.valueOf(listView == null));` after the `findViewById` ?
type: Comment
comment on: http://stackoverflow.com/q/22820430
score: 0
type: QuestionComment

http://stackoverflow.com/q/22955427
has body: Given code: float [] f3 = {2.7f}; float [] [] f2 = {{42.0f}, {1.7f, 1.9f}}; What should I understand by statement if(f2[1]==f3)? The result is false, but are we comparing their sizes?
linked to: http://stackoverflow.com/q/8781022
tagged with: java
has title: Assignining one array to other which are diffrent in size in java
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22955480
has answer: http://stackoverflow.com/a/22955498
has comment: http://stackoverflow.com/comment/35047764
has answer: http://stackoverflow.com/a/22955613
type: UnansweredQuestion

http://stackoverflow.com/a/22813584
type: AcceptedAnswer
downvote count: 0
has body: Well it's quite simple. Here's the declaration of setShippingDest: public void setShippingDest(String inCustName, String inDestn) And here's how you're trying to call it: shipOrder.setShippingDest("Broome"); You've provided one argument, but there are two parameters? How do you expect that to work? You either need to provide another argument, or remove one parameter. (I'd also strongly advise that you remove the in prefix from all of your parameters, and look into a real unit testing framework such as JUnit, rather than writing an enormous main method.)
type: Answer
score: 14
upvote count: 14
has comment: http://stackoverflow.com/comment/34793198
answers question: http://stackoverflow.com/q/22813484
accepted answer of: http://stackoverflow.com/q/22813484

http://stackoverflow.com/comment/34882350
has text: its getting called from the controller
comment on: http://stackoverflow.com/a/22863825
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/22922870
has body: This structure works fine @XmlRootElement public class AAA { @XmlElements({ @XmlElement(name = "BBB", type = AbstractBC.BBB.class), @XmlElement(name = "CCC", type = AbstractBC.CCC.class) }) public List&lt;AbstractBC&gt; tables; }
answers question: http://stackoverflow.com/q/22922295
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/34982744
score: 1
has text: Looks like there's no such attribute in session when you access to jsp2 without having accessed to jsp1...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22919329

http://stackoverflow.com/a/22821998
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: Updating what to draw and actually drawing it should be separate, because you can't control when repaint() is called. You usually want to control how often the updating is done so it's always a good idea to separate. This also reduces the time it takes to draw so it increases performance as well.
answers question: http://stackoverflow.com/q/22821143

http://stackoverflow.com/q/22857194
tagged with: jcheckbox
has body: I want to take off the tick from all checkbox what I have in GUI, when I pressed on button - dynamically. Is it possible? JButton clean = new JButton("Clean"); clean.addActionListener(new MyCleanListener()); buttonBox.add(clean); public class MyCleanListener implements ActionListener{ public void actionPerformed(ActionEvent a){ if(jCheckBox.isSelected()) c.setSelected(false); } } Thank everyone for your help. public class MyCleanListener implements ActionListener{ public void actionPerformed(ActionEvent a){ for (int i = 0; i &lt; 256; i++){ c = checkboxList.get(i); c.setSelected(false); } } } here my decision.
has answer: http://stackoverflow.com/a/22857265
score: 0
possible better answer: http://stackoverflow.com/a/22857265
has title: JCheckBox in Java to take of tick in all checkbox pressing the button
tagged with: swing
has comment: http://stackoverflow.com/comment/34870881
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22858049
tagged with: java
has comment: http://stackoverflow.com/comment/34870673
type: Question
accepted answer: http://stackoverflow.com/a/22858049
tagged with: actionlistener
answer count: 2

http://stackoverflow.com/q/22913321
has comment: http://stackoverflow.com/comment/34971759
has comment: http://stackoverflow.com/comment/34971903
has body: Why functions are called methods in java. I am not asking the difference between the two. Why Java community choose to name them methods. Is there any concrete reason behind this decision or it's just a name? When i think of literal meaning as far as i could think function is related to internal working of some machine. Method is a way of working to achieve a goal(mathematical solution) or may be method is a way of implementing an Object. Is that where it came from or i just missed the real picture?
favorite count: 0
accepted answer: http://stackoverflow.com/a/22913347
has comment: http://stackoverflow.com/comment/34972064
has comment: http://stackoverflow.com/comment/34971905
has comment: http://stackoverflow.com/comment/34972649
has comment: http://stackoverflow.com/comment/34972921
has answer: http://stackoverflow.com/a/22913546
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34971826
linked to: http://stackoverflow.com/q/155609
possible better answer: http://stackoverflow.com/a/22913534
tagged with: java
has answer: http://stackoverflow.com/a/22913534
downvote count: 3
tagged with: methods
duplicate of: http://stackoverflow.com/q/155609
type: Question
has comment: http://stackoverflow.com/comment/34971940
has title: Why functions are called methods in java?
has comment: http://stackoverflow.com/comment/34971973
upvote count: 5
has answer: http://stackoverflow.com/a/22913347
has comment: http://stackoverflow.com/comment/34971897
has comment: http://stackoverflow.com/comment/34971851
answer count: 3
has comment: http://stackoverflow.com/comment/34972140

http://stackoverflow.com/comment/57578843
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22907189
has text: Have you managed to fix it? I'm struggling with it right now.

http://stackoverflow.com/comment/34936378
comment on: http://stackoverflow.com/a/22893519
score: 0
type: Comment
has text: In this answer for each student a new name is needed. Therefore I prefer the first answer since I do not know the number of students.
type: AnswerComment

http://stackoverflow.com/a/22829348
has body: Your Welcome index file should start with "/index.jsp" starting with slash if it is directly inside WebContent directory. If it is inside some dirctory like JSP it should be like /JSP/index.jsp
has comment: http://stackoverflow.com/comment/34820736
downvote count: 0
answers question: http://stackoverflow.com/q/22829269
has comment: http://stackoverflow.com/comment/34820571
has comment: http://stackoverflow.com/comment/34820675
type: Answer
has comment: http://stackoverflow.com/comment/34820641
upvote count: 2
score: 2

http://stackoverflow.com/comment/35002823
type: QuestionComment
score: 1
has text: Better than that, immutable. [link to javadoc](http://docs.guava-libraries.googlecode.com/git-history/v16.0.1/javadoc/com/google/common/io/BaseEncoding.html)
comment on: http://stackoverflow.com/q/22930030
type: Comment

http://stackoverflow.com/a/36712791
type: Answer
answers question: http://stackoverflow.com/q/22887829
has body: Upgrading from java7 to java8 did the trick for me.
upvote count: 5
score: 5
downvote count: 0

http://stackoverflow.com/comment/35057057
type: Comment
has text: No, what i describe is [atomicity](http://en.wikipedia.org/wiki/ACID#Atomicity). Atomicity is whether you can see intermediate results from a single operation. Isolation is about multiple concurrent operations and whether the overall result is consistent.
comment on: http://stackoverflow.com/a/22960681
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35075611
type: Comment
has text: @TimGoodman: Yeah, it would be somewhat equivalent to `internal sealed` in C# or `JAR final` in Java, which of course don't exist.
score: 0
comment on: http://stackoverflow.com/a/22968086
type: AnswerComment

http://stackoverflow.com/comment/34799552
score: 0
has text: Before going any further, the StartService call should return a ComponentName object. Just check to make sure it's not null, otherwise it might be a manifest issue
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22816875

http://stackoverflow.com/comment/34907034
has text: thank you for replay i know that but we have multiple values in list and we need to send all values into servlet
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22877057

http://stackoverflow.com/comment/34976739
comment on: http://stackoverflow.com/q/22915512
score: 0
type: Comment
type: QuestionComment
has text: How should I initialize it then? Sorry for the stupid question I'm a newby...

http://stackoverflow.com/a/22938439
score: -1
has body: You should have a single subclass of javax.ws.rs.core.Application in your webapp, and then use different @Path annotation values on your service.Adages and webservices.PredictionsRS resource types. AFAIK, in JEE6 containers, you are not allowed to have 2 such subclasses...
upvote count: 0
has comment: http://stackoverflow.com/comment/35019991
has comment: http://stackoverflow.com/comment/35023462
has comment: http://stackoverflow.com/comment/35018610
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/22929499

http://stackoverflow.com/comment/35044812
score: 0
type: Comment
has text: I did as you instructed, but the groups are not expanding with the checkboxes.
type: AnswerComment
comment on: http://stackoverflow.com/a/22930186

http://stackoverflow.com/a/22846727
has comment: http://stackoverflow.com/comment/34852323
answers question: http://stackoverflow.com/q/22846619
upvote count: 1
downvote count: 0
has body: Because when you use single = operation, you are doing an assignment operation, the compiler expect in the left side a variable to hold the right side value in. So try to change this line: if (String.compareTo(phrase("test")) = phrase.toUpperCase()) { To something like: if (new Phrase("test").getPhrase().equals(phrase.toUpperCase())) {
type: Answer
has comment: http://stackoverflow.com/comment/34851849
score: 1
has comment: http://stackoverflow.com/comment/34852104
has comment: http://stackoverflow.com/comment/34851685
has comment: http://stackoverflow.com/comment/34851923
has comment: http://stackoverflow.com/comment/34851804

http://stackoverflow.com/a/22949075
has comment: http://stackoverflow.com/comment/35036937
type: Answer
has body: if you are using Visual studio right-click on the toolbox click "Choose Items..." wait a stupid amount of time browse to your exe pick the controls Note that your code will still need to be able to resolve the control at runtime, which means deploying the .NET assembly, or for ActiveX deploying the interop assembly and having the COM dll registered. To host a separate exe inside a running forms application is not trivial; you would have to spawn the exe (Process.Start) and then use win32 calls to obtain the appropriate window handle, with the intention of re-parenting the window into one of your own. This is a reasonable amount of work, very easy to get wrong, and very brittle (bad thins happen if you bork it). Personally: I simply wouldn't.
answers question: http://stackoverflow.com/q/22948704
score: 0

spring-test-dbunit
type: Tag
tags question: http://stackoverflow.com/q/22869099
tag name: spring-test-dbunit

http://stackoverflow.com/q/22916912
tagged with: jpa-2.1
has title: Java, hibernate transient field
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22917683
answer count: 1
has body: Im having domain object Item with fields id, name, parentItem and category(Boolean). So im inserting values in database like: id name parentItem category 1 Tools NULL 1 2 Electric tools 1 1 3 Small tools 2 1 4 Actual tool end child item 3 0 so actual item is in category/path "Tools/Electric tools/Small tools" So i need to implements lazy filter search by categoryName/categoryPath. For example: if user inputs in dataTable filter "Electric" i need to return all items in "Electric tools" category and all items from subcategorys ( in this example Small tools and all other if they exist). So currently i have in java domain object @Transient field which uses recursion to get items path. But i cant search by Transient fields. I mean i cant implement search in database because this field is: 1. Transient 2. Uses recursion and if i need to deploy app on other db version, i will have to rewrite recursion sql on db or something. I dont like this Can anyone point me to some clever, unique solution ? Any idea, advice is appreciated. Thanks!
upvote count: 1
accepted answer: http://stackoverflow.com/a/22917683
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2486757
score: 1
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/q/22920703
has answer: http://stackoverflow.com/a/22921169
answer count: 4
tagged with: parsing
has answer: http://stackoverflow.com/a/22920839
possible better answer: http://stackoverflow.com/a/22920839
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22921155
tagged with: java
type: Question
score: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/22921492
has comment: http://stackoverflow.com/comment/34985676
has body: I have a string and I want to convert it to a 2D array of integers. This is what I am doing: String string1="[1,2,3]~[4,5,6]~[7,8,9]~"; //Putting each element into an array of strings String stringArray[]=string1.split("~"); //Determining the number of columns for the 2D array int countints=0; Scanner ins = new Scanner(stringArray[0]); while (ins.hasNext()){ countints+=1; ins.next(); } //converting into an array of integers int intArray[][]=new int[stringArray.length][countints]; Here I'm stuck as how to parse each integer into the 2D array.
accepted answer: http://stackoverflow.com/a/22921155
tagged with: multidimensional-array
has title: Convert a 1D string to a 2D array of Integers

http://stackoverflow.com/q/22874061
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/22874297
tagged with: java
type: Question
has title: Java Can the same event be triggerd multiple times and be running at the same time?
score: 0
answer count: 1
tagged with: events
has body: If I have a MouseMotionListener, will multiple mouseDragged methods get executed and have the possibility of being running concurrently? Here is a picture: Time -&gt; 0------------1---------------2------------------------3-------------------------------4------ Mouse Moved--mouseDragged()--Method crunches numbers--Method Still Crunching Numbers--Method keeps doing stuff Mouse Moved--------------mouseDragged()------------------Starts to do stuff OR: Mouse Moved mouseDragged() Stuff happens Mouse Moved again but nothing happens More stuff happens Stuff done mouseDragged() Stuff Done You should get the idea. Thanks! I know about the EDT, but not sure how it works.
tagged with: event-dispatch-thread

http://stackoverflow.com/a/23369629
has comment: http://stackoverflow.com/comment/36596093
answers question: http://stackoverflow.com/q/22963581
has comment: http://stackoverflow.com/comment/71074675
score: 12
has comment: http://stackoverflow.com/comment/36596957
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/56757002
type: Answer
upvote count: 12
has comment: http://stackoverflow.com/comment/71075085
has comment: http://stackoverflow.com/comment/35825235
downvote count: 0
has comment: http://stackoverflow.com/comment/56757173
has body: In Java this will be pretty much the same code. After striping guarding strings away and decoding Base64 data give it to this utility method: public static PrivateKey keyToValue(byte[] pkcs8key) throws GeneralSecurityException { PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(pkcs8key); KeyFactory factory = KeyFactory.getInstance("ECDSA"); PrivateKey privateKey = factory.generatePrivate(spec); return privateKey; }
accepted answer of: http://stackoverflow.com/q/22963581

http://stackoverflow.com/comment/35041029
score: 0
type: Comment
type: QuestionComment
has text: I can't use that, as i have to deploy my code on websphere application server, and i can't change the -Xmx there, anyway as per server admin the server is having the heap memory max value as 745, which seems to be big enough, but still i get this error from supercsv
comment on: http://stackoverflow.com/q/22951233

apache-camel
tags question: http://stackoverflow.com/q/22832822
tags question: http://stackoverflow.com/q/22816854
tags question: http://stackoverflow.com/q/22876781
tags question: http://stackoverflow.com/q/22943311
tags question: http://stackoverflow.com/q/22900951
tags question: http://stackoverflow.com/q/22913796
tags question: http://stackoverflow.com/q/22967748
tag name: apache-camel
tags question: http://stackoverflow.com/q/22858776
tags question: http://stackoverflow.com/q/22862951
tags question: http://stackoverflow.com/q/22963219
tags question: http://stackoverflow.com/q/22918402
tags question: http://stackoverflow.com/q/22870755
tags question: http://stackoverflow.com/q/22938459
tags question: http://stackoverflow.com/q/22956734
tags question: http://stackoverflow.com/q/22814272
tags question: http://stackoverflow.com/q/22845283
type: Tag

http://stackoverflow.com/comment/61598538
score: 0
has text: You can use primefaces `p:component()` function. This function finds component in view root with the given ID and then returns its client ID. For your case: `update=":#{p:component('datatable')}"`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22812706

http://stackoverflow.com/comment/35008362
score: 0
comment on: http://stackoverflow.com/a/22878704
type: Comment
has text: yes, this works. thanks. i run services.msc as command prompt, then start SQL server browser thanks. but i can make connection by specifying server name as //MachineName , and my servers seems as SQL SERVER(INSTANCENAME) in services list.
type: AnswerComment

http://stackoverflow.com/a/22918766
upvote count: 2
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34981709
has body: you may use the FileUtils class of Apache Commons IO; with it you can do something like that: FileUtils.forceDelete(new File("/home/test")); Links to the documentation: http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html Hope it helps Angelo
answers question: http://stackoverflow.com/q/22918630

http://stackoverflow.com/a/22944776
type: Answer
has comment: http://stackoverflow.com/comment/35112232
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/22944661
has comment: http://stackoverflow.com/comment/35029317
score: 8
has body: No, it isn't possible. For this to happen we would need to abstract over the Functor in your interface, something like interface Functor&lt;T&gt; as F&lt;T&gt; { F&lt;S&gt; map(f : Function&lt;T, S&gt;); } But Java doesn't allow you to abstract over type constructors, just types. This is called Higher Kinded Types (HKT). Only a few (non-dependent) languages have HKTs, Scala and Haskell are the only two I can think of. In fact HKTs are necessary to express a lot of abstractions, Control.Monad Control.Applicative Data.Traversable Data.Foldable Control.Monad.Trans Any monad transformers, full stop Free monads Lenses/Prisms Streaming libraries (they're monad transformers) Almost everything that was in category-extras All of these involve abstracting over type constructors, not just concrete types.

http://stackoverflow.com/comment/34988919
has text: image <aaa><ccc> .... I forget to say, that CCC and BBB have different names, but similar structure
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22922295

http://stackoverflow.com/comment/35067048
score: 0
type: Comment
type: QuestionComment
has text: How to actually create it. Maybe an example? I couldn't really find enough info to go on to actually create one.
comment on: http://stackoverflow.com/q/22966176

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/22966588
tag name: android-actionbar
tags question: http://stackoverflow.com/q/22863032

http://stackoverflow.com/comment/34856092
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22845412
score: 0
has text: See that's the problem, there is nothing in the log. If I deploy the application to the glassfish server and then do a GET on the resource the last item in the server log is an entry for the deployment. And the `Verplaatsing` objects should be parsed to JSON through the RS API. Since apart from the XMLRootElement annotations there is nothing configured. But since this code works when the Verplaatsing object is in the same .war as the service class I don't think that it should matter.

http://stackoverflow.com/comment/35835673
comment on: http://stackoverflow.com/q/22852420
score: 0
type: Comment
type: QuestionComment
has text: I am using mongo-java-driver-2.11.3 directly. I do want to execute the script on the server because the source (db2) and the sink (sever at db1) and my client are all on separate networks. I did solve it by doing it in Java. However, that's slower because the data has to travel from through the intermediate client, rather than directly between the two servers.

http://stackoverflow.com/comment/35050548
type: QuestionComment
has text: You way of reading the file is unrealistic. Read the file in large chunks and time that. And you shouldn't time the console prints anyway.
score: 0
comment on: http://stackoverflow.com/q/22955178
type: Comment

ppm
tags question: http://stackoverflow.com/q/22869957
type: Tag
tag name: ppm

http://stackoverflow.com/a/22910196
has body: As you suspect, in order for compareTo() to be consistent with equals(), compareTo() must always return 0 when equals() returns true. Similarly, if equals returns false, then compareTo must not return 0. However, as popovitsj has pointed out in his answer, consistency with equals() is not a requirement. As such, the above only applies when you are attempting to make the two methods consistent.
answers question: http://stackoverflow.com/q/22909768
score: 0
type: Answer

http://stackoverflow.com/comment/35010740
comment on: http://stackoverflow.com/a/22932150
type: AnswerComment
has text: @gstackoverflow: How are you going to access the items? `get`? That breaks. `poll`? That doesn't seem to break, but then you're stuck with effectively just a deque, and you're tiptoeing around the holes in an implementation that was never designed to handle such huge sizes. Who knows whether the next version of the JDK will break your code?
score: 0
type: Comment

http://stackoverflow.com/q/22879727
possible better answer: http://stackoverflow.com/a/22879807
has answer: http://stackoverflow.com/a/22879807
has comment: http://stackoverflow.com/comment/34911515
has answer: http://stackoverflow.com/a/22879780
score: 0
has answer: http://stackoverflow.com/a/22897519
accepted answer: http://stackoverflow.com/a/22897519
has comment: http://stackoverflow.com/comment/34943441
tagged with: android
answer count: 5
has answer: http://stackoverflow.com/a/22879843
has body: I am developing my first ever Android App using Eclipse. I have the following code for my activity_main.xml view: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="biztalkers.gcmtest3.MainActivity" tools:ignore="MergeRootFrame" &gt; &lt;TextView android:id="@+id/txtToken" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" /&gt; &lt;/FrameLayout&gt; I have the following code within my MainActivity.java class protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final TextView txtToken = (TextView) findViewById(R.id.txtToken); My problem is with tha last line in the code block "final TextView txtToken = (TextView) findViewById(R.id.txtToken);", for this I get the error "txtToken cannot be resolved or is not a field". Can anyone see what I've done wrong? Here are the imports package biztalkers.gcmtest3; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; import com.google.android.gms.gcm.GoogleCloudMessaging; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; 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.TextView; import biztalkers.gcmtest3.R; The line "import biztalkers.gcmtest3.R;" is underlined red as it "cannot be resolved"
has title: Can't reference TextView
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34914793
tagged with: eclipse
has answer: http://stackoverflow.com/a/22879804
type: Question

http://stackoverflow.com/q/22942478
answer count: 2
has comment: http://stackoverflow.com/comment/35025066
has comment: http://stackoverflow.com/comment/35028994
possible better answer: http://stackoverflow.com/a/22942747
accepted answer: http://stackoverflow.com/a/22946195
has answer: http://stackoverflow.com/a/22942747
downvote count: 0
has body: I want to use Tomcat to simply start a service, not a servlet. I know Tomcat is a servlet container and not an application server, but this is the platform the architect has set for us to use. I want to have a Java class executed as soon as Tomcat starts up which will load a class from the Spring context and call some method on it. I'm thinking the best way to do this is to create a Listener which will load my bean from the Spring context using a ClassPathXmlApplicationContext and call the desired method on it. Is there a better way of doing this ?
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/35025410
has comment: http://stackoverflow.com/comment/35024958
tagged with: spring
has comment: http://stackoverflow.com/comment/35027727
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22946195
score: 1
tagged with: java
upvote count: 1
has title: Tomcat to run a service not web application
type: Question

http://stackoverflow.com/comment/104845514
type: Comment
has text: Not every "business logic" gives services
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22964593

http://stackoverflow.com/q/22884574
answer count: 2
has title: How are these two situation different?
accepted answer: http://stackoverflow.com/a/22884717
upvote count: 0
downvote count: 5
has answer: http://stackoverflow.com/a/22884627
possible better answer: http://stackoverflow.com/a/22884627
favorite count: 0
has answer: http://stackoverflow.com/a/22884717
linked to: http://stackoverflow.com/q/40480
tagged with: parameter-passing
has comment: http://stackoverflow.com/comment/34920360
has body: public void otherMethod(){ List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("abc"); list.add("abc"); list.add("abc"); someOtherMethod(list); System.out.println(list.size()); } public void someOtherMethod(List&lt;String&gt; list){ list.add("abc"); } Invoking otherMethod prints 4. where as public void otherMethod(){ int a = 10 someOtherMethod(a); System.out.println(a); } public void someOtherMethod(int a){ a = 11; } prints 10; How are the two different. Aren't both local variables? Does sending list reference work in a different way? Please help me understand how the two scenario differ? Before downvoting please make me understand why this below one also prints 10? public void otherMethod(){ Long a = new Long(10); someOtherMethod(a); System.out.println(a); } public void someOtherMethod(Long a){ a = 11; //or a= new Long(11); }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34920311
score: -5
duplicate of: http://stackoverflow.com/q/40480
tagged with: java
type: Question

http://stackoverflow.com/q/22902935
tagged with: android
has comment: http://stackoverflow.com/comment/34953510
has comment: http://stackoverflow.com/comment/34953542
has comment: http://stackoverflow.com/comment/34953544
has comment: http://stackoverflow.com/comment/34953592
tagged with: generics
has comment: http://stackoverflow.com/comment/34953494
has answer: http://stackoverflow.com/a/22902972
score: 0
has comment: http://stackoverflow.com/comment/34953528
answer count: 1
has comment: http://stackoverflow.com/comment/34953606
tagged with: java
accepted answer: http://stackoverflow.com/a/22902972
has title: Array w/ Generics
has comment: http://stackoverflow.com/comment/34953624
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2927391
has comment: http://stackoverflow.com/comment/34953518
has body: I have read What's the reason I can't create generic array types in Java? . I came to it when I tried this code: HashMap<String, String>[] ret = new HashMap<String, String>[arraySize]; I decided to "get wild" and try something else ArrayList<HashMap<String, String>> ret = new ArrayList<HashMap<String, String>>(); Now, what I don't understand is why the first option is bad/not-supported and the second option compiles. What am I missing? In the first method I get an error and cannot compile while the second method has no compiler issues. I prefer to follow intelligent programming principles, but do not understand the difference in this particular case.
type: Question

http://stackoverflow.com/comment/129328056
has text: Actually this works for me, you should provide a dependency with the implementation like `hibernate-validator` or `spring-boot-starter-validation` in my case, but this solution works perfectly, I don't get the negative votes.
comment on: http://stackoverflow.com/a/52873613
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34958947
has text: Yes, this is how it should work. But I doesn't work under Weblogic 12c.
type: Comment
comment on: http://stackoverflow.com/a/22879355
score: 0
type: AnswerComment

imageicon
tags question: http://stackoverflow.com/q/22928116
tags question: http://stackoverflow.com/q/22922368
tags question: http://stackoverflow.com/q/22923514
tag name: imageicon
tags question: http://stackoverflow.com/q/22924469
tags question: http://stackoverflow.com/q/22923580
tags question: http://stackoverflow.com/q/22911569
tags question: http://stackoverflow.com/q/22956920
tags question: http://stackoverflow.com/q/22900685
tags question: http://stackoverflow.com/q/22850721
type: Tag

http://stackoverflow.com/q/22853509
has comment: http://stackoverflow.com/comment/34865271
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34865538
has comment: http://stackoverflow.com/comment/34864209
favorite count: 0
has comment: http://stackoverflow.com/comment/34864976
has comment: http://stackoverflow.com/comment/34865773
score: 27
has answer: http://stackoverflow.com/a/41788026
has comment: http://stackoverflow.com/comment/34865128
has comment: http://stackoverflow.com/comment/34864508
answer count: 3
has comment: http://stackoverflow.com/comment/34865712
has comment: http://stackoverflow.com/comment/34865399
has body: I am trying to show DB data to my webpage. I have made following code when GET request to the @RequestMapping(value = "/api/binder"). but when get request came to this method it will fetch data (I have print on console and display well) but it doesn't map to my Java Script Ajax call, it's showing me an error. Following is my code for to fetch data : @Autowired IBinderViewRepository repository; @RequestMapping(method= RequestMethod.GET) public @ResponseBody List&lt;BinderResponse&gt; getBinders(){ List&lt;BinderView&gt; binders = repository.getBinders(); List&lt;BinderResponse&gt; responses = new ArrayList&lt;&gt;(); ModelMapper mapper = Mapper.getInstance(); for(int i = 0; i &lt; binders.size(); i++){ System.out.println("In Loop"); BinderResponse response = mapper.map(binders.get(i),BinderResponse.class); System.out.println("Data :: " + response.getBinderName()); responses.add(response); } return responses; } but it shows me following error : HTTP Status 500 - Could not write JSON: (was java.lang.NullPointerException) (through reference chain: java.util.ArrayList[0]-&gt;com.ngl.dto.outgoing.BinderResponse["valid"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: java.util.ArrayList[0]-&gt;com.ngl.dto.outgoing.BinderResponse["valid"]) Here is ajax call from knockout js : ajax.get('api/binder').done(function(response){ ... } Here BinderView and BinderResponse have same fields : private String binderName; private String binderAddress1; and getter setter as well in both. and repository.genBinders() method bring data from DB. Here is insert method and works fine for me : @RequestMapping(method= RequestMethod.POST,consumes = "application/json") public @ResponseBody IWebApiResponse addBinder(@RequestBody AddBinderForm binder){ ..... } Shall I have to put any json annotation on my BinderResponse class ? I don't understand where am i wrong ?Anyone pleas guide me. UPDATE : public class Bi…
has comment: http://stackoverflow.com/comment/34865732
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/22854649
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34864537
has comment: http://stackoverflow.com/comment/34865646
has comment: http://stackoverflow.com/comment/34865453
has comment: http://stackoverflow.com/comment/34864137
upvote count: 27
has title: Getting JsonMappingException while sending data to view
has answer: http://stackoverflow.com/a/54298074
downvote count: 0
has comment: http://stackoverflow.com/comment/98535657
has comment: http://stackoverflow.com/comment/34864701
tagged with: jackson
has comment: http://stackoverflow.com/comment/34864960
tagged with: ajax
accepted answer: http://stackoverflow.com/a/22854649
type: Question
possible better answer: http://stackoverflow.com/a/54298074

http://stackoverflow.com/comment/35007814
type: Comment
comment on: http://stackoverflow.com/a/22933127
has text: Look at the exception once more. It says am trying to enter ' ' for more than one time. But I didn't tried to enter ' ' any time. Always I type some data in the text field. Some how the data in the text field is not getting entered into the database.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22879690
has comment: http://stackoverflow.com/comment/34911657
accepted answer of: http://stackoverflow.com/q/22879627
has comment: http://stackoverflow.com/comment/34911375
upvote count: 7
type: Answer
has body: You can already use a better loop for(File f: array) { list.add(f.toPath(); } Then, if you are using Java 8, you can use the new stream using something like: final List&lt;Path&gt; list = Arrays.stream(array).map(File::toPath) .collect(Collectors.toList());
has comment: http://stackoverflow.com/comment/34911665
downvote count: 0
has comment: http://stackoverflow.com/comment/34911470
has comment: http://stackoverflow.com/comment/34911871
score: 7
answers question: http://stackoverflow.com/q/22879627
type: AcceptedAnswer

http://stackoverflow.com/comment/35040009
type: QuestionComment
comment on: http://stackoverflow.com/q/22950730
has text: @Sotirios, No, I don't know how to calculate the distance between points and yes, I do know how to sort.
score: 0
type: Comment

http://stackoverflow.com/a/22889639
type: Answer
has comment: http://stackoverflow.com/comment/34929478
has comment: http://stackoverflow.com/comment/34930280
answers question: http://stackoverflow.com/q/22889619
has comment: http://stackoverflow.com/comment/34929500
has comment: http://stackoverflow.com/comment/34930082
has body: You're only making the declarations in that block. String user = inputScanner.next(); int cip = Integer.parseInt(user); Add these to the start of the file, just after the main() line: int cip = 0; String user = ""; The errors after just moving (without the = stuff) indicate that you're using cip after the try block, so we need to initialise it with empty data in case the try fails. Now just change the lines that you've currently got in the try block to: // Remove the 'String' part. user = inputScanner.next(); // Remove the 'int' part. cip = Integer.parseInt(user); And then you can move on to the next unrelated bug.
has comment: http://stackoverflow.com/comment/34929567
score: 0

http://stackoverflow.com/q/22933080
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22933127
has answer: http://stackoverflow.com/a/22943753
favorite count: 0
has answer: http://stackoverflow.com/a/22933162
type: Question
tagged with: exception
has answer: http://stackoverflow.com/a/22933173
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/22926420
tagged with: mysql
upvote count: 1
has title: Same type of codes, but one code shows exception
downvote count: 1
has body: I edited the question. This is the full code. Have a look at it. public class AddStaff extends Application { private Connection connect = null; private Statement statement = null; private ResultSet rs = null; private PreparedStatement preparedStatement = null; TextField addSubName; String msg; private TableView<Staff> table = new TableView<Staff>(); private final ObservableList<Staff> data = FXCollections.observableArrayList(); final HBox hb = new HBox(); public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Add Staff"); stage.setWidth(450); stage.setHeight(550); stage.setResizable(false); final Label label = new Label("Staff Details"); label.setFont(Font.font("Calibri", FontWeight.BOLD, 22)); label.setTextFill(Color.WHITE); TableColumn sub = new TableColumn("Staff Name"); sub.setMinWidth(400); sub.setCellValueFactory( new PropertyValueFactory<Staff, String>("subName")); sub.setCellFactory(TextFieldTableCell.forTableColumn()); sub.setOnEditCommit( new EventHandler<TableColumn.CellEditEvent<Staff, String>>() { @Override public void handle(TableColumn.CellEditEvent<Staff, String> t) { ((Staff) t.getTableView().getItems().get( t.getTablePosition().getRow())).setSubName(t.getNewValue()); } } ); table.setItems(data); table.getColumns().addAll(sub); addSubName = new TextField(); addSubName.setPromptText("Staff Name"); addSubName.setPrefSize(200, 30); final Button b2 = new Button("Add"); b2.setFont(Font.font("Calibri", FontWeight.BOLD, 17)); b2.setPrefSize(70, 30); b2.setStyle(" -fx-base: #0066ff;"); b2.setTextFill(Color.BLACK); b2.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { msg = addSubName.getText(); try { enterStaff(); } catch (ClassNotFoundException | SQLException ex) { Logger.getLogger(AddStaff.class.getName()).log(Level.SEVERE, null, ex); } data.add(new Staff(addSubName.getText())); addSubName.clear(); } }); hb.getChildre…
has comment: http://stackoverflow.com/comment/35007795
has answer: http://stackoverflow.com/a/22933178
has comment: http://stackoverflow.com/comment/35007828

http://stackoverflow.com/comment/34959985
type: Comment
comment on: http://stackoverflow.com/a/22905784
has text: The inner loop is O(n). We are looking at each element of the array only once. And the outer array is O(N). So algorithm is O(N^2).
score: 0
type: AnswerComment

http://stackoverflow.com/a/22953839
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22953348
score: 2
downvote count: 0
has body: You can use Gson library and you need to make a Model class. code public class SO1 { public static void main(String[] args) { Gson parser = new Gson(); String json = "[ { \"WindDirection\": {\"id\": \"3\",\"wind_direction\": \"East\", \"is_deleted\": false } }, {\"WindDirection\": { \"id\": \"14\", \"wind_direction\": \"East NorthEast\", \"is_deleted\": false } }]"; JsonParser jParser = new JsonParser(); JsonArray jArray = jParser.parse(json).getAsJsonArray(); ArrayList&lt;Model&gt; modelList = new ArrayList&lt;&gt;(); for (JsonElement element : jArray) { JsonObject obj = (JsonObject) element; element = obj.get("WindDirection"); Model st = parser.fromJson(element, Model.class); System.out.println(st); modelList.add(st); } } } class Model { String id; String wind_direction; boolean is_deleted; @Override public String toString() { // TODO Auto-generated method stub return id + "\t" + wind_direction + "\t" + is_deleted; } } Output 3 East false 14 East NorthEast false

http://stackoverflow.com/a/22967894
score: 0
type: AcceptedAnswer
has body: You need to reference the key, not the values it it holds Query lQuery = entityMgr.createQuery("update ParamGenerique p set p.libelleParam = :dest where id = :key); ParamGeneriqueKey key = new ParamGeneriqueKey(); key.setTypeParam("GESTION_MAIL"); key.setValeurParam("DESTINATAIRE"); lQuery.setParameter("dest", pDestinataire); lQuery.setParameter("key", key);
answers question: http://stackoverflow.com/q/22967763
type: Answer
accepted answer of: http://stackoverflow.com/q/22967763

http://stackoverflow.com/a/22946545
has body: When set the layout manage with a GridLayout, you can specify the gaps between elements: setLayout(new GridLayout(rows, cols, hgap, vgap)); hgap > the gap size between elements horizontally vgap > the gap size between elements vertically Java doc: In addition, the horizontal and vertical gaps are set to the specified values. Horizontal gaps are placed between each of the columns. Vertical gaps are placed between each of the rows.
accepted answer of: http://stackoverflow.com/q/22946504
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22946504
downvote count: 0

http://stackoverflow.com/comment/34927009
has text: @Jeff Its a local variable.
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/22888276

http://stackoverflow.com/comment/90592191
score: 0
type: AnswerComment
type: Comment
has text: how to query them using HQL with inner join? Since "ON" clause is not present in hql inner join ?
comment on: http://stackoverflow.com/a/22954872

http://stackoverflow.com/a/22952935
type: Answer
answers question: http://stackoverflow.com/q/22952789
has body: Are you talking about a Caesar cipher? It changes each char into an ascii number, adds a flat number to each ascii number, then reverts each char to the respective chars. If this is your encryption, you simply need to subtract your flat number in the loop for decryption.
score: 0
has comment: http://stackoverflow.com/comment/35043654
has comment: http://stackoverflow.com/comment/35069085

http://stackoverflow.com/comment/34953473
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22902321
type: AnswerComment
has text: I've actually tried that.. but it didn't work. It seems the root directory it is searching from is not my `workspace` folder. Is there a way to change the directory it begins its search?

http://stackoverflow.com/a/22947994
has comment: http://stackoverflow.com/comment/35069577
upvote count: 2
has body: From the menu, select "Window-->Show View-->Other..." In the dialog, select "Maven-->Maven Repositories" and hit OK. In the Maven Repositories view, right-click "Local Repositories-->Local Repository" and select "Rebuild Index" from the popup menu. If asked if you're sure you want to rebuild the index, hit OK. If that doesn't work (it should), try right-clicking the project in the Explorer view, selecting "Maven-->Update Project..." from the popup menu, ensuring that "Update dependencies" is checked in the dialog that appears, and hitting OK. BTW, you probably want to add runtime to your dependency element in the pom file, although that's not related to your issue.
has comment: http://stackoverflow.com/comment/35077599
score: 2
answers question: http://stackoverflow.com/q/22946626
has comment: http://stackoverflow.com/comment/35111617
downvote count: 0
has comment: http://stackoverflow.com/comment/35077426
has comment: http://stackoverflow.com/comment/35110826
has comment: http://stackoverflow.com/comment/35097631
has comment: http://stackoverflow.com/comment/35110630
type: Answer

http://stackoverflow.com/comment/34861268
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22851771
has text: I'm not sure what a Windows phone has to do with it. XML is XML. Anyway, you're welcome
score: 1

http://stackoverflow.com/comment/34993761
has text: where exactly is your error?
type: Comment
comment on: http://stackoverflow.com/q/22924974
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34851986
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22845574
has text: Create a "power set" of all combinations and stream/filter each combination.
type: QuestionComment

list
type: Tag
tags question: http://stackoverflow.com/q/22885530
tags question: http://stackoverflow.com/q/22931849
tags question: http://stackoverflow.com/q/22914929
tags question: http://stackoverflow.com/q/22954636
tags question: http://stackoverflow.com/q/22850522
tags question: http://stackoverflow.com/q/22927875
tags question: http://stackoverflow.com/q/22931808
tags question: http://stackoverflow.com/q/22867778
tags question: http://stackoverflow.com/q/22893133
tags question: http://stackoverflow.com/q/22942301
tags question: http://stackoverflow.com/q/22944556
tags question: http://stackoverflow.com/q/22872627
tags question: http://stackoverflow.com/q/22854054
tags question: http://stackoverflow.com/q/22901157
tags question: http://stackoverflow.com/q/22955621
tags question: http://stackoverflow.com/q/22876412
tag name: list
tags question: http://stackoverflow.com/q/22918471
tags question: http://stackoverflow.com/q/22889079
tags question: http://stackoverflow.com/q/22934553
tags question: http://stackoverflow.com/q/22902286
tags question: http://stackoverflow.com/q/22836589
tags question: http://stackoverflow.com/q/22928503
tags question: http://stackoverflow.com/q/22866839
tags question: http://stackoverflow.com/q/22881747
tags question: http://stackoverflow.com/q/22900234
tags question: http://stackoverflow.com/q/22900060
tags question: http://stackoverflow.com/q/22850825
tags question: http://stackoverflow.com/q/22861662
tags question: http://stackoverflow.com/q/22919604
tags question: http://stackoverflow.com/q/22869350
tags question: http://stackoverflow.com/q/22952654
tags question: http://stackoverflow.com/q/22930621
tags question: http://stackoverflow.com/q/22894206
tags question: http://stackoverflow.com/q/22834769
tags question: http://stackoverflow.com/q/22923658
tags question: http://stackoverflow.com/q/22868763
tags question: http://stackoverflow.com/q/22861846
tags question: http://stackoverflow.com/q/22862756
tags question: http://stackoverflow.com/q/22918360
tags question: http://stackoverflow.com/q/22956532
tags question: http://stackoverflow.com/q/22893420
tags question: http://stackoverflow.com/q/22902332
tags question: http://stackoverflow.com/q/22903730
tags question: http://stackoverflow.com/q/22930780
tags question: http://stackoverflow.com/q/22935398
tags question: http://stackoverflow.com/q/22915233

http://stackoverflow.com/comment/34981262
comment on: http://stackoverflow.com/a/22918001
has text: user.timezone and user.country how to see these properties.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34959647
comment on: http://stackoverflow.com/a/22848650
type: AnswerComment
score: 0
type: Comment
has text: thanks for your answer, our browser using json well-HTTP protocol, for now i try to working on the selenium driver that should enable me to use it selenium for my future tests.

http://stackoverflow.com/a/22930864
answers question: http://stackoverflow.com/q/22930654
score: 1
has body: This behavior is defined in the specification. "Variable arity methods, boxing, and unboxing " are handled in the third phase of method signature resolution, after first trying to match the signature without using variable arity methods.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/22813099
duplicate of: http://stackoverflow.com/q/4772425
tagged with: java
downvote count: 3
answer count: 1
tagged with: format
has body: I want to format a from string date to another String date value. The date is show as "03/20/2014". I have to format it to "2014-03-20". Could you please give me sample codeing for this? Thanks
type: UnansweredQuestion
tagged with: date
score: -3
has answer: http://stackoverflow.com/a/22813670
upvote count: 0
has title: Format String date to another string format using java
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/4772425

http://stackoverflow.com/a/22818049
type: Answer
answers question: http://stackoverflow.com/q/22817852
has body: You will need to change the default error output stream. Since you are most probably coding a servlet , you could change to : exc.printStackTrace(response.getWriter()); This will print the exception trace into the browser window.
score: 0

http://stackoverflow.com/comment/34848075
comment on: http://stackoverflow.com/q/22829633
type: QuestionComment
has text: @TechSpellBound: Yes, `SampleObject` could be any POJO.
type: Comment
score: 0

http://stackoverflow.com/q/22880719
type: Question
has comment: http://stackoverflow.com/comment/34913888
downvote count: 5
upvote count: 0
has body: After inserting value in database then redirect to another jsp page?but actually without inserting value in database it redirect to next jsp page int i= ps.executeUpdate(); if(i!=0) { session.setAttribute("userid", user); response.sendRedirect("admin.jsp"); out.print("Welcome Admin page"); } else { response.sendRedirect("adminlogin.jsp"); }
answer count: 1
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22889598
has title: JSP redirects to another page instead of next page
score: -5
tagged with: java

http://stackoverflow.com/q/22861587
tagged with: spring
upvote count: 9
tagged with: java
has body: I am familiar with Spring AOP. As i read in the spring documentation http://docs.spring.io/spring/docs/3.1.x/spring-framework-reference/html/aop.html, Spring AOP works on the concept of proxies. In the section 8.2.3.1 Supported Pointcut Designators, i found the below note Due to the proxy-based nature of Spring's AOP framework, protected methods are by definition not intercepted, neither for JDK proxies (where this isn't applicable) nor for CGLIB proxies (where this is technically possible but not recommendable for AOP purposes). As a consequence, any given pointcut will be matched against public methods only! At first, I didn't believe it, so i tried to implement it without using interfaces where all methods are public by default and was surprised that the above is true. Since proxy classes are subclasses of the advised/target object and protected methods can be accessed by a subclass so I thought protected methods would work fine. Can someone please let me know why protected methods are not intercepted? Am I missing something?
score: 9
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22861714
downvote count: 0
has answer: http://stackoverflow.com/a/48564702
tagged with: protected
tagged with: proxy
tagged with: spring-aop
has title: Why protected methods are not intercepted by Spring AOP
favorite count: 0
has comment: http://stackoverflow.com/comment/34901263
type: UnansweredQuestion

http://stackoverflow.com/comment/34969242
type: Comment
score: 0
has text: So it is a desktop application and should have all the words stored locally and not on a remote server? Is the list of words static or do you want the user to be able to update the list of words?
type: AnswerComment
comment on: http://stackoverflow.com/a/22911944

libgdx
tags question: http://stackoverflow.com/q/22962590
tags question: http://stackoverflow.com/q/22958755
tags question: http://stackoverflow.com/q/22967823
tags question: http://stackoverflow.com/q/22857985
tags question: http://stackoverflow.com/q/22943644
tags question: http://stackoverflow.com/q/22851645
tags question: http://stackoverflow.com/q/22917478
tags question: http://stackoverflow.com/q/22907071
tags question: http://stackoverflow.com/q/22911113
tag name: libgdx
tags question: http://stackoverflow.com/q/22847844
tags question: http://stackoverflow.com/q/22825033
tags question: http://stackoverflow.com/q/22917020
tags question: http://stackoverflow.com/q/22949176
type: Tag
tags question: http://stackoverflow.com/q/22892251
tags question: http://stackoverflow.com/q/22833176
tags question: http://stackoverflow.com/q/22822767
tags question: http://stackoverflow.com/q/22824608
tags question: http://stackoverflow.com/q/22965120
tags question: http://stackoverflow.com/q/22837736
tags question: http://stackoverflow.com/q/22850673
tags question: http://stackoverflow.com/q/22944699
tags question: http://stackoverflow.com/q/22877837
tags question: http://stackoverflow.com/q/22859197
tags question: http://stackoverflow.com/q/22850460
tags question: http://stackoverflow.com/q/22850457
tags question: http://stackoverflow.com/q/22962080
tags question: http://stackoverflow.com/q/22934822
tags question: http://stackoverflow.com/q/22934386
tags question: http://stackoverflow.com/q/22889243
tags question: http://stackoverflow.com/q/22880384
tags question: http://stackoverflow.com/q/22929007
tags question: http://stackoverflow.com/q/22888152
tags question: http://stackoverflow.com/q/22936525
tags question: http://stackoverflow.com/q/22909448
tags question: http://stackoverflow.com/q/22827358
tags question: http://stackoverflow.com/q/22888154
tags question: http://stackoverflow.com/q/22897696
tags question: http://stackoverflow.com/q/22861360
tags question: http://stackoverflow.com/q/22889828
tags question: http://stackoverflow.com/q/22891758
tags question: http://stackoverflow.com/q/22845648

http://stackoverflow.com/q/22905866
has body: I have an ArrayList in Java: {"deleteItem", "createitem", "exportitem", "deleteItems", "createItems"} I want to move all string which contains delete to the end of the list, so I would get the next: {"createitem", "exportitem", "createItems", "deleteItem", "deleteItems"}` I can create two sublists - one for the words which contain the 'delete' word, and one for the others, and then merge them, but I search for a more efficient way.
accepted answer: http://stackoverflow.com/a/22906046
type: Question
has title: Move specific items to the end of a list
has answer: http://stackoverflow.com/a/22905945
tagged with: java
has answer: http://stackoverflow.com/a/22906046
tagged with: comparator
downvote count: 2
answer count: 3
favorite count: 0
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/22905959
upvote count: 10
has answer: http://stackoverflow.com/a/22905959
score: 8
has comment: http://stackoverflow.com/comment/34959001
type: AnsweredQuestion

email
tags question: http://stackoverflow.com/q/22965624
tags question: http://stackoverflow.com/q/22879543
tags question: http://stackoverflow.com/q/22860793
tags question: http://stackoverflow.com/q/22963026
tags question: http://stackoverflow.com/q/22890719
tags question: http://stackoverflow.com/q/22863510
tags question: http://stackoverflow.com/q/22859510
tags question: http://stackoverflow.com/q/22891275
tags question: http://stackoverflow.com/q/22890702
tags question: http://stackoverflow.com/q/22917106
tags question: http://stackoverflow.com/q/22905845
tags question: http://stackoverflow.com/q/22870628
tags question: http://stackoverflow.com/q/22903232
tags question: http://stackoverflow.com/q/22841632
tags question: http://stackoverflow.com/q/22923692
tags question: http://stackoverflow.com/q/22938748
type: Tag
tag name: email

http://stackoverflow.com/q/22888771
has answer: http://stackoverflow.com/a/22889475
favorite count: 0
has answer: http://stackoverflow.com/a/22888784
has comment: http://stackoverflow.com/comment/34928595
score: 2
upvote count: 2
has title: Call method from a panel at another class(the method) that terminats current panel
accepted answer: http://stackoverflow.com/a/22888788
tagged with: swing
type: Question
has body: i have three classes {FirstFrame, Login, Register} ... there is a method in FirstFrame to change between Logi and Register FirstFrame code : public class FirstFrame extends javax.swing.JFrame { public FirstFrame() { initComponents(); setLayout(new BorderLayout()); changeTo(Login.class); } public void changeTo(Class&lt;?&gt; c){ getContentPane().removeAll(); try { Object obj = c.newInstance(); getContentPane().add((Component) obj); pack(); setVisible(true); System.out.println("here"); } catch (InstantiationException ex) { Logger.getLogger(FirstFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(FirstFrame.class.getName()).log(Level.SEVERE, null, ex); } } } In Register I have a button that stores data then go back to Login(supposedly) It works great if I call from any button inside FirstFrame The question here is how do I call changeTo(Class&lt;?&gt; c) from inside Register?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22888788
possible better answer: http://stackoverflow.com/a/22888784
tagged with: jpanel
tagged with: methods
tagged with: class
answer count: 3
downvote count: 0

http://stackoverflow.com/q/22860114
has body: enviornment : application server - jboss 5.x, JPA : eclipse link database : oracle11g i configured a datastore with jndi as /TESTDS and want to access this jndi in persistence.xml but getting error. i used syntax as java:/TESTDS in persitence.xml....is this correct? My oracle-ds.xml as <?xml version="1.0" encoding="UTF-8"?> <datasources> /TESTDS oracle.jdbc.xa.client.OracleXADataSource <xa-datasource-property name="URL">jdbc:oracle:thin:@a.b.c.d:1521/sid</xa-datasource-property> <xa-datasource-property name="User">DBUSER</xa-datasource-property> <xa-datasource-property name="Password">DBPASSWORD</xa-datasource-property> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> Oracle11g and my persistence.xml <?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider java:/TESTDS <property name="eclipselink.target-server" value="JBoss"/> <property name="eclipselink.allow-zero-id" value="true"/> But getting error while deploying jar at jboss 5.x server.. Your help is much appreciated.. Error Message while deployment 00:51:03,830 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@1112048510{vfszip:/home/jboss/jboss-5.1.0.GA/server/default/deploy/test.jar/} 00:51:03,842 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@1112048510{vfszip:/home/jboss/jboss-5.1.0.GA/server/default/deploy/test.jar/} 00:51:03,860 INFO [JBossASKernel] Created KernelDeployment for: test.jar 00:51:03,861 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=test.jar,name=TestStatelessSessionBean,service=EJB3 00:51:03,861 INFO [JBossASKernel] with dependencies: 00:51:03,861 INFO [JBossASKernel] and demands: 00:51:03,861 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService 00:51:03,862 INFO [JBossASKernel] persistence.unit:unitName=#TestPU 00:51:03,862 INFO [JBossASKernel] and supplies: 00:51:03,862 INFO [JBossASKernel] jndi:TestStatelessSe…
has comment: http://stackoverflow.com/comment/34961481
answer count: 0
has title: JPA JNDI LOOKUP ERROR
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34962057
has comment: http://stackoverflow.com/comment/35143794
tagged with: jndi
tagged with: java
tagged with: jboss
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/34875328
score: 0
has comment: http://stackoverflow.com/comment/34877775
tagged with: eclipselink

http://stackoverflow.com/q/22922200
has comment: http://stackoverflow.com/comment/34988748
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/35067800
answer count: 0
tagged with: java
has body: I am trying to implement voice chat using java using sound API. it has a server which takes input voice from all clients and relays them back to all client. The problem is client who speaks can listen to his own voice. I found a solution which i am posting but it is not working. Is there a other way around? Thanks for the help in advance. public class Server { /*Server Code*/ public static void main(String[] args) throws Exception { ServerSocket serverSocket = new ServerSocket(7777); while(true){ Thread echoThread = new Thread( new ServerThread(serverSocket.accept())); echoThread.start(); } } } class ServerThread implements Runnable { public static Collection&lt;Socket&gt; sockets = new ArrayList&lt;Socket&gt;(); public static int portId; Socket connection = null; DataInputStream dataIn = null; DataOutputStream dataOut = null; public ServerThread(Socket conn) throws Exception { connection = conn; dataIn = new DataInputStream(connection.getInputStream()); dataOut = new DataOutputStream(connection.getOutputStream()); sockets.add(connection); } public void run() { int bytesRead = 0; byte[] inBytes = new byte[1]; while(bytesRead != -1) { try{ bytesRead = dataIn.read(inBytes, 0, inBytes.length); } catch (IOException e){ e.printStackTrace(); } if(bytesRead &gt;= 0) { sendToAll(connection, inBytes, bytesRead); } } //sockets.remove(connection); } public static void sendToAll(Socket connection, byte[] byteArray, int q) { Iterator&lt;Socket&gt; sockIt = sockets.iterator(); while(sockIt.hasNext()) { Socket temp = sockIt.next(); if(connection == temp){ continue; } DataOutputStream tempOut = null; try{ tempOut = new DataOutputStream(temp.getOutputStream()); } catch (IOException e1){ e1.printStackTrace(); } try{ tempOut.write(byteArray, 0, q); } catch (IOException e){e.printStackTrace();} } } } public class Client { /*Client Code*/ public static void main(String[] args) throws Exception { AudioFormat af = new AudioFormat(8000.0f,8,1,true,false); DataLine.Info info = new DataLine.…
has comment: http://stackoverflow.com/comment/34989128
type: Question
has comment: http://stackoverflow.com/comment/35047781
tagged with: chat
score: 0
tagged with: voice
has title: Java Voice chat filter out own voice

http://stackoverflow.com/comment/34974081
type: QuestionComment
type: Comment
has text: What is E value? And what do you think is the result of invoking `myString.getBytes("UTF-8")`?
comment on: http://stackoverflow.com/q/22912902
score: 0

http://stackoverflow.com/comment/34999498
comment on: http://stackoverflow.com/q/22928173
score: 0
has text: _"I can get the DOB from inner join.."_ I see you got something there. How you do it? maybe we can modify from it
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22835800
has answer: http://stackoverflow.com/a/22836004
answer count: 4
has answer: http://stackoverflow.com/a/22836223
tagged with: java
has answer: http://stackoverflow.com/a/22836005
has title: load config file (project.properties) at runtime via command prompt in java
type: Question
upvote count: 5
tagged with: properties-file
score: 5
downvote count: 0
tagged with: cmd
favorite count: 0
has body: I would like to load properties file via command prompt in java. Properties file name: project.properties java -classpath .;test.jar; com.project.Main What 'll be the command if I'll load the properties files via command prompt. Thank in advance. I have executed the below mentioned command on command prompt but not get any output. java -classpath .;test.jar; -DPROP_FILE="C:\Program Files\DemoApp\config\project.properties" com.project.Main
has answer: http://stackoverflow.com/a/22836021
type: UnansweredQuestion

http://stackoverflow.com/comment/35066658
type: Comment
has text: Please ping me with any questions/comments @GirlyGirl http://256.com/gray/email/
type: AnswerComment
comment on: http://stackoverflow.com/a/22965041
score: 1

http://stackoverflow.com/q/22902905
has title: Finding length of GenericArrayList parameter in Java
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34953561
answer count: 1
has body: As part of a homework assignement I am adding methods to a class for GenericArrayLists. Specifically I need to check the length of an ArrayList that is passed through my method. When I tried arrayINeedToCheck.length, it gives me an error because I have not defined that variable (arrayINeedToCheck). I don't know where I have erred but I hope you'll be able to steer me in the right direction. Here is my code: public void addAll(ArrayListGeneric&lt;E&gt; anotherList) { int s = (data.length - size); if (anotherList.length &gt; s) { E[] newData = (E[])(new Object[data.length+anotherList.length]); for (i = 0; i &lt; size; i++) newData[i] = data[i]; data = newData; } The anotherList.length is the problem. It says I haven't defined that variable. It's a parameter so I didn't think I'd need to define it again. Because its length and contents are variable, I can't just create a new, empty array list. Help me stackoverflow, you're my only hope.
tagged with: arraylist
tagged with: generic-list
score: 0
has comment: http://stackoverflow.com/comment/34953488
has answer: http://stackoverflow.com/a/22902938
type: UnansweredQuestion

http://stackoverflow.com/comment/35013828
score: 0
comment on: http://stackoverflow.com/q/22936149
type: Comment
type: QuestionComment
has text: I can think of no way to achieve this, despite some dubious sequence involving `collectionA.clone()` and `clonedCollection.clear()` ... Maybe someone else has an idea, though...

http://stackoverflow.com/comment/35006645
type: Comment
has text: Thanks. This could be a hint. But how can I optain the correct instance? I tryped to get both (model & metamodel) from the original resourceSetProvider: emfInjector.inject(hdlMetaModel, resourceSetProvider.get().getResource(URI.createURI("org.xtext.hal/model/generated/Hdl.ecore"), true)); Resource resource = resourceSetProvider.get().getResource(URI.createURI("hdlData.hdl"), true); but got no luck.
comment on: http://stackoverflow.com/a/22866694
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34982433
has text: @gSingh I don't understand what do you mean by your comment. If this map is created at user logging and its state can be modified on some requests done by this session (e.g. `map.put`, `map.remove`, etc.) then this instance should be synchronized.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22918985

http://stackoverflow.com/comment/35068944
comment on: http://stackoverflow.com/a/22967130
score: 0
type: Comment
has text: @FahadMurtaza This is the solution. If the replace is backwards, I'm sure you can figure out how to switch which character is replaced.
type: AnswerComment

http://stackoverflow.com/comment/35076664
score: 0
type: Comment
has text: Referenced answer has now been changed to superior algorithm suggested by גלעד ברקן in the comments.
comment on: http://stackoverflow.com/a/22952273
type: AnswerComment

http://stackoverflow.com/comment/34808148
has text: How did you even compile `Date date = 1995-03-07;` without getting a type mismatch error?
comment on: http://stackoverflow.com/q/22822307
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22944692
score: 0
type: Answer
has body: If you use Java 7, it is as easy as: // returns a List&lt;String&gt; with all lines in the file Files.readAllLines(thePath, StandardCharsets.UTF_8);
answers question: http://stackoverflow.com/q/22944511

http://stackoverflow.com/a/22822730
answers question: http://stackoverflow.com/q/22822307
score: 0
has body: Java does not support Date literals. You need to use a constructor or a static factory method to obtain an instance of this class. 1995-03-07 returns 1985 because you have three int literals here and the hyphens are interpreted as subtraction operators. Take a look at the documentation for the Date class and the DateFormat class Here's a way you could represent these values: SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = dateFormat.parse("1995-03-07"); SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); Date time = timeFormat.parse("03:46:16"); You can use the same format objects to perform the reverse of this conversion. Please mind that these Date instances represent a specific moment in time, down to millisecond level. Internally, this is represented as the number of milliseconds since January 1, 1970, 00:00:00 GMT This API is hardly the prettiest one in Java and by looking at the docs you can see how many changes it has undergone. Just look at the number of deprecated methods. I recommend taking a look at the Joda-Time library instead. Alternatively, if using Java 8 is an option for you, you can try the brand new API that comes with it
type: Answer

http://stackoverflow.com/q/22875993
has answer: http://stackoverflow.com/a/22876049
upvote count: 7
downvote count: 1
has title: Whats the difference between List<String> stringList = new ArrayList<String>() and List<String> stringList = new ArrayList()?
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/22876013
score: 6
has answer: http://stackoverflow.com/a/58145648
has body: I know that both of the following declaration and initialization are possible in java . List&lt;String&gt; stringList = new ArrayList&lt;String&gt;() List&lt;String&gt; stringList = new ArrayList()? But what exactly are the differences between them? Also how do you prefer to name the list variables? As in do you prefer to name them variableList or just variables? Or do you have any other approach?
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22876016
has answer: http://stackoverflow.com/a/22876013
tagged with: arraylist
has answer: http://stackoverflow.com/a/22876016

http://stackoverflow.com/comment/34910145
score: 0
type: QuestionComment
has text: Yea, I can always leave it like that but I want to request if there are better ways of handling this kind of scenario
comment on: http://stackoverflow.com/q/22878922
type: Comment

http://stackoverflow.com/q/22922912
tagged with: javascript
score: 0
tagged with: dart
answer count: 1
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: web-applications
has answer: http://stackoverflow.com/a/22923671
tagged with: java
has title: Serving dart web app from Google app engine
type: Question
has body: I am building the front end of a webapp in dart. How can I serve this dart app (as dart and/or javascript) from a Java Google app engine app? I have gotten as far is "Pub build" in the dart editor to generate .css, .html, and .dart.js files. I am just not sure what do with them. I have tried copying them into the war/ folder of the GAE app and and adding the .html to the welcome-list. The html will serve but the app itself does not work. Here are the errors I get in chrome when visiting the app engine instance: Failed to load resource: the server responded with a status of 404 (Not Found) http://1-dot-my-app-name.appspot.com/myapp_dart.dart Uncaught ReferenceError: DartObject is not defined myapp_dart.dart.js:1741 Thanks

http://stackoverflow.com/comment/65826908
type: Comment
comment on: http://stackoverflow.com/q/22812381
score: 1
has text: @RonanDejhero I added the answer I reached, have a look at it.
type: QuestionComment

http://stackoverflow.com/comment/34939299
has text: If your method needs an instance of the class, you won't be able to use it if you can't get an instance of the class.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22895235
type: QuestionComment

http://stackoverflow.com/comment/34798161
has text: Shouldn't `final Main mainframe = new Main();` be `final GUI mainframe = new GUI();` and then I can skip the `new GUI().setVisible(true);` above all together? Shouldn't I just make an object `final GUI mainframe = new GUI();` and then call `mainframe.setVisible(true);` and `mainframe.showWarning();`
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22816002

http://stackoverflow.com/a/22961757
has body: Sonar is not smart enough to know if an object is mutable or not. Especially if you're returning a List, it can't tell if what you're actually returning is an ArrayList, an ImmutableList or an unmodifiable list. So it doesn't emit any warning to avoid flooding you with false positives. Arrays and Date, on the other hand, are well-known standard classes that are mutable, and for which it can safely emist this warning.
accepted answer of: http://stackoverflow.com/q/22961137
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/38981013
answers question: http://stackoverflow.com/q/22961137

http://stackoverflow.com/comment/118092430
type: Comment
has text: @Thirumal, no but you can use `MixIn`.
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/22906823

http://stackoverflow.com/comment/35780531
score: 0
type: AnswerComment
type: Comment
has text: im searchin for another answer but your answer seems useful for me thanx alex
comment on: http://stackoverflow.com/a/23342288

http://stackoverflow.com/a/22840179
has body: You must use synchronized block or synchronized method to perform above task. Note, that Session is not a thread-safe object, but if you're sure it won't have problems with concurrency, what you need is just to use TransactionSynchronizationUtils to bind a session to the thread resources and then unbind it when desired
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34841879
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22838013

http://stackoverflow.com/q/22913193
tagged with: multithreading
type: Question
tagged with: instantiationexception
has answer: http://stackoverflow.com/a/22913349
accepted answer: http://stackoverflow.com/a/22913349
score: 0
linked to: http://stackoverflow.com/q/5161951
has title: Android invoke a Function via Thread in other Class java.lang.InstantiationException: can't instantiate class … no empty constructor
answer count: 1
has comment: http://stackoverflow.com/comment/34971660
has body: I have an Activity Class Anmeldung, a normal java class thread_haupt.class and a Activity funktionen_haupt.class. on Start of Anmeldung.class starts a function(funktionstarter) of threads_haupt.class This calls a function from functionen_haupt.class via invoke. The idea is to have a function that can start other functions also from other classes the problem is java.lang.InstantiationException: can't instantiate class … no empty constructor in my thread_haupt.class when I try to newInstance() (see below in thread_haupt.class) java.lang.InstantiationException: can't instantiate class … no empty constructor Anmeldung.Class public class anmeldung extends Activity implements OnClickListener{ @Override protected void onStart() { // start ist dann aufgerufen wenn alles gebaut ist // TODO Auto-generated method stub meine_funktionen.buttons_vorbereiten(this); /** * hier wirde zuerst der spinner befüllt */ thread_haupt meinThread = new thread_haupt(); //HOMEPAGE,naj.nuz.wz.wa.dc.kommunikation.allgemein kommunikation,naj.nuz.wz.wa.dc.drinkcoffee.helfer.allgemein helfer, Activity meineAct}; meinThread.meine_parameter= new Object[] {HOMEPAGE,kommunikation,helfer,meineAct}; meinThread.meine_funktion="staedte_abfragen"; meinThread.mein_context=this.getApplicationContext(); meinThread.meine_activity=this; meinThread.thread_starten("staedte_abfragen"); // HERE !!! threads.class public class thread_haupt { public Object[] meine_parameter; public String meine_funktion; public Object mein_context; public Activity meine_activity; public allgemein mein_helfer = new allgemein(); public funktionen_haupt meine_funktionen = new funktionen_haupt((Context) mein_context, meine_activity); /** * hier sollen die threads gestartet werden * @param threadName */ public void thread_starten(String threadName){ switch (threadName) { case "staedte_abfragen": //Thread thread = new Thread(new Runnable(){ //hier hab ich das gefunden http://stackoverflow.com/questions/5161951/android-only-the-original-thread…
tagged with: android
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22840293
accepted answer: http://stackoverflow.com/a/22901437
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: google-app-engine
tagged with: sax
tagged with: google-cloud-endpoints
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has title: How to read XML file? Google App Engine Endpoints
type: Question
has answer: http://stackoverflow.com/a/22901437
downvote count: 0
has body: I got: wordsDictionary.xml in: /WEB-INF/xml/ and I'm trying to read it with SAXReader using code: ... SAXParserFactory saxFactory = SAXParserFactory.newInstance(); saxFactory.setValidating(false); saxFactory.setNamespaceAware(false); XMLReader reader = saxFactory.getXMLReader(); reader.setContentHandler(new WordsDictionarySAXHandler(this,lettersMapping)); reader.parse(new InputSource("/WEB-INF/xml/wordsDictionary.xml")); ... On Dev server everything goes fine. When deploying it to production I'm getting an error: com.google.api.server.spi.SystemService invokeServiceMethod: access denied ("java.io.FilePermission" "/WEB-INF/xml/wordsDictionary.xml" "read") java.security.AccessControlException: access denied ("java.io.FilePermission" "/WEBINF/xml/wordsDictionary.xml" "read") Before you say that I need to use: context.getResourceAsStream you need to know I'm using Google Endpoints. So I don't have access to any directly Servlet (nothing is passed to endpoint method - HttpRequest). My question is: Do you know how to load xml file right on GAE Endpoints? EDIT: Just read https://developers.google.com/appengine/kb/java?csw=1#readfile: If the file location is not the issue, the problem may be that the method you are using to read from the file is not whitelisted. Your application can use any IO classes that are useful for reading from the file system, such as File, FileInputStream, FileReader, or RandomAccessFile. For a full list of whitelisted classes, please see the JRE Class White List. I've changed part of code to: FileInputStream stream = new FileInputStream("/WEB-INF/xml/wordsDictionary.xml"); reader.parse(new InputSource(new InputStreamReader(stream))); Unfortunately, nothing changed.
answer count: 1

http://stackoverflow.com/q/22898260
answer count: 1
tagged with: minecraft
accepted answer: http://stackoverflow.com/a/22898282
type: AnsweredQuestion
has title: Craftbukkit Player Count Message Plugin Coding Error
has body: I am making a Craftbukkit plugin that has a message in the player count list, Like HIVEmc or Omega Realm. I am coding in Ecplise and using ProtocolLib v3.2.0 and Craftbukkit 1.7.2 R0.3. I am new to java and don't understand it much. SO FAR... Here is my code and the error public void onEnable() { saveConfig(); if(!new File(getDataFolder(),"RESET.FILE").exists()){ try { getConfig().set("Message", Arrays.asList("First Line","Second Line")); new File(getDataFolder(),"RESET.FILE").createNewFile(); } catch (IOException e) { e.printStackTrace(); } } } ERROR: The method asList(T[]) in the type Arrays is not applicable for the arguments (String, String) http://tinypic.com/r/n6yond/8
type: Question
has answer: http://stackoverflow.com/a/22898282
tagged with: java
tagged with: bukkit
tagged with: eclipse
score: 0

http://stackoverflow.com/q/22873419
type: AnsweredQuestion
has body: I am getting following exceptions when I run Junit test. org.mockito.exceptions.misusing.MissingMethodInvocationException: when() requires an argument which has to be 'a method call on a mock'. For example: when(mock.getArticles()).thenReturn(articles); Also, this error might show up because: you stub either of: final/private/equals()/hashCode() methods. Those methods cannot be stubbed/verified. inside when() you don't call method on mock but on some other object. the parent of the mocked class is not public. It is a limitation of the mock engine. Following is my code and the exception was thrown at the second when statement. I don't think that my test code didn't violate what the exception claims. I spent for a while, but couldn't figure out. Could someone help? What I need to test is getPermProducts method. In the getPermProducts method, I want to ignore isTempProduct method. So, when p1 came, I want it returns false, and when p2 came, I want it returns true etc.. @Named(ProductManager.NAME) public class ProductManager { @Resource(name = ProductService.NAME) private ProductService productService; public List&lt;Product&gt; getPermProducts(Set&lt;Product&gt; products) { Iterator&lt;Product&gt; it = products.iterator(); List&lt;Product&gt; cProducts = new ArrayList&lt;Product&gt;(); Product p; while (it.hasNext()) { p = it.next(); if (!isTempProduct(p)) { cProducts.add(p); } } return cProducts; } public Boolean isTempProduct(Product product) { if (product instanceof PermProduct) { return false; } Set&lt;ProductItems&gt; pItems = product.getProductItems(); if (pItems.isEmpty()) { return false; } Iterator&lt;ProductItem&gt; itr = pItems.iterator(); while (itr.hasNext()) { if (itr.next() instanceof TempItem) { return true; } } return false; } public Product getProduct(Integer productId) { Product p = productService.getProduct(productId); return p; } } @RunWith(MockitoJUnitRunner.class) public class ProductManagerTest { @InjectMocks private ProductManager mockProductMan…
type: Question
tagged with: junit4
tagged with: java
upvote count: 6
score: 5
has title: org.mockito.exceptions.misusing.MissingMethodInvocationException
has answer: http://stackoverflow.com/a/22873465
accepted answer: http://stackoverflow.com/a/22873465
tagged with: mockito
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/a/22890138
type: Answer
has comment: http://stackoverflow.com/comment/34930414
score: 1
has comment: http://stackoverflow.com/comment/34930580
upvote count: 1
has comment: http://stackoverflow.com/comment/34930558
downvote count: 0
has comment: http://stackoverflow.com/comment/34930486
has body: Here is a solution using look-aheads. String input = "[9][1][1][ ][ ][ ][ ][ ][ ][9][a][b][ ][ ]"; // Map of color codes. HashMap&lt;String,String&gt; colorMap; String output = input.replaceAll("(?&lt;=\\[)\\S*?(?=\\])","x"); Based on your comment on devnull's answer, it sounds like you actually want a mapped replacement: String input = "[9][1][1][ ][ ][ ][ ][ ][ ][9][a][b][ ][ ]"; // Map of color codes. for (int i = 0; i &lt; 16; i++) { String current = Integer.toString(i, 16); input = input.replaceAll("(?&lt;=\\[)" + current + "(?=\\])",getColor(current)); } System.out.println(input); Note that this solution assumes that ChatColor has a reasonable toString method.
answers question: http://stackoverflow.com/q/22890046
has comment: http://stackoverflow.com/comment/34930476

http://stackoverflow.com/q/22958070
tagged with: java
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/22965531
score: 0
tagged with: spring
tagged with: design-patterns
has answer: http://stackoverflow.com/a/22965531
has body: I have two different projects. One is a big spring mvc web application. And another is simple web service based on the spring too. Both projects have in dependencies third project that contains entities and dao layer classes. And now I need some logic from the first project (web app) to use in the second one (ws). So I transferred service and some of business logic from the first project to third. I didn't transferred DTO classes and some specific spring things like classes that work with spring security. Therefore my business classes multiples. Now I have about 20 classes in third project (like "UserService") and 15 classes (like "UserDtoService") in first project. It's rather hard to control all this stuff and find functions that I need. What should I do in this situation? Is it time to combine projects in one? Or just return service classes back and duplicate code in project two?
has title: How to design services in 2 different java-spring projects
type: AnsweredQuestion

http://stackoverflow.com/comment/34820477
type: AnswerComment
has text: I think `[a-zA-Zа-яА-Я]` more understandable write.
type: Comment
comment on: http://stackoverflow.com/a/22813273
score: 0

http://stackoverflow.com/comment/34996757
type: AnswerComment
has text: I did go a little crazy with the statics, I was experimenting a little. Thanks for your support, its easy to forget little things like that when starting out.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22924348

http://stackoverflow.com/comment/34829761
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22830016
has text: Do you need to save the results after you exit the application?
score: 0

http://stackoverflow.com/comment/34861032
comment on: http://stackoverflow.com/q/22851291
type: QuestionComment
score: 0
has text: Can you also show how you've attempted to solve the problem so far, and indicate what trouble you're having with your current solution? The problem is, the way the question is written thus far, any answer would essentially be doing your work done for you, and we'd be robbing you of the chance to learn yourself.
type: Comment

smack
tags question: http://stackoverflow.com/q/22953528
type: Tag
tag name: smack

http://stackoverflow.com/q/22845954
has title: Draw on Camera Preview
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/2687015
has comment: http://stackoverflow.com/comment/34850677
score: 0
has body: So, question is very simple and asked many times before. But how to make this code working? This example was posted here Extended SurfaceView&#39;s onDraw() method never called and the answer was given: setWillNotDraw(false) by Gab Royer. Thanks in advance. class CameraPreviewView extends SurfaceView { protected final Paint rectanglePaint = new Paint(); public CameraPreviewView(Context context, AttributeSet attrs) { super(context, attrs); rectanglePaint.setARGB(255, 200, 0, 0); rectanglePaint.setStyle(Paint.Style.FILL); rectanglePaint.setStrokeWidth(2); } @Override protected void onDraw(Canvas canvas){ canvas.drawRect(new Rect(10,10,200,200), rectanglePaint); Log.w(this.getClass().getName(), "On Draw Called"); } } public class CameraPreview extends Activity implements SurfaceHolder.Callback{ private SurfaceHolder holder; private Camera camera; @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); // We remove the status bar, title bar and make the application fullscreen requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // We set the content view to be the layout we made setContentView(R.layout.camera_preview); // We register the activity to handle the callbacks of the SurfaceView CameraPreviewView surfaceView = (CameraPreviewView) findViewById(R.id.camera_surface); holder = surfaceView.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Camera.Parameters params = camera.getParameters(); params.setPreviewSize(width, height); camera.setParameters(params); try { camera.setPreviewDisplay(holder); } catch (IOException e) { e.printStackTrace(); } camera.startPreview(); } public void surfaceCreated(SurfaceHolder holder) { camera = Camera.open(); } public void surfaceDestroyed(SurfaceHolder holde…
has comment: http://stackoverflow.com/comment/34850199
type: UnansweredQuestion
tagged with: android
answer count: 0
has comment: http://stackoverflow.com/comment/34850793

http://stackoverflow.com/comment/35007726
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22863436
type: Comment
has text: Where ever you use the database connection, make sure you get it with your `getConnection()` method. Every single time.

http://stackoverflow.com/comment/34882643
type: Comment
comment on: http://stackoverflow.com/a/22862982
has text: Yep. The string "Test" I explicitly gave to textView.setText did not appear. I also coded a pre-statement in the xml file to check that the textview object was visible. The object appears and is not executing the setText method... strange. It's definitely grabbing from fragment_home and the proper id "textViewHome". Is there any way the pointer for the textview variable switches object?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35045499
type: QuestionComment
has text: Is it possible to use a COM library in Mac OS? Maybe you should try using the REST API of Quality Center (if you use QC11).
comment on: http://stackoverflow.com/q/22940825
score: 0
type: Comment

drools
tags question: http://stackoverflow.com/q/22834231
type: Tag
tag name: drools
tags question: http://stackoverflow.com/q/22963339

http://stackoverflow.com/comment/34918420
comment on: http://stackoverflow.com/q/22882338
score: 0
type: Comment
has text: The important thing here is the ClassCastException, not that warning. Look at my answer for more details (http://stackoverflow.com/questions/22882338/how-to-write-a-public-class-myliste/22883431#22883431)
type: QuestionComment

http://stackoverflow.com/comment/34813051
score: 0
has text: @Adam I've placed a response to your question in the answer; since it was too long for a comment.
type: Comment
comment on: http://stackoverflow.com/a/22824611
type: AnswerComment

http://stackoverflow.com/q/22819832
tagged with: jdbc
type: AnsweredQuestion
tagged with: java
has title: Changing where clause criteria based on some condition
type: Question
has answer: http://stackoverflow.com/a/22820040
score: 0
tagged with: sql
answer count: 1
accepted answer: http://stackoverflow.com/a/22820040
has body: Task I am trying to achieve: I have a query whose where clause condition is to be updated dynamically based on one condition keeping it in a normal programming language below is what I am trying to achieve considering "name" is a column on which I am checking the condition If(name==""){ select * from infodata where col1='somevalue' and col2='somevalue' } else if(name=="2"){ select * from infodata where col3='somevalue' or col4='somevalue' } else { select * from infodata where col2='somevalue' and col5='somevalue' } based on that value I need to assign different where conditions. (I am using Oracle as the DB) Currently I am achieving this is by writing the conditions in the Java code to assign respective where condition to the query what i am looking for is a way to do it in a sql query so that i can pass the required data in the prepared statement. Just wanted to know is this can be possible using single SQL query or not, if possible could you please provide an example or syntax how to achieve this. Thanks.
tagged with: oracle-database

http://stackoverflow.com/a/22876613
has comment: http://stackoverflow.com/comment/34915084
has comment: http://stackoverflow.com/comment/34924342
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34914681
has body: I like @Radiodef's answer, but it is missing something: getDeclaredClass only returns the methods declared in the Class itself, not in its superclasses. Since superclass methods are typically also considered methods of the class, you need to search through them too. Second, you when you specify a return type, you typically want to find a method that returns something that you can assign to that return type, not the exact return type. In Java, it is legal for a method that overrides a superclass method, to return a subclass of return type of the superclass. I.e. the superclass has Number myNumber(), then the subclass may have @Override Integer myNumber(). If you take that into account as well, you arrive at this code: public static Method findMethod(Class&lt;?&gt; returnType, Collection&lt;? extends Class&lt;?&gt;&gt; containingClasses, String functionName, Class&lt;?&gt;[] parameters) { for (Class&lt;?&gt; containingClass : containingClasses) { Method m = findMethodInClass(returnType, containingClass, functionName, parameters); if (m != null) return m; } return null; } private static Method findMethodInClass(Class&lt;?&gt; returnType, Class&lt;?&gt; containingClass, String functionName, Class&lt;?&gt;[] parameters) { for (Method m : containingClass.getDeclaredMethods()) { if (checkMethod(m, returnType, functionName, parameters)) return m; } if (containingClass.getSuperclass() != null) return findMethodInClass(returnType, containingClass.getSuperclass(), functionName, parameters); else return null; } private static boolean checkMethod(Method method, Class&lt;?&gt; returnType, String functionName, Class&lt;?&gt;[] parameters) { if (!method.getName().equals(functionName)) return false; // Also allow overridden classes that return a subtype of the requested type if (!returnType.isAssignableFrom(method.getReturnType())) return false; Class&lt;?&gt;[] actualParameters = method.getParameterTypes(); if (actualParameters.length != parameters.length) return false; for (int i …
answers question: http://stackoverflow.com/q/22876120

http://stackoverflow.com/q/22826038
has comment: http://stackoverflow.com/comment/34814930
answer count: 0
tagged with: java
has title: error: cannot find symbol purchase
upvote count: 1
type: Question
has body: Here is my code: import java.util.Scanner; class CreatePurchase { public static void main(String args[]) { Purchase purchase=new Purchase(); Scanner s=new Scanner(System.in); System.out.println("Enter the details: "); while(true) { System.out.print("Enter invoice number[between 1000 and 8000]: "); int i=s.nextInt(); if(i&gt;=1000 &amp;&amp; i&lt;=8000){purchase.setInvoiceNumber(i);break;} else System.out.println("Wrong entry,enter again"); } while(true) { System.out.print("Enter amount of purchase[should be non-negative]: "); int i=s.nextInt(); if(i&gt;=0){purchase.setAmountOfSales(i);break;} else System.out.println("Wrong entry,enter again"); } purchase.display(); } } This is the exact error messages I keep getting: C:\Users\Kenneth\Documents\NetBeansProjects\CreatePurchase\src\createpurchase \CreatePurchase.java:9: error: cannot find symbol Purchase purchase=new Purchase(); symbol: class Purchase location: class CreatePurchase C:\Users\Kenneth\Documents\NetBeansProjects\CreatePurchase\src\createpurchase\CreatePurchase.java:9: error: cannot find symbol Purchase purchase=new Purchase(); symbol: class Purchase location: class CreatePurchase 2 errors I have no idea how to fix it and netbeans is not showing anything wrong with the code. Help is appreciated. Here is the Purchase code, which compiled and ran fine. class Purchase { int invoiceNumber; int amountOfSales; double amountOfSalesTax; static double rate=7.5; public void setInvoiceNumber(int i) { invoiceNumber=i; } public void setAmountOfSales(int a) { amountOfSales=a; amountOfSalesTax=(7.5*a)/100; } public void display() { System.out.println("The deatils are:"); System.out.println("Invoice Number: "+invoiceNumber); System.out.println("Amount of Sales: "+amountOfSales); System.out.println("Amount of sales tax: "+amountOfSalesTax); } }
has comment: http://stackoverflow.com/comment/34814608
has comment: http://stackoverflow.com/comment/34814681
downvote count: 0
score: 1
favorite count: 0
tagged with: netbeans-8
tagged with: netbeans
type: UnansweredQuestion

http://stackoverflow.com/comment/34952972
type: Comment
has text: @user3284325 as @Jake said, your second for loop goes from 0 to 1 less than the length of `samples`, which is clearly wrong. That's what's giving you the out of bounds exception.
comment on: http://stackoverflow.com/q/22902594
score: 0
type: QuestionComment

http://stackoverflow.com/a/22922769
answers question: http://stackoverflow.com/q/22922628
type: Answer
has comment: http://stackoverflow.com/comment/34990331
score: 0
type: AcceptedAnswer
has body: If you're writing and reading bytes you probably just want to use a DataOutputStream and DataInputStream The way you separate the different byte arrays is by knowing the number of bytes and the order they appear in the file.
has comment: http://stackoverflow.com/comment/34990058
accepted answer of: http://stackoverflow.com/q/22922628

http://stackoverflow.com/comment/34894993
comment on: http://stackoverflow.com/a/22870058
score: 0
type: AnswerComment
type: Comment
has text: i added org.springframework.expression-3.0.5.RELEASE.jar in my classpath. But again i am getting another error...

http://stackoverflow.com/comment/34930512
comment on: http://stackoverflow.com/a/22876540
has text: SQLite looks good and I've run into it a number of times. Can you give me super-dummy instructions for creating a database? Once I have the file created, I can connect to it via IntelliJ's GUI and add my sample contents.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34885265
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22865406
has text: Consider using arrays instead of `button1`, `button2`, `button3`, ... This will be more fun to maintain!
type: Comment

http://stackoverflow.com/q/22879001
favorite count: 0
has comment: http://stackoverflow.com/comment/34910466
tagged with: io
has title: IO vs Database: Which is faster?
has comment: http://stackoverflow.com/comment/34910228
has answer: http://stackoverflow.com/a/22879380
upvote count: 2
type: UnansweredQuestion
score: 1
downvote count: 1
type: Question
tagged with: performance
tagged with: java
has body: Imagine I have 1GB sized txt file. In my Java program, I am reading this "line by line" using BufferedReader. Imagine I also have a MySQL database which includes each line of the 1GB file as a new row. I am reading this "row by row" inside my Java program. Now, which operation is faster in this situation, reading the file or Database? Why?
tagged with: mysql
has comment: http://stackoverflow.com/comment/34910584
linked to: http://stackoverflow.com/q/17141142
duplicate of: http://stackoverflow.com/q/17141142
answer count: 1
tagged with: bufferedreader

http://stackoverflow.com/comment/34847014
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22816204
has text: Thanks for your help, but I have a question. How do you make it so the timer is restartable. Because it says task is already scheduled or cancelled. The timer can't be reset for another use or paused then carried on. Thanks
score: 0

http://stackoverflow.com/comment/34841660
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22841306
type: Comment
has text: What does your json look like? What does your pojo look like?

http://stackoverflow.com/comment/35065983
comment on: http://stackoverflow.com/q/22964985
type: Comment
type: QuestionComment
has text: Not necessarily. You can try finding the entity to determine whether it was removed. If it was removed and you want to store it again, saveOrUpdate should work. If the entity has been changed, you can merge the changes from your instance into the found instance and then save it.
score: 0

http://stackoverflow.com/comment/34995941
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22926220
has text: No! `"null"` does not == `null`, not even close. If the user enters null, then they're entering the String, `"null"`, and that is what I guess you should check. But that has nothing to do with a null variable, which is an unassigned variable.
score: 0

http://stackoverflow.com/comment/34960620
type: Comment
type: QuestionComment
has text: even without values, there supposed to be `=` symbol at the end, I guess
score: 0
comment on: http://stackoverflow.com/q/22906966

http://stackoverflow.com/comment/35057019
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22960874
has text: if its all maven project then, `Childern2` would have its own `pom.xml` right? You can directly invoke that pom to build just `Children2`. what is the issue in that?

http://stackoverflow.com/comment/34982782
comment on: http://stackoverflow.com/q/22919207
has text: Which line is the 192th line in `MainActivity.java` class?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34789438
has text: is your date in String format
comment on: http://stackoverflow.com/q/22812349
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22889143
has body: The OAuth specification does not define an expiration time for request tokens, it just recommends that it have a limited lifetime. If the implementation sets an expiration time, you can't keep it from expiring, you'll have to request a new token.
has comment: http://stackoverflow.com/comment/34930994
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22878917
upvote count: 1

http://stackoverflow.com/a/30585692
score: 1
answers question: http://stackoverflow.com/q/22915883
has body: This is occuring because log4j is being bootstrapped before Spring. The following answer may help with providing a possible solution for the issue: log4j - Accessing spring bean from logging appender class - Stack Overflow
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22915883

http://stackoverflow.com/q/22911611
tagged with: jdialog
linked to: http://stackoverflow.com/q/12448947
has title: Resetting countdown timer not working + JDialog/JOptionPane in Java Swing game
has comment: http://stackoverflow.com/comment/34968730
answer count: 1
accepted answer: http://stackoverflow.com/a/22912575
favorite count: 0
tagged with: timer
tagged with: swing
tagged with: joptionpane
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: I'm not that good with Java Swing and I'm trying to use a timer start the game with a delay in 3 seconds But at the same time I want to show a dialog (also the game has to wait 3 seconds so the focus needs to be on the dialog) So my dialog is as follow: got this sample code So in my gameplay panel I do this: public class GamePlayPanel extends JPanel implements ActionListener { // attributes private JOptionCountDownTimer countDownDialog; public GamePlayPanel(MainWindow mainWindow) { // initialization attributes initLayoutPanel(); this.timer = new Timer(DELAY, this); // Added a delay of 3 seconds so you can prepare to for the game this.timer.setInitialDelay(3000); resetTime(); } public void startGame() { this.gamePanel.requestFocus(); this.countDownDialog.startCountDown(); startTimer(); // this is my game timer to record the game time } public void restartGame() { this.countDownDialog.resetCountDown(); startTimer(); this.gamePanel.requestFocus(); } } It works fine but if I restart the game the count down timer starts at 0 -> 2 seconds. Also any better ideas on my class JOptionCountDownTimer? I tried to make it extend a JDialog class but I couldn't get it to work.
type: Question
has comment: http://stackoverflow.com/comment/34969036
has answer: http://stackoverflow.com/a/22912575
has comment: http://stackoverflow.com/comment/34968764
has comment: http://stackoverflow.com/comment/34969674
downvote count: 0

http://stackoverflow.com/comment/34862860
has text: ok. Should I run the runnable? Or start a Thread. Isn't runnable interface designed specifically to be used with a thread?
comment on: http://stackoverflow.com/q/22852770
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34908962
has text: I'll try my best to update my answer, but it would be helpful if you posted your `BoxAdapter` code.
type: AnswerComment
comment on: http://stackoverflow.com/a/22878157
type: Comment
score: 1

http://stackoverflow.com/comment/34794400
comment on: http://stackoverflow.com/q/22814828
score: 0
type: Comment
type: QuestionComment
has text: What exactly do you call "user country"? The SIM card might be created/bought in a foreign country, user might be travelling at some moment.

http://stackoverflow.com/a/22929150
has body: Well, there is no static method named equals() and taking 2 arguments in your TestNew class. That's what the compiler tells you. To be able to call a method, the method must exist.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22928870
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22928870
has comment: http://stackoverflow.com/comment/35001129
has comment: http://stackoverflow.com/comment/35001219
type: Answer

http://stackoverflow.com/q/22882430
possible better answer: http://stackoverflow.com/a/22884723
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34920382
tagged with: java
has comment: http://stackoverflow.com/comment/34920506
tagged with: filestream
type: Question
has comment: http://stackoverflow.com/comment/34936719
has comment: http://stackoverflow.com/comment/34924285
has comment: http://stackoverflow.com/comment/34918490
has answer: http://stackoverflow.com/a/22884723
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34930371
has body: So I have been working with sockets a bit in the past few days, and tried to make a basic program to transfer files. The files do transfer, but they are incomplete. Like, when I try to send a 500kB file, the receiver only gets a 480kB one. I searched for quite a while but I just cant find the error. I found on some similar errors that the streams werent closed, but mine is, and it still doesnt send properly. Sender: //Main //... in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new PrintWriter(socket.getOutputStream(), true); //... public void sendFile(File file) { try { buffer = new byte[(int) file.length()]; DataInputStream filestream = new DataInputStream(new FileInputStream(file)); filestream.readFully(buffer); DataOutputStream outStream = new DataOutputStream(socket.getOutputStream()); send("FILE_"+file.length()+"_\t"+file.getName()); outStream.write(buffer); outStream.flush(); filestream.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public void send(String data) { out.println(data); } Receiver: DataInputStream inStream = new DataInputStream(client.getInputStream()); File file = new File("temp"+"\\"+expectedFile); file.createNewFile(); BufferedOutputStream fileOut = new BufferedOutputStream(new FileOutputStream(file, false)); buffer = new byte[1024]; while (size &gt; 0 &amp;&amp; (receivedBytes = inStream.read(buffer, 0, (int)Math.min(buffer.length, size))) != -1) { fileOut.write(buffer, 0, receivedBytes); fileOut.flush(); size -= receivedBytes; } fileOut.close(); Thanks for any kind of help :)
tagged with: file-transfer
has comment: http://stackoverflow.com/comment/34918369
has comment: http://stackoverflow.com/comment/34918457
has comment: http://stackoverflow.com/comment/34922553
has answer: http://stackoverflow.com/a/22882770
has comment: http://stackoverflow.com/comment/34922578
accepted answer: http://stackoverflow.com/a/22882770
has title: Java file transfer - Incomplete files
has comment: http://stackoverflow.com/comment/34920648
tagged with: sockets
has comment: http://stackoverflow.com/comment/34920386
has comment: http://stackoverflow.com/comment/34922296
has comment: http://stackoverflow.com/comment/34920246

http://stackoverflow.com/a/22833612
downvote count: 0
has comment: http://stackoverflow.com/comment/36451797
answers question: http://stackoverflow.com/q/22833338
accepted answer of: http://stackoverflow.com/q/22833338
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: The problem is that what you do in command line is executing shell command which redirects input and output from/to a file. On the other hand java run/debug does not execute shell command but runs selected class with passed arguments. And what you do is that you pass it single argument &lt;input.txt&gt;output.txt. But it does not redirect anything. What you can do is to modify your class that it accepts arguments - files to read / or write to. I have found one IntelliJ plugin that adds new debug configuration where it is possible to specify file to redirect input. But it is only one half of your request.
score: 2

http://stackoverflow.com/a/22821970
upvote count: 2
has comment: http://stackoverflow.com/comment/34823046
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34822674
downvote count: 0
has comment: http://stackoverflow.com/comment/34843501
has comment: http://stackoverflow.com/comment/34845226
has comment: http://stackoverflow.com/comment/34843008
has body: The bundle-version value for the plugin in the Require-Bundle entry in the plugin MANIFEST.MF determines the version of the dependency that is required. You have: org.eclipse.core.expressions;bundle-version="3.4.500" which is saying that your plugin requires at least version 3.4.500 of the expressions plugin. Change the version to 3.4.401 to work with Juno.
answers question: http://stackoverflow.com/q/22821415

http://stackoverflow.com/a/22882028
answers question: http://stackoverflow.com/q/22881660
downvote count: 0
score: 1
upvote count: 1
has body: readLine() will read up to a linefeed, but not include the linefeed. Also, there is no reason to use a string builder here. Change to this: String result = ""; String line; try { br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { result += line + "\n"; } } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } return result;
type: Answer

http://stackoverflow.com/q/22860616
answer count: 2
upvote count: 1
downvote count: 0
tagged with: jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/22860779
has answer: http://stackoverflow.com/a/22886821
accepted answer: http://stackoverflow.com/a/22886821
has title: It is possible to send more than one type of object from JSP to Spring Controller?
has body: I'm coding a JSP view that has to send multiple objects to a Spring @Controller once submitted. The controller's handler has the following signature: public ModelAndView handlerX(@ModelAttribute ModelMap model){ I've tried something like this in my JSP: &lt;form method="post" action="action"&gt; &lt;spring:bind path="objectX.name"&gt; &lt;input type="text" name="${status.expression}" value="${status.value}" readonly="readonly" /&gt; &lt;/spring:bind&gt; But when the debugger reaches the controller, the model object doesn't contain any of the form's values. Can anybody please give some advice on how to design the form? I think I can not wrap the two different objects in a Command-type-object, as the controller's handler accepts only a ModelMap. Thank you very much!
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22860779
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/35024195
has text: its either JAXB or Xpath i dont see why you would use both. maybe you should do some research on Xpath http://viralpatel.net/blogs/java-xml-xpath-tutorial-parse-xml/
type: Comment
comment on: http://stackoverflow.com/a/22941050
type: AnswerComment
score: 0

http://stackoverflow.com/a/22935778
accepted answer of: http://stackoverflow.com/q/22935172
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22935172
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35013195
has body: The first problem is that you interpret the result of read() as a byte instead of an int. Bytes (and integers) in Java are signed, so the integer 255 (0xFF) when cast to byte is -1. While you should test for the integer 0xFFFFFFFF (-1) when testing for end of stream. Change your code to: for (int i=0; i &lt; mat_size &amp;&amp; !error; i++) { int value = inFromServer.read(); if (value == -1) { error = true; // Actually: end of stream, not error... } else { mat_arr[i] = (byte) value; } } The second problem is that you try to read bytes from a Reader. A reader is for reading characters, not bytes (but because of the -1, the return type is int not char). And as you construct one with new InputStreamReader(InputStream), it uses the default platform character set. If the platform default is UTF-8 (like it is on Linux), than for each character read() from the reader, one or more bytes will be read from the stream which could account for the discrepancy in the actual bytes read versus the expected number of bytes read. So: drop the use of a BufferedReader and read the bytes directly from an InputStream, or if the data is actually character data, then make sure you 1) use char and char[] and 2) specify the expected encoding when constructing the Reader. It is important to realize that a Java char is not the same as a C or C++ char.
has comment: http://stackoverflow.com/comment/35014311
upvote count: 2
has comment: http://stackoverflow.com/comment/35015067
has comment: http://stackoverflow.com/comment/35014686

http://stackoverflow.com/comment/34888796
type: Comment
has text: no work required, already done: http://stackoverflow.com/questions/923863/converting-a-string-to-hexadecimal-in-java
score: 0
comment on: http://stackoverflow.com/q/22858506
type: QuestionComment

http://stackoverflow.com/a/22835835
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22830224
type: AcceptedAnswer
downvote count: 0
has body: There doesn't seem to be any clean way to create default null values for annotation fields. Here's some information why it was design this way and workarounds when using class types: Error setting a default null value for an annotation&#39;s field I think using arrays like you proposed is a good way of handling this. Just document that it's an array for technical reasons and throw an error when used with more than one element. The only other solution that comes to my mind is using magic strings as the value of the default A. Depending on the use case I would either choose some long random string that is unlikely to be used any users or document whatever other special value is used. public @interface B { final String DEFAULT = "_a_default_value"; A a() default @A(DEFAULT); }
has comment: http://stackoverflow.com/comment/34835184
answers question: http://stackoverflow.com/q/22830224

http://stackoverflow.com/a/22856180
accepted answer of: http://stackoverflow.com/q/22856150
upvote count: 3
answers question: http://stackoverflow.com/q/22856150
has body: If you are sure of the number of elements in the list, you can always access it with the items index. menuButtons.get(0) returns your first item. So basically menuButtons.get(i) where i is the requested index of the element. Be sure to not try and access an index higher than the size of the list. You can then call .draw directly on the element returned: menuButtons.get(i).draw(batcher);
type: Answer
downvote count: 0
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/34818801
type: QuestionComment
has text: well, sorry about that. I was thinking of putting it as an answer but it would actually answer the question so put it as a comment. let me modify it. http://stackoverflow.com/questions/2265503/why-do-i-need-to-override-the-equals‌​-and-hashcode-methods-in-jav
comment on: http://stackoverflow.com/q/22827652
score: 0
type: Comment

http://stackoverflow.com/q/22842409
has comment: http://stackoverflow.com/comment/34843575
upvote count: 2
has comment: http://stackoverflow.com/comment/34844049
answer count: 2
downvote count: 0
has title: Implementing multi key-value map
tagged with: data-structures
has comment: http://stackoverflow.com/comment/34997619
favorite count: 0
has body: I have a situation where I need to have a key-value pair data structure. But it should allow multiple keys and values corresponding to that. It would be like : a - 1 b - 2 a - 3 So, when retrieving, I can have getFirstValueOfKey(key) and get 1...something like that. Is there something existing or I need to implement this? If I need to implement this, I am thinking to proceed as : Create a class, which a=can hold K-V pairs, and add them to a list. And write corresponding API's required. Is this right approach? Shall I continue like this? EDIT : I actually want multiple entries of keys in the data structure. EDIT : The thing is, I want to maintain order in which new entries(keys) were made, i.e. I want to have sequence of keys how they are put, (a and then b and then a). If array of values is used, this sequence is lost. Example : a -&gt; 1 (Time 0) b -&gt; 2 (Time 1) a -&gt; 3 (Time 2) These time stamps are also required.
has answer: http://stackoverflow.com/a/22842477
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14975681
score: 2
type: Question
has answer: http://stackoverflow.com/a/22842536
tagged with: java

http://stackoverflow.com/comment/34948467
type: Comment
comment on: http://stackoverflow.com/a/22900148
has text: But I already did. I thought if I put another "return 'none'" at the very end, it would actually return it.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22842508
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34844042
tagged with: java
has comment: http://stackoverflow.com/comment/34843890
has answer: http://stackoverflow.com/a/22842648
score: -1
upvote count: 0
answer count: 1
tagged with: calculator
favorite count: 0
has body: I've just been making a GUI calculator in Java and I've been using eclipse, thing is I am not getting any syntax errors but when I compile I get a couple of compilation errors, and I couldn't figure out why. These are the errors I receive. Exception in thread "main" java.lang.IllegalArgumentException: cannot add to layout: constraints must be a GridBagConstraint at java.awt.GridBagLayout.addLayoutComponent(Unknown Source) at java.awt.Container.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at javax.swing.JFrame.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at Calculator1.&lt;init&gt;(Calculator1.java:81) at Calculator1.main(Calculator1.java:178) This is my source code: import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Calculator1 extends JFrame{ JButton add, subtract, multiply, division; //These are going to be all the buttons JTextField num1, num2; //All the fields I need JLabel result, enter1, enter2; //The labels public Calculator1(){ //Starting of constructor class setLayout(new GridBagLayout()); //Declaring I'm going to be using the GridBagLayout GridBagConstraints c = new GridBagConstraints(); //Making a GridBagLayout Object enter1 = new JLabel("1st :"); //New JLabel with 1st being put into enter1 c.fill = GridBagConstraints.HORIZONTAL; //Will set the size c.gridx = 0; //Position x c.gridy = 0; //Position y add(enter1, c); //Add options to our object c num1 = new JTextField(10); //How big can user enter a value upto c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 1; c.gridy = 0; c.gridwidth = 3; add(num1, c); enter2 = new JLabel("2nd :"); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 1; c.gridheight = 1; add(enter2, c); num2 = new JTextField(10); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 1; c.gridy = 1; c.gridwidth = 3; add(num2, c); add = new JButton("+"); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 2; c.gridwidth = 1; add(add, c); subtract = new …
has comment: http://stackoverflow.com/comment/34843716
accepted answer: http://stackoverflow.com/a/22842648
has title: Calculator compiling problems
downvote count: 1
type: Question

http://stackoverflow.com/comment/34997143
type: Comment
has text: Interesting. And you are sure you are setting the right instanceids? What if you use CLI ec2-describe-instances <instanceids> to query the instances? Besides, your instances are running while you query them, right? Also is your instance running in VPC or ec2-classic? Instances launched in non-default VPC subnet do not have public ip address by default.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22923585

http://stackoverflow.com/q/22846816
has comment: http://stackoverflow.com/comment/34851965
tagged with: datagram
linked to: http://stackoverflow.com/q/20213953
has body: I am trying to implement a TFTP client in Java. The client works perfectly on Localhost and will sometimes work sending to a TFTP server over the network. However, sometimes my DatagramSocket will randomly stop receiving packets. It will send a read/write request but it never receives the next message the server tries to send back. I've checked Wireshark, and the server is for sure receiving and trying to send. And firewalls are turned off where the need to be. Can't figure out what the problem is. Here is the code I am using: public class TFTPClient { String filename; String mode; boolean read; PacketBuilder builder; String IP; JFrame frame; public TFTPClient(String uifilename, String uimode, boolean uiread, String uiIP, JFrame uiFrame){ this.filename = uifilename; this.read = uiread; this.mode = uimode; this.IP = uiIP; builder = new PacketBuilder(); this.frame = uiFrame; } /* * Method choses between reading a file and writing a file based on boolean selected in main UI. */ public void startTFTP() throws IOException{ if (read){ readFile(); } else{ writeFile(); } } /* * Method is used for writing a file */ private void writeFile() throws IOException{ byte[] WRQ = builder.getWRQ(filename,mode); String filenameAndExtension = filename; RandomAccessFile f = new RandomAccessFile(filenameAndExtension, "r"); byte[] fileBytes = new byte[(int)f.length()]; f.read(fileBytes); f.close(); DatagramSocket TFTPSocket = new DatagramSocket(); TFTPSocket.setSoTimeout(5000); //create the packet and send to port 69 of the given IP DatagramPacket wrqPacket = new DatagramPacket(WRQ, WRQ.length, InetAddress.getByName(IP), 69); try { TFTPSocket.send(wrqPacket); } catch (IOException e) { e.printStackTrace(); System.exit(1); } byte[] ackByte = new byte[4]; DatagramPacket ackPacket = new DatagramPacket(ackByte, ackByte.length); int blockNumber = 0; DatagramPacket dataPacket; boolean terminateOnNextAck = false; boolean needExtraDataPacket = false; int currentIndex = 0; while(true) { TFTPSocket.…
linked to: http://stackoverflow.com/q/8314174
tagged with: udp
has title: DatagramSocket will randomly stop receiving packets (still receives sometimes)
has comment: http://stackoverflow.com/comment/34853056
answer count: 1
has answer: http://stackoverflow.com/a/22940912
type: UnansweredQuestion
tagged with: sockets
tagged with: tftp
linked to: http://stackoverflow.com/q/7968566
has comment: http://stackoverflow.com/comment/34851821
tagged with: java
score: 0
type: Question

http://stackoverflow.com/comment/34962977
score: 0
has text: I think that my problem is coming from : - There is no clear distinction between before and around advices. In other words, There is no time to call onReceive(), so GRANT value cannot be changed. So its null for the 1st time. - So now, is there a way to call an external method( in this example, receiving the broadcast with onReceive() ) between before and around advices, Or I'm open for new ways to solve the problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22862310

http://stackoverflow.com/comment/35232039
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22997835
has text: GCM broadcasts are indeed ordered! Thanks
type: AnswerComment

http://stackoverflow.com/a/22863596
has comment: http://stackoverflow.com/comment/34882381
has comment: http://stackoverflow.com/comment/34882224
has comment: http://stackoverflow.com/comment/34881887
has body: I remember I also had such a problem. My problem was connected with a proper configuration. For instance: Did you specify in the TransactionManager declaration something like this: transactionManager.setRollbackOnCommitFailure(true); you may also use a debugger and catch the execution in your implementation of TransactionManager. You have there a method like rollback and you will see what is the reason that this operation is ommited.
answers question: http://stackoverflow.com/q/22862006
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34882540
has comment: http://stackoverflow.com/comment/34882555

http://stackoverflow.com/a/22903024
upvote count: 19
has body: You need to know in which directory the code is searching for the file: Do this: To get current path: System.out.println(new File(".").getAbsoluteFile()); This will show you the path where the java code is looking for files. Reference your file using relative path starting from this location. Cheers
answers question: http://stackoverflow.com/q/22902995
accepted answer of: http://stackoverflow.com/q/22902995
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34953687
type: Answer
score: 19

http://stackoverflow.com/comment/34911028
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22879156
type: Comment
has text: This is what Dependency Injection is for. Use guice/Spring to handle injecting your one instance of `StrategyImpl` to all dependent objects.

http://stackoverflow.com/a/22814076
answers question: http://stackoverflow.com/q/22812922
type: Answer
has body: this my code to show data to JTable: tabModel = new DefaultTableModel(null,header); tabel.setModel(tabModel); try { String query = "SELECT NIP,Pendidikan,Penelitian,MK,Skripsi FROM table1 group by NIP"; java.sql.Statement Stat = Connect.createStatement(); java.sql.ResultSet rs = Stat.executeQuery(query); while (rs.next()) { String nip = rs.getString("NIP"); String bidang = rs.getString("Bidang"); String pendidikan = rs.getString("Pendidikan"); String penelitian = rs.getString("Penelitian"); String mk = rs.getString("MK"); String skripsi = rs.getString("Skripsi"); String[] dataTampil = {nip,bidang,pendidikan,penelitian,mk,skripsi}; tabModel.addRow(dataTampil); tabel.setModel(tabModel); } }catch(Exception e){} } but, i can't calculate the table with differnt formula for every coloumn. for coloumn Pendidikan and skripsi the value direct from database, but for coloumn Penelitian and MK the value form Value in Row minus Average for thats coloumn.
has comment: http://stackoverflow.com/comment/34793125
score: 0

http://stackoverflow.com/comment/35147590
score: 0
comment on: http://stackoverflow.com/q/22920212
type: QuestionComment
has text: @Joffrey Ok, but it isn't case of problem.
type: Comment

websphere-7
tags question: http://stackoverflow.com/q/22884707
type: Tag
tag name: websphere-7

http://stackoverflow.com/comment/35045767
score: 0
type: Comment
type: QuestionComment
has text: ya it is working @Raghunandan i appreciate your answer and thanks for your time cooll it is working perfectly
comment on: http://stackoverflow.com/q/22954036

http://stackoverflow.com/comment/35025462
comment on: http://stackoverflow.com/q/22942824
has text: Since variables are only used internally, what does it matter if it's called 'myStock' or something specified by the user. Which is to say, what is the use case for this 'feature'?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22886497
type: Question
has body: C:\asset (there I have images like 1.jpg / 2.jpg / 3.jpg etc) My tomcat server.xml looks like this: &lt;Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"&gt; &lt;Context path="/test" docBase="C:/asset" debug="0" reloadable="true" crossContext="false"/&gt; &lt;!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --&gt; &lt;!-- &lt;Valve className="org.apache.catalina.authenticator.SingleSignOn" /&gt; --&gt; &lt;!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --&gt; &lt;Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &amp;quot;%r&amp;quot; %s %b" /&gt; &lt;/Host&gt; Still when i go to localhost:8080/test/1.jpg I have 404 error any ideas why this don't work ? Another question is there any possibility to configure this path in my spring project ? As a variable ?
tagged with: tomcat8
tagged with: tomcat
score: 0
answer count: 0
has title: Tomcat 8 - static resources / assets can't get this working
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34944112
tagged with: java
has comment: http://stackoverflow.com/comment/34925822

http://stackoverflow.com/a/22853675
has comment: http://stackoverflow.com/comment/34865003
has comment: http://stackoverflow.com/comment/34865297
has comment: http://stackoverflow.com/comment/34864894
has comment: http://stackoverflow.com/comment/34865037
has comment: http://stackoverflow.com/comment/34865407
type: Answer
has comment: http://stackoverflow.com/comment/34864943
has comment: http://stackoverflow.com/comment/34864985
has comment: http://stackoverflow.com/comment/34865119
has body: Well in this loop: for (i = 0; i &lt;=rcount; ++i) { //CHECK IF coach, first, or business if(seat_type[i].equals("coach")) { total=total+seat_cost[i]; } if (seat_type[i].equals("first")) { total=total+seat_cost[i]; } if(seat_type[i].equals("business")) { total=total+seat_cost[i]; } } you add the cost to the same total every single time regardless of the seat type. So you will end up with the total of all the seats each time. Basically heres what you are doing in english: I am going to go through each customer. For each customer, I will do the following: If their seat type is coach, add it to the total. If their seat type is first, add it to the total. If their seat type is business, add it to the total. Basically, you are adding every customers ticket price to the total because every customer will satisfy one of the three conditions you are testing. You should replace the three if statements with the following: if(seat_type[i].equals(search_seat)) { total += seat_cost[i]; System.out.println( reservation_code[i] + "," + fl_number[i] + "," + last_name[i] + "," + first_name[i] + "," + seat_type[i] + "," + seat_cost[i]); }
answers question: http://stackoverflow.com/q/22853543
score: 0

http://stackoverflow.com/a/22886551
upvote count: 29
has comment: http://stackoverflow.com/comment/93056291
type: AcceptedAnswer
downvote count: 1
score: 28
type: Answer
has comment: http://stackoverflow.com/comment/114158742
accepted answer of: http://stackoverflow.com/q/22886287
answers question: http://stackoverflow.com/q/22886287
has body: This is two lines, but slightly less complex: EnumSet&lt;Options&gt; temp = EnumSet.noneOf(Options.class); // make an empty enumset temp.addAll(Arrays.asList(options)); // add varargs to it I don't consider this worse than any other kind of variable declaration for a class which doesn't have the constructor you want: SomeClass variable = new SomeClass(); // make an empty object variable.addStuff(stuff); // add stuff to it

http://stackoverflow.com/a/22935712
score: 1
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22933507
has body: Uses a GridLayout for a single column of buttons of equal width. The buttons stretch as the window's size increases. To maintain the button size, put the GridLayout as a single component into a GridBagLayout with no constraint. It will be centered. The size of the buttons is increased by setting a margin. import java.awt.*; import javax.swing.*; import javax.swing.border.EmptyBorder; /* * Uses a GridLayout for a single column of buttons of equal width. * The buttons stretch as the window's size increases. To maintain * the button size, put the GridLayout as a single component into a * GridBagLayout with no constraint. It will be centered. */ public class CenteredSingleColumnOfButtons { public static void main(String[] args) { Runnable r = new Runnable() { @Override public void run() { // the GUI as seen by the user (without frame) JPanel gui = new JPanel(new GridLayout(0,1,10,10)); gui.setBorder(new EmptyBorder(20,30,20,30)); String[] buttonLabels = { "Spel hervatten", "Spel opslaan", "Spel afsluiten" }; Insets margin = new Insets(20,150,20,150); JButton b = null; for (String s : buttonLabels) { b = new JButton(s); b.setMargin(margin); gui.add(b); } JFrame f = new JFrame("Centered Single Column of Buttons"); f.add(gui); // Ensures JVM closes after frame(s) closed and // all non-daemon threads are finished f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // See http://stackoverflow.com/a/7143398/418556 for demo. f.setLocationByPlatform(true); // ensures the frame is the minimum size it needs to be // in order display the components within it f.pack(); f.setMinimumSize(f.getSize()); // should be done last, to avoid flickering, moving, // resizing artifacts. f.setVisible(true); System.out.println(b.getSize()); } }; // Swing GUIs should be created and updated on the EDT // http://docs.oracle.com/javase/tutorial/uiswing/concurrency SwingUtilities.invokeLater(r); } }

http://stackoverflow.com/q/22865505
tagged with: java
has title: JAVA ScheduledExecutorService - run repeating certain Job once a day
type: Question
has body: I am writing J2SE app which purpose is to every day sent certain amount of request towards remote server. There is limited amount of request to be sent per day, even per hour - 100K req per day &amp;&amp; 10K per hour => aprox. 1 req per 2.8 sec. I wrote just sample program which prints something every 15sec - as repeating I used ScheduledExecutorService &amp; ScheduledFuture where I specified my runnable, no start delay, and repeat delay=15000, time unit=MILLISECONDS. In my testing runnable I tried to simmulate to do something in loop (just simple println() and with sleep(2800) between these iterations) - because I am in scheduled task with 15sec between execution next, I just realised I need 6 times to print => 6*2800=14000 which is fine upto 15000. But as I see when I sleep it, next execution of whole task which supposed to happen after 15000ms happens actually after: 14000ms + 15000ms. I guess this sleep(2800) has some effect to it. As I said, I need to repeat certain requests sending once a day, with some time delay between sending - but to don't touch overal execution of this task after next 24h. how can I achieve this? using: ScheduledFuture , ScheduledExecutorService , ThreadFactory if anyone can help here is my code https://db.tt/vznt4PWG ,its an Eclipse project.
has answer: http://stackoverflow.com/a/27857081
accepted answer: http://stackoverflow.com/a/27857081
score: 0
answer count: 1
tagged with: scheduledexecutorservice
tagged with: repeat
type: AnsweredQuestion

http://stackoverflow.com/comment/34982069
type: AnswerComment
comment on: http://stackoverflow.com/a/22864643
type: Comment
has text: It is not so much interesting the content but it is added
score: 0

http://stackoverflow.com/a/22897704
upvote count: 1
has comment: http://stackoverflow.com/comment/34943939
has comment: http://stackoverflow.com/comment/34944021
answers question: http://stackoverflow.com/q/22897674
type: Answer
downvote count: 0
score: 1
has body: Practically, no difference, but code A is easier to read and harder to make a mistake.

http://stackoverflow.com/q/22910634
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34966774
linked to: http://stackoverflow.com/q/10527124
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34966999
has body: I'd like to provide a default pagination for my method using Spring data jpa. How do I have to call the following method so that default pagination is applied? I tried passing null argument but that would lead to an unpaged list. interface PagedRepository extends CrudRepository&lt;User, Long&gt; { @Query("SELECT u FROM user u WHERE) List&lt;User&gt; findAllPaged(@PageableDefault(size = 20)); } //repo.findAllPaged(null); I could pass a new Pageable myself, but that make @PageableDefault useless. repo.findAllPaged(new PageableRequest(0, 20));
has title: How to apply default sorting in Spring JPA?
tagged with: spring
has comment: http://stackoverflow.com/comment/34968002
has answer: http://stackoverflow.com/a/72888770
tagged with: java
answer count: 1
type: UnansweredQuestion
tagged with: spring-data-jpa

http://stackoverflow.com/comment/54520183
score: 0
has text: CorsFilter class must be somewhere in classpath of your web application. web.xml - is a general configuration of your specific web app, stored in a WEB-INF folder.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22892991

http://stackoverflow.com/q/22913851
tagged with: java
linked to: http://stackoverflow.com/q/75175
has answer: http://stackoverflow.com/a/22914410
type: Question
tagged with: vector
has answer: http://stackoverflow.com/a/22914154
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/22914454
has answer: http://stackoverflow.com/a/22913967
has body: What is the simplest way in Java to create an array/list/vector of specified size filled with instances of classes created with the default constructor (I hope this term is used outside C++ also?). I want to make the code more readable and reduce the risk of NullPointerException. (For example, the ArrayList constructor has a constructor with argument for capacity, not size..) Below is what is try to achieve in code. This is your typical approach. (It could be done with Vector or ArrayList also) // Typical, I don't want this class SomeSimpleClass { DataClass[] data = new DataClass[10]; SomeSimpleClass() { // I don't want this.. for(int i = 0; i &lt; 10; i++) data[i] = new DataClass(); } void doSomething() { data[5].doSomething(); } } // What I want class SomeSimpleClass // now I have ten data objects, ready to be used... Holder&lt;DataClass&gt; data = new Holder&lt;DataClass&gt;(10); void doSomething() { data.get(5).doSomething(); } } I find that quite many of my classes require a few instances of smaller, data-holding classes. The above example is simple but it can be a real nuisance when the class becomes more complicated. What is the best approach here? Are there some holder classes that work like above? Are there functions for ArrayList (or similar class) such as below? ArrayList&lt;DataClass&gt; data = new ArrayList&lt;DataClass&gt;().addNewObjects(10);
tagged with: initialization
answer count: 4
favorite count: 0
score: 2
upvote count: 2
has title: Easiest way to initialize array/vector of objects in Java
type: UnansweredQuestion

http://stackoverflow.com/a/22952106
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/35079138
accepted answer of: http://stackoverflow.com/q/22952061
answers question: http://stackoverflow.com/q/22952061
type: AcceptedAnswer
score: 4
has body: Is there any reason as to why I should change the code to use an explicit iterator and run an iterator.remove() Under the covers, the iterator that CHM uses calls map.remove(key) itself. See the code below. That said, removing from the iterator is the proper pattern and its always good to use common patterns if possible. For example, if you copy your code to use a different map or downgrade the map in this code to not be a CHM then your code won't break if you are using the iterator. abstract class HashIterator { ... public void remove() { if (lastReturned == null) throw new IllegalStateException(); ConcurrentHashMap.this.remove(lastReturned.key); lastReturned = null; }
type: Answer

http://stackoverflow.com/q/22967376
tagged with: jar
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22976300
tagged with: jvm
has body: I searched for this question and got many many matches on stackoverflow itself, but the answers in there are sort of contradicting. In Ques: How to add VM options to jar? the top-voted+accepted says it is not possible and also most of the answers in Ques: Can I set Java max heap size for running from a jar file? say that No, it is not possible. Most of these answers saying "not possible" were given by people with high reputation and therefore I assume they cannot all be just wrong by coincidence. One guy said that it can be done by using this others said to make a installer for it, or use Launch4J or make batch files or make another JAR and run the main through this but most of these did not get many votes as compared to those saying "no". So is it really possible or not? My problem is that I run out of heap space and therefore I want to increase it in JAR. Q1. I have set increased Heap space from netbeans, will it be increased in the JAR too? (I think no, I am just confirming this one) Q2. What should I do now to make the increased heap space in JAR? (I am looking for an easy to do way because I do not have knowledge about batch scripting and all and also that I am already putting an Installer to place these files(Advanced Installer) so I do not want to put additional Installers to do this) Is there a simple way out?
has answer: http://stackoverflow.com/a/22976300
has answer: http://stackoverflow.com/a/22973713
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/1018217
accepted answer: http://stackoverflow.com/a/22973713
has title: Setting VM Options in JAR (-Xmx) [JVM Startup Parameters]
linked to: http://stackoverflow.com/q/2893894
score: 0
tagged with: java

httpurlconnection
tags question: http://stackoverflow.com/q/22830482
tags question: http://stackoverflow.com/q/22871599
tags question: http://stackoverflow.com/q/22850361
tags question: http://stackoverflow.com/q/22826844
tag name: httpurlconnection
tags question: http://stackoverflow.com/q/22935826
tags question: http://stackoverflow.com/q/22893205
type: Tag

http://stackoverflow.com/a/22944989
has body: I found a way to work around this (Hide some category labels in JFreeChart to avoid overlapping). You can change the color of the values you want hidden and make them disappear that way. It's probably not the best method, but it does work. If someone else has a better answer, please chime in.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22942493

http://stackoverflow.com/comment/34968670
comment on: http://stackoverflow.com/q/22898562
score: 0
type: QuestionComment
type: Comment
has text: kudos to all of those who read this question, I for one couldn't dare to scroll this much also

http://stackoverflow.com/comment/34998378
type: AnswerComment
type: Comment
score: 2
has text: You have to make life difficult :P
comment on: http://stackoverflow.com/a/22927529

http://stackoverflow.com/comment/58570299
has text: You are right. Conceal uses sharedPreferences to store the necessary keys. Therefore if you clean app data or use another device, you will not be able to decrypt.
comment on: http://stackoverflow.com/a/26866216
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22916754
accepted answer of: http://stackoverflow.com/q/22916600
has body: Yes, it's possible. I would recommend you to try jsonschema2pojo. Just paste you JSON and select source type JSON.
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/22916600
type: Answer

http://stackoverflow.com/q/22897300
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22897348
upvote count: 3
tagged with: java
has body: I am learning Java and I know that I must initialize a local variable when I use it. However, I just found a code from the book and the code is: I wonder why in this case the variable volume is not initialized? public static double cubeVolume(double sideLength) { double volume; if (sideLength&gt;=0) { volume=sideLength*sideLength*sideLength; } else { volume=0; } return volume; }
type: Question
has comment: http://stackoverflow.com/comment/34943238
score: 3
answer count: 3
has comment: http://stackoverflow.com/comment/34943231
has title: Why isn't this local variable initialized in Java?
downvote count: 0
has answer: http://stackoverflow.com/a/22897327
favorite count: 0
has answer: http://stackoverflow.com/a/22897315
has comment: http://stackoverflow.com/comment/34943201
has answer: http://stackoverflow.com/a/22897348
possible better answer: http://stackoverflow.com/a/22897315

http://stackoverflow.com/comment/35018001
has text: I am guessing draw() is passed in the screen Graphics. If so, I would expect only 1 call to drawImage() to finally draw the buffered image onto screen.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22938047

http://stackoverflow.com/q/22810484
tagged with: future
tagged with: asynchronous
has answer: http://stackoverflow.com/a/23108928
has body: I think I misunderstand java ee asynchronous method invocation. I'm following the idea from this official tutorial. For void methods it's fine, but I want my asyncronous method to return a value: @Asynchronous public Future&lt;String&gt; processPayment(Order order) { ... String status = ...; return new AsyncResult&lt;String&gt;(status); } I have many such long running tasks in background, so I collect List&lt;Future&lt;String&gt;&gt; and loop through them to check if the task is completed. I do this check by for(Future&lt;String&gt; future: listOfFutures) { if(future.isDone()) // do something } But the code fails with IllegalStateException:"Object does not represent an acutal Future" when the method AsyncResult.isDone() gets called. Well, then I read this and it made me very confused: official tutorial says "Use AsyncResult.isDone()" to check the status of asynchronous method whereas oficial javadoc says "Don't dare using AsyncResult.isDone()". I know that I could use FutureTask&lt;T&gt; together with Callable&lt;T&gt;, but this is java se part. Could you explain me if it is possible to use java ee asynchronous method invocation? Thank you! P.S. I'm using Glassfish 3.1.2 and EJB 3.1
has comment: http://stackoverflow.com/comment/41438506
has answer: http://stackoverflow.com/a/61810327
tagged with: jakarta-ee
type: AnsweredQuestion
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/61810327
has comment: http://stackoverflow.com/comment/34813537
type: Question
score: 5
has title: Why does javax.ejb.AsyncResult.isDone always throws exception?
has comment: http://stackoverflow.com/comment/35160658
has answer: http://stackoverflow.com/a/29357562
downvote count: 0
linked to: http://stackoverflow.com/q/14770672
favorite count: 0
accepted answer: http://stackoverflow.com/a/29357562
has comment: http://stackoverflow.com/comment/41427753
answer count: 3

http://stackoverflow.com/a/22904371
upvote count: 12
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43263780
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22904111
score: 12
answers question: http://stackoverflow.com/q/22904111
type: Answer
has body: As all answers by other users got deleted, I am going to answer my own question. Thanks to the user that stated that this is an issue where jackson closes the input stream automatically. The solution is to add JsonGenerator.Feature.AUTO_CLOSE_TARGET to the configuration, and set it to false: mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);

http://stackoverflow.com/comment/34856662
has text: Wow, that's indeed unexpected!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22849372

http://stackoverflow.com/q/22840220
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22840632
has answer: http://stackoverflow.com/a/22840361
upvote count: 3
tagged with: java
has body: Question for my fellow programmers. I need to test that a SQL statement will truncate a table without actually truncating the table. I do know that I need to disable the constraints before truncating it, but I'm at a lost of how to actually truncate the table without actually causing "permanent damage" to the table. Sorry if it's already been asked, and thanks in advance! Edit: I forgot to mention, I'm using Maven, MyBatis, Oracle DB, and Spring (Aspect, Batch). Also, the code works, but within the context of a JUnit, the method needs to be tested. Though how I will assert it is yet another problem I will soon need to deal with.
type: Question
has comment: http://stackoverflow.com/comment/34845134
has comment: http://stackoverflow.com/comment/34839315
answer count: 2
tagged with: truncate
tagged with: sql
score: 3
has title: JUnit, how to test truncating a table
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/34839434

http://stackoverflow.com/q/22891478
tagged with: database-design
has answer: http://stackoverflow.com/a/22891667
score: 0
has comment: http://stackoverflow.com/comment/34933021
has comment: http://stackoverflow.com/comment/34932724
tagged with: uuid
type: UnansweredQuestion
has body: I'm designing a database and cannot use auto-Inc finally it has 100 billion row(also id). Is it safe for using U.U.I.D in collision?
has comment: http://stackoverflow.com/comment/34932972
has comment: http://stackoverflow.com/comment/34932772
tagged with: collision
tagged with: java
has comment: http://stackoverflow.com/comment/34933171
type: Question
has title: UUID and collision in java api
answer count: 1

http://stackoverflow.com/q/22814456
accepted answer: http://stackoverflow.com/a/22815190
answer count: 1
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/34793489
tagged with: animation
has body: Hay I'm trying to learn how to use Graphics in java and I'm writing a very simple code that takes an image and moves it across the window in a line and when it hits the edge of the window it moves down a few pixels and starts back at the other end. My problem is that my program isn't removing the previous image when it repaints() so instead of 1 image just being moved across I'm getting a long string of images (I'm also having a weird problem where the button I use to repaint() is getting it's image duplicated at the top left of the window but 1 issue at a time I think) here's the code for the 2 class files I'm using: public class TestieImages extends JFrame implements ActionListener{ ImagePanel jj =new ImagePanel(); TestieImages(){ setTitle("TestFrame"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(582,604); JButton butt = new JButton("The butt"); butt.addActionListener(this); butt.setActionCommand("1"); butt.setBounds(200, 200, 80, 24); add(butt); add(jj); setVisible(true); } @Override public void actionPerformed(ActionEvent e) { String action= e.getActionCommand(); int x=jj.getXCoord(); int y=jj.getYCoord(); if (action.equals("1")){ if (x&lt;=448){ jj.setX(x+64); } else{ jj.setX(0); jj.setY(y+64); } jj.repaint(); } } public static void main(String[] args) { JFrame j = new TestieImages(); } } ImagePanel public class ImagePanel extends JPanel{ private int x=0; private int y=0; private BufferedImage image; ImagePanel() { try { image = ImageIO.read(new File("C:\\Users\\dleitrim09\\Documents\\NetBeansProjects\\TestieImages\\src\\Resources\\Wall.png")); } catch (IOException ex) { // handle exception... } } void setX (int newx){ x=newx; } void setY (int newy){ y=newy; } int getXCoord (){ return x; } int getYCoord (){ return y; } @Override protected void paintComponent(Graphics g) { g.drawImage(image, x, y, null); } } also here's the Output:
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22815190
tagged with: swing
type: Question
has title: Repaint() keeping original image
tagged with: image
score: 0

http://stackoverflow.com/a/22865574
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34890377
has comment: http://stackoverflow.com/comment/34897307
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22861856
answers question: http://stackoverflow.com/q/22861856
has body: From your comment above, the actual line that is failing is: st.executeUpdate("INSERT INTO CUST_RALLY_TEAM_MEMBER " + "VALUES projectValue,columnValue)"); Here, you are literally passing this string to Oracle: INSERT INTO CUST_RALLY_TEAM_MEMBER VALUES projectValue,columnValue) You need to pass the values of those variables (you're also missing an open parenthesis: st.executeUpdate("INSERT INTO CUST_RALLY_TEAM_MEMBER VALUES ('" + projectValue + "','" + columnValue + "')"); This assumes that the cust_rally_team_member contains only these two columns, if not (and as a best practice, even if it does), you should be specifying the columns to be inserted into. Assuming the column names are also "projectvalue" and "columnvalue", then the statement would be: st.executeUpdate("INSERT INTO CUST_RALLY_TEAM_MEMBER (projectvalue,columnvalue) VALUES ('" + projectValue + "','" + columnValue + "')"); Note, too, that prepared statements are a good approach for a process such as this. It eliminates the risk of SQL errors if the values contain a single quote, reduces the risk of SQL Injection attacks, and improves performance by compiling the statement only once.

http://stackoverflow.com/a/22880954
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22880901
upvote count: 3
type: Answer
has body: Where do you initialise these: public static BigInteger ZERO; public static BigInteger ONE; public static BigInteger TEN; I don't think you do: public static BigInteger ZERO = BigInteger.ZERO; public static BigInteger ONE = BigInteger.ONE; public static BigInteger TEN = BigInteger.TEN; Or, if you're into import static then: import static java.math.BigInteger.ZERO; import static java.math.BigInteger.ONE; import static java.math.BigInteger.TEN; And delete your declarations. Also this: new BigInteger(String.valueOf(thirteen)); Makes a cry a little: BigInteger.valueOf(thirteen); Will do just fine.

http://stackoverflow.com/comment/43605944
score: 11
type: AnswerComment
has text: This doesn't address the case in which the array is empty.
comment on: http://stackoverflow.com/a/25216971
type: Comment

http://stackoverflow.com/comment/34941138
comment on: http://stackoverflow.com/a/22895883
score: 0
type: AnswerComment
has text: That works, thanks. I should have caught some of those.
type: Comment

http://stackoverflow.com/comment/34969966
type: AnswerComment
has text: Please add output of `getBytes()` to show the difference.
type: Comment
comment on: http://stackoverflow.com/a/22912357
score: 0

http://stackoverflow.com/a/22935823
accepted answer of: http://stackoverflow.com/q/22935729
answers question: http://stackoverflow.com/q/22935729
score: 1
has comment: http://stackoverflow.com/comment/35012588
has comment: http://stackoverflow.com/comment/35012791
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35012908
has comment: http://stackoverflow.com/comment/35012874
type: Answer
has body: You can simplify your code to get something like this: public String getVisible() { String rtn = null; for(Character b: brokenphrases){ if(characters.contains(b)){ rtn = rtn + b; } else { rtn = rtn + "*"; } } return rtn; } You iterate over all characters of your target word (brokenphrases), for example hello. If the character is in characters, you add the character to the output. If not, you add *. If you guessed h and l you would get h*ll*. No need to add blankspace.
has comment: http://stackoverflow.com/comment/35012749

http://stackoverflow.com/comment/34989642
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22919535
has text: [Saving Images to Internal memory in Android](http://stackoverflow.com/questions/17674634/saving-images-to-internal-memory-in-android)

http://stackoverflow.com/q/22888436
favorite count: 0
has title: Scala / Java Sandbox for untrusted code
tagged with: security
has answer: http://stackoverflow.com/a/22890744
upvote count: 6
has body: I'd like to allow users to submit Java / Scala source code from browser client and compile / execute it on the server. However, at the same time, I want to restrict users from running potentially malicious code on server. For instance, I would like to prevent filesystem access as well as inbound / outbound network access for submitted source code. What else should I restrict? Which Java / Scala libraries should I explicitly disallow for client? For instance, here is my list of disallowed API's / libraries: java.lang.System java.lang.Runtime java.io.* java.nio.* scala.io.* java.net How do I properly sandbox untrusted Java / Scala code?
tagged with: scala
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/34927307
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34927268
answer count: 1
has comment: http://stackoverflow.com/comment/34927630
downvote count: 0
linked to: http://stackoverflow.com/q/4011260

http://stackoverflow.com/comment/34894046
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22870274
has text: getInstace() does not work in broadcastreceiver: MainActivity .getInstace().updateTheTextView("String"); Doesnt know getinstance

http://stackoverflow.com/a/22829252
has comment: http://stackoverflow.com/comment/34821823
has comment: http://stackoverflow.com/comment/34823246
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22828941
has comment: http://stackoverflow.com/comment/34823383
type: Answer
upvote count: 1
has body: First of all, an answer to your question ... Is there a quick way to get super instance without new? There is in fact no simple way to create any instance without the new keyword. Period. (Exceptions are somewhat advanced: There is a deserialization mechanism and a cloning mechanism. But forget about them at the moment.) Second, you have some misconceptions, I guess. You described an example, where you created an A instance: A a = new A(); The new A() part creates the instance, and the A a part declares a variable of type A. The assignment (=) then stores the reference to the newly created instance in the variable. The statement Base b = a; does not create a new instance. In fact, it simply declares a new variable (which at runtime will allocate some memory on the stack), assigning it the same reference that variable a contains. Result will be, that variables a and b will both refer to the same instance. You are right, that at runtime this instance will be an A instance. The only difference between variables a and b will be at compile time: The compiler only allows you method calls and field accesses on variable b that are declared in the Base type.

http://stackoverflow.com/comment/34837310
score: 0
type: Comment
has text: +1 for being the first one to mention the (though obvious) concept of stopping the search when the first element visited is visited again.
type: AnswerComment
comment on: http://stackoverflow.com/a/22839098

http://stackoverflow.com/a/22906264
has body: I have spent the last year building a REST API, and by far the best way to exercise that API manually is using the Chrome Extension, Postman. I cannot recommend this tool enough. https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en To test your simple example you'll need to invoke a POST (I assume that as you have a request body, but your controller method doesn't define a HTTP Verb) using POSTMAN to your Url (like the following example): POST /contextRoot/testCall { "testNumber": 1 } If you want to test your API automatically (which I recommend), you can use the excellent Spring Mvc Test project. This allows your to call your API via a rest-like DSL and assert that the response is in the shape you want. More details can be found here: http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/testing.html#spring-mvc-test-framework
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22902372
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/22964069
has body: I am trying to update ADT plugin from 20.0.3 to 22.6.2, I am using Eclipse juno, My eclipse takes almost 8 hours from the morning, Still it trying to Contacting Software Sites , I don't know what have to do now, Any help will be highly appreciable. Note: Already I have unchecked all other software sites expect https://dl-ssl.google.com/android/eclipse/
tagged with: eclipse-plugin
score: 0
has comment: http://stackoverflow.com/comment/35063017
tagged with: android
answer count: 1
type: AnsweredQuestion
has title: Check for updates in eclipse
has answer: http://stackoverflow.com/a/22964462
accepted answer: http://stackoverflow.com/a/22964462
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35063044

http://stackoverflow.com/comment/59171307
type: AnswerComment
score: 0
type: Comment
has text: Thanks! It would be great if the [camel docs](https://camel.apache.org/rabbitmq.html) explicitly stated that `exchangeName` is optional.
comment on: http://stackoverflow.com/a/22865322

http://stackoverflow.com/a/22867727
answers question: http://stackoverflow.com/q/22867431
type: Answer
score: 2
has body: Using your existing code, the easiest is probably: String drieCijfers = fiNum.get(0) + fiNum.get(1) + fiNum.get(2); But it may be better to not build your number as a List of Strings, but rather as an int or long to begin with: public static void main(String[] args) { ArrayList&lt;Integer&gt; cijfer = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt;= 9; i++) cijfer.add(i); System.out.println("Please enter digit length "); Scanner nummerOfChoise = new Scanner(System.in); String cooiseresult = nummerOfChoise.nextLine(); int cc = Integer.parseInt(cooiseresult); long fiNum = 0; for (int i = 0; i &lt; cc; i++) { int getal = (int) (Math.random() * cijfer.size()); fiNum = fiNum * 10 + cijfer.get(getal); cijfer.remove(getal); } System.out.print(fiNum); }
upvote count: 2
downvote count: 0

http://stackoverflow.com/a/22965059
answers question: http://stackoverflow.com/q/22964853
has comment: http://stackoverflow.com/comment/35064997
upvote count: 1
has body: Instead of: T[] result = (T[]) new Object[arr.length]; You have to use: T[] result = (T[]) Array.newInstance(clazz, arr.length); Where clazz is the type of the nested elements: public T[] treeSort(T[] arr, Class&lt;T&gt; clazz) {...} Finally, when calling, use the boxed primitive: Integer[] unsortedNums = { 6, 3, 7, 4, 1, 2, 9, 8, 5 }; Integer[] sortedNums = treeSort(unsortedNums, Integer.class);
accepted answer of: http://stackoverflow.com/q/22964853
score: 1
has comment: http://stackoverflow.com/comment/35065063
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34914598
comment on: http://stackoverflow.com/q/22881164
has text: For my purpose, I mean the following: Y is a subtype of I, if any instance of Y is also an instance of I. Given any type Y and I, I need to be able to check this at the runtime.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34855223
type: QuestionComment
comment on: http://stackoverflow.com/q/22840448
has text: i have try. but it start the rotation with the screen measure of the default parameters
score: 0
type: Comment

http://stackoverflow.com/comment/34955898
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22903476
has text: this will cause an exception if `COMPLETEDATE` is null
type: AnswerComment

http://stackoverflow.com/a/22963176
has comment: http://stackoverflow.com/comment/35067077
type: Answer
has comment: http://stackoverflow.com/comment/35486583
has comment: http://stackoverflow.com/comment/35069970
answers question: http://stackoverflow.com/q/22962194
score: 0
has body: I believe the problem is with how/where you are copying your database. In your code you define the database file as: private static String DB_PATH = "data/data/com.hmkcode.android/databases/"; private static final String DB_NAME = "USSDts.sqlite"; and then you use this code to create the database file: myOutput = new FileOutputStream(DB_PATH + DB_NAME); This will certainly not create the databases in the right place (if at al). Instead, you should create your database like this: File dir = new File(context.getApplicationInfo().dataDir + "/databases"); dir.mkdirs(); File f = new File(dir, DB_NAME); OutputStream os = new FileOutputStream(f);
has comment: http://stackoverflow.com/comment/35474797

http://stackoverflow.com/comment/34953742
comment on: http://stackoverflow.com/a/22898966
type: Comment
score: 0
type: AnswerComment
has text: OptimisticLockException inheriting RuntimeException may not be the reason that it is not declared in the method because the EntityManager find and lock method do declare OptimisticLockException. I think the reason is as you and other said, merge doesn't cause the problem directly. thanks the same!

http://stackoverflow.com/a/22818354
has comment: http://stackoverflow.com/comment/34801467
answers question: http://stackoverflow.com/q/22818263
type: Answer
score: 0
has body: I hope this piece of text from oracle docs answers your question: An instance of InnerClass can exist only within an instance of OuterClass and has direct access to the methods and fields of its enclosing instance. To instantiate an inner class, you must first instantiate the outer class. Then, create the inner object within the outer object with this syntax: OuterClass.InnerClass innerObject = outerObject.new InnerClass(); For example, QR[i].Class1 test = QR[i].new Class1();
has comment: http://stackoverflow.com/comment/34801116
has comment: http://stackoverflow.com/comment/34825279

http://stackoverflow.com/comment/34814150
comment on: http://stackoverflow.com/q/22825619
type: QuestionComment
score: 0
has text: haha I am really sorry its too late for my brain to funtion. I mean I want to be able to call a MaxValue method and a MinMalue method ? Like we put the Max number calculations into a method ? you get me ?
type: Comment

http://stackoverflow.com/a/22908333
answers question: http://stackoverflow.com/q/22895553
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Well, I suggest you to implement composite UserDetailsService and perform loadUserByUsername to both DB one by one. And it is logical, that the first UserDetailsServiceImpl to use should be for regular user, as soon as it is tipical, that the count of admin user is definitely less. However by design it looks bad. It would be better to have separate hidden application for admins and get rid of a little vulnerability when simple user might guess an admin account.
has comment: http://stackoverflow.com/comment/34966419
score: 1
accepted answer of: http://stackoverflow.com/q/22895553
upvote count: 1

http://stackoverflow.com/a/22809661
answers question: http://stackoverflow.com/q/22809629
type: Answer
upvote count: 4
has body: name != null || !name.isEmpty() If name is not null, the second condition is never checked; if name is null, the second condition is checked and throws a NullPointerException.
downvote count: 0
score: 4

http://stackoverflow.com/comment/35004124
has text: Aren't you just in a difficult and confusing way asking how to call a REST service from a servlet? In which case the answer is: use the JAX-RS API, for example Jersey which is the reference implementation.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22929792
score: 1

http://stackoverflow.com/comment/34989967
score: 0
type: Comment
type: QuestionComment
has text: i mean that if strLine has "str1" element or not. If it has than str1 element is found will be printed.
comment on: http://stackoverflow.com/q/22922758

http://stackoverflow.com/comment/34899824
comment on: http://stackoverflow.com/a/22860617
has text: thank you that got me to something,but when i launch the ".Launcher" class it just get me to the Main Screen and not to the default Launcher Application
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34925583
type: QuestionComment
type: Comment
has text: Actually, windows uses `\r\n` -- the carriage return always comes before the linefeed.
comment on: http://stackoverflow.com/q/22887211
score: 0

http://stackoverflow.com/q/22919459
tagged with: jpa
downvote count: 0
possible better answer: http://stackoverflow.com/a/22919859
favorite count: 0
has answer: http://stackoverflow.com/a/22922789
accepted answer: http://stackoverflow.com/a/22922789
has body: I work With EJB 3. I have Base class A and there are dependency classes B,C,D @Entity @Table(name = "A") public class A implements Serializable { @OneToMany(cascade = CascadeType.ALL) private List&lt;B&gt; bs; @OneToMany(cascade = CascadeType.ALL) private List&lt;C&gt; cs; @OneToMany(cascade = CascadeType.ALL) private List&lt;D&gt; ds; } I have question. How can I load all tables eagerly? I want to use em.find(A.class, id);
has title: EJB 3 Eager loading
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: lazy-loading
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22919859
type: Question
tagged with: ejb
answer count: 2

http://stackoverflow.com/comment/35062040
type: QuestionComment
comment on: http://stackoverflow.com/q/22963363
has text: What do You want to do ? Remove entry from list or remove file from filesystem ?
score: 0
type: Comment

http://stackoverflow.com/q/22960707
type: Question
has comment: http://stackoverflow.com/comment/35057343
has answer: http://stackoverflow.com/a/22960864
answer count: 1
downvote count: 0
tagged with: dao
accepted answer: http://stackoverflow.com/a/22960864
has comment: http://stackoverflow.com/comment/35057632
has body: So here's what I've done so far. it is also already connected to the database with the username as the primary key. protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try { Accounts bean = new Accounts(); bean.setUsername(request.getParameter("uname")); bean.setName(request.getParameter("fname")); bean.setEmail(request.getParameter("email")); bean.setPassword(request.getParameter("password")); AccountsDAO aO = new AccountsDAO(); aO.addAccount(bean); response.sendRedirect("Stream.jsp"); } finally{ } } what i want is, when i try to register an account with the same username/email of any existing user in the database, it will redirect to another with another page also using a response.sendRedireect("file.jsp"); that will require the user to register again with another username/email. Thank you in advance! here is my AccountsDAO public void addAccount(Accounts bean) { try { bConnector = new DBConnector(); Connection c = bConnector.getConnection(); String query = "insert into account (username, name, email, password) values (?,?,?,?)"; PreparedStatement preparedstatement = c.prepareStatement(query); preparedstatement.setString(1, bean.getUsername()); preparedstatement.setString(2, bean.getName()); preparedstatement.setString(3, bean.getEmail()); preparedstatement.setString(4, bean.getPassword()); preparedstatement.executeUpdate(); } catch (SQLException ex) { Logger.getLogger(AccountsDAO.class.getName()).log(Level.SEVERE, null, ex); } }
favorite count: 0
upvote count: 1
has title: Java - How to check an existing user in the database (for a signup interface)?
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35057083
tagged with: mysql
tagged with: servlets

http://stackoverflow.com/a/22931459
upvote count: 1
has body: This definition of equals() is not transitive. It really shouldn't be called equals(). This and the hashCode() issue would most likely silently bite when used in the Collections API. Things like HashSet would not work as expected and methods like remove(). For purposes here you should test for exact equality.
downvote count: 0
answers question: http://stackoverflow.com/q/22931305
type: Answer
has comment: http://stackoverflow.com/comment/35005347
score: 1

http://stackoverflow.com/q/22813743
has answer: http://stackoverflow.com/a/22813808
upvote count: 0
has comment: http://stackoverflow.com/comment/34792618
tagged with: java
has comment: http://stackoverflow.com/comment/34792592
has title: How to use regex for digit?
type: Question
score: -1
has comment: http://stackoverflow.com/comment/34794102
answer count: 3
has comment: http://stackoverflow.com/comment/34794430
downvote count: 1
has body: I have a string which has digit and words I want to use regex in java. String s="S.No.DistrictMarketPrice 1 Agra Achhnera NIL 2 Agra Agra 1450 3 Agra Fatehabad NIL 4 Agra Fatehpur Sikri 8765 5 Agra Jagner NIL 6 Agra Jarar NIL 7 Agra Khairagarh NIL 8 Agra Shamshabad NIL 9 Aligarh Atrauli 1298 10 Aligarh Chharra NIL"; I want to break this string. I want every string in new line which should start from only exact serino How can I get this output S.No .District Market Price 1 Agra Achhnera NIL 2 Agra Agra 1450 3 Agra Fatehabad NIL 4 Agra Fatehpur Sikri 8765
favorite count: 0
has answer: http://stackoverflow.com/a/22813829
has comment: http://stackoverflow.com/comment/34800092
has answer: http://stackoverflow.com/a/22813849
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34793319
tagged with: regex

http://stackoverflow.com/q/22863446
has body: I am writing a converter method that would parse an xml string data to java objects. But i am not able to parse dates to date objects. How to format this date string "2013-08-26T12:00:00.000" in the following way: "2013-08-26 12:00:00" to Date object in java? Note: The input can be of multiple date format like - "2013-08-26T12:00:00.000" or "2013-08-26T12:00:00.000Z". The input dates are of variable formats. Edited to add the below code snippet. Here is what I tried to do. public Object fromString(String str) { DateFormat dateFormat = DateFormat.getDateInstance(); try { Date date = dateFormat.parse(str); return date; } catch (ParseException e) { e.printStackTrace(); } }
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/34885665
downvote count: 1
tagged with: java
tagged with: date
has title: How to format multiple date type string "2013-08-26T12:00:00.000" or "2013-08-26T12:00:00.000Z" to: "2013-08-26 12:00:00" and to Date object in Java?
has answer: http://stackoverflow.com/a/22867315
accepted answer: http://stackoverflow.com/a/22867315
has answer: http://stackoverflow.com/a/22863703
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34888659
has comment: http://stackoverflow.com/comment/34882085
possible better answer: http://stackoverflow.com/a/22863592
favorite count: 0
has answer: http://stackoverflow.com/a/22863592
has answer: http://stackoverflow.com/a/22863535
type: Question
has comment: http://stackoverflow.com/comment/34889651

http://stackoverflow.com/q/22823129
has body: I'm trying to call some Java methods from MATLAB and have been successful with those that return things like Strings, Files etc. But now I have a method that returns a BufferedImage, which MATLAB doesn't have a problem with YET. But how does one visualize this BufferedImage in MATLAB ? Or at least convert it into a matrix? I called the following method (which is in my Java class) from MATLAB : MATLAB code: bufferedImage = pictureObject.getBufferedImage MATLAB shows this... pictureObject = BufferedImage@9d7ae3: type = 13 IndexColorModel: #pixelBits = 8 numComponents = 3 color space = java.awt.color.ICC_ColorSpace@eee0e3 transparency = 1 transIndex = -1 has alpha = false isAlphaPre = false ByteInterleavedRaster: width = 640 height = 480 #numDataElements 1 dataOff[0] = 0 And I'm trying to convert the above thing into something visualizable in MATLAB .
tagged with: matlab
score: 3
has answer: http://stackoverflow.com/a/22823805
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22824406
tagged with: bufferedimage
type: Question
has comment: http://stackoverflow.com/comment/34899052
tagged with: image
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: How to load a Java BufferedImage into Matlab

http://stackoverflow.com/q/22923560
has answer: http://stackoverflow.com/a/22963978
accepted answer: http://stackoverflow.com/a/22963978
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35062875
has comment: http://stackoverflow.com/comment/35046027
upvote count: 5
tagged with: java
has title: QueryDSL - how to join to a union of subqueries
score: 5
answer count: 1
downvote count: 0
has body: I'm building a SQL query with QueryDSL that contains several subqueries joined in a union. This is the base of my query: QTransaction t = QTransaction.transaction; query = query.from(t).where(t.total.gt(BigDecimal.ZERO)); I then have several subqueries to obtain client names associated with a transaction. I've cut down to two for the example: SQLSubQuery subQuery = new SQLSubQuery(); subQuery = subQuery.from(t).join(t.fk462bdfe3e03a52d4, QClient.client); ListSubQuery clientByPaid = subQuery.list(t.id, bt.paidId, QClient.client.name.as("clientname")); subQuery = new SQLSubQuery(); subQuery = subQuery.from(t).where(t.paidId.isNull(), t.clientname.isNotNull()); ListSubQuery clientByName = subQuery.list(t.id, Expressions.constant(-1L), t.clientname.as("clientname")); How do I union these together, and join the union with my main query? This is my current attempt: subQuery = new SQLSubQuery(); subQuery = subQuery.from(subQuery.unionAll(clientByPaid,clientByName).as("namequery")); query = query.leftJoin(subQuery.list( t.id, Expressions.path(Long.class, "clientid"), Expressions.stringPath("clientname")), Expressions.path(List.class, "namequery")); This compiles, but generates invalid SQL at runtime when I attempt query.count(). Likely mistakes: The syntax for the union of subqueries. The connection between the .as(...) expression that names the subquery result columns and the path expression used in the leftJoin.
favorite count: 0
tagged with: querydsl

http://stackoverflow.com/a/22845410
answers question: http://stackoverflow.com/q/22845249
has comment: http://stackoverflow.com/comment/34849642
type: Answer
has body: This should work. See if this helps - String[] commonPassword = {"pass1","pass2"} ArrayList&lt;String&gt; passwordList = new ArrayList&lt;String&gt;(Arrays.asList(commonPassword)); String password = ""; do{ System.out.println("Enter new password."); password = kb.nextLine(); }while(passwordList.contains(password)); Please note, you need to import - import java.util.ArrayList; import java.util.Arrays;
has comment: http://stackoverflow.com/comment/34849916
score: 0
has comment: http://stackoverflow.com/comment/34849223
has comment: http://stackoverflow.com/comment/34849484

http://stackoverflow.com/a/22899663
upvote count: 7
accepted answer of: http://stackoverflow.com/q/22898748
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22898748
has body: Actually, the Java Language Specification does not call new an operator. It writes: 38 tokens, formed from ASCII characters, are the operators. Operator: = &gt; &lt; ! ~ ? : -&gt; == &gt;= &lt;= != &amp;&amp; || ++ -- + - * / &amp; | ^ % &lt;&lt; &gt;&gt; &gt;&gt;&gt; += -= *= /= &amp;= |= ^= %= &lt;&lt;= &gt;&gt;= &gt;&gt;&gt;= new is simply a keyword that occurs in a class instance creation expression. I consider this a reasonable definition, as an operator would take operands (or, from the perspective of source code, appear next to an expression), but the class name followed by the argument list is not by itself a valid expression nor it is evaluated to produce a value at runtime. I suspect the practice of calling new an operator originates from C++, where the new operator could be overloaded independent of the constructor call, to customize the memory allocation strategy. Managed languages such as Java or C# no longer allow such a separation, but the term operator has stuck. For instance, the C# language specification actually talks about a new operator, and specifies its precedence, but when actually specifying its meaning only talks about the 3 expression types than can be formed with a new keyword (object creation, array creation, and delegate creation expressions).
type: Answer
downvote count: 0
score: 7

http://stackoverflow.com/comment/35294078
type: AnswerComment
comment on: http://stackoverflow.com/a/22885403
type: Comment
has text: Update your question with your new code so I can take a look.
score: 0

http://stackoverflow.com/a/22917218
has comment: http://stackoverflow.com/comment/34982427
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34984291
has comment: http://stackoverflow.com/comment/34982047
has comment: http://stackoverflow.com/comment/34983763
type: Answer
has comment: http://stackoverflow.com/comment/34984357
has comment: http://stackoverflow.com/comment/34984278
has comment: http://stackoverflow.com/comment/34983508
has comment: http://stackoverflow.com/comment/34985270
has comment: http://stackoverflow.com/comment/34985432
has comment: http://stackoverflow.com/comment/34982480
answers question: http://stackoverflow.com/q/22915179
has comment: http://stackoverflow.com/comment/34986272
accepted answer of: http://stackoverflow.com/q/22915179
has comment: http://stackoverflow.com/comment/34982314
has comment: http://stackoverflow.com/comment/34982347
score: 0
has body: I had some trouble with a lot examples that simply compared [...] it.groupId is not a String. You'll need something like it.groupId.value(), or perhaps it.groupId[0].value(). Can I extract the functionality for dependency management into a more system wide script, that can be reused from all other projects, that need this dependency management? How? You can write a plugin class, and ship it to builds as a Jar. For details, see the Gradle User Guide. During compileJava I get the warning :compileJavawarning: [options] bootstrap class path not set in conjunction with -source 1.7 What does this mean, and how can I fix that. This question has been asked and answered many times already. See Stack Overflow or http://forums.gradle.org. PS: Instead of rewriting Ivy to Maven version range syntax, it should be possible to use Maven syntax from the start (i.e. in the build script).

http://stackoverflow.com/a/22966400
has comment: http://stackoverflow.com/comment/35067415
has comment: http://stackoverflow.com/comment/35068700
downvote count: 0
has comment: http://stackoverflow.com/comment/35068921
type: Answer
score: 1
upvote count: 1
has body: The below is the working code. public class QuickSort{ int arr[] = {12,9,4,99,120,1,3,130,13}; public static void main(String args[]) { QuickSort qs = new QuickSort(); qs.quickSort(qs.arr,0,qs.arr.length-1); System.out.println(""); } void quickSort(int arr[],int left,int right) { int i = left, j = right; int tmp;int p; int pivot = arr[(left + right) / 2]; System.out.println(""); for(p=0;p&lt;arr.length;p++) { System.out.print(arr[p] + " "); }System.out.println("\n\nPivot = " +pivot+" Left= "+left+" j= " +j+ " I= "+i+ " Right= "+right+" {before entering do-while}\n"); /* partition */ while (i &lt;= j) { while (arr[i] &lt; pivot) i++; while (arr[j] &gt; pivot) j--; if (i &lt;= j) { tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; i++; j--; } /*for(p=0;p&lt;arr.length;p++) { System.out.print(arr[p]+" "); } System.out.println();*/ } for(p=0;p&lt;arr.length;p++) { System.out.print(arr[p]+" "); } System.out.println("\n\nPivot = " +pivot+" Left= "+left+" j= " +j+ " I= "+i+ " Right= "+right+" {after each do-while}"); /***********/ /* recursion */ if (left &lt; j){ System.out.println("\nInside First if Left = "+left+ " J = " +j); quickSort(arr, left, j); } if (i &lt; right){ System.out.println("\nInside Second if i = " +i+ " Right = " +right); quickSort(arr, i, right); } /*******/ } }
answers question: http://stackoverflow.com/q/22966098
has comment: http://stackoverflow.com/comment/35068810

http://stackoverflow.com/comment/34942727
score: 0
type: Comment
type: QuestionComment
has text: @melar, that contredicts your question: "the methods of Addresbookdatastore which is implemented by the class Addresbook", if Addressbook implements the interface, you can cast your `object` into that interface and the call the methods
comment on: http://stackoverflow.com/q/22896741

http://stackoverflow.com/a/22853499
has comment: http://stackoverflow.com/comment/34864115
score: 2
has comment: http://stackoverflow.com/comment/34864087
has comment: http://stackoverflow.com/comment/34865141
has body: PART 1 You could create a custom TextView. For the text color to be set the fastest, set the global color in your application class. (Not main activity) public class ColorTextView extends TextView { private static int color = Color.BLUE; public ColorTextView(Context context) { super(context); this.setTextColor(color) } public ColorTextView(Context context, AttributeSet attrs) { super(context, attrs); this.setTextColor(color) } public ColorTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.setTextColor(color) } public static void setGlobalColor(int newcolor) { color = newcolor; } } And use it in the xml like: &lt;your.package.name.ColorTextView //other stuff /&gt; And finally you can set color in your code like: ColorTextView.setGlobalColor(yourColor); PART 2 Setup an application class like the following and paste the usepreferences() code into it. public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); // paste code and set color here } } Finally, for this to run, you'll have to declare it in your Manifest in the application tag: android:name="your.package.name.MyApplication"
downvote count: 0
answers question: http://stackoverflow.com/q/22853386
has comment: http://stackoverflow.com/comment/34865812
has comment: http://stackoverflow.com/comment/34864184
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34865662
accepted answer of: http://stackoverflow.com/q/22853386
has comment: http://stackoverflow.com/comment/34864226
upvote count: 2
type: Answer

http://stackoverflow.com/comment/34829764
has text: @ Salah Yeah it pretty much solved the whole error problem.Do we always have to mention this when passing an array as input??
comment on: http://stackoverflow.com/a/22834526
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22961593
type: AnsweredQuestion
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/35059803
has title: How to validate "Hangul-Korean" text?
answer count: 1
has answer: http://stackoverflow.com/a/22961817
accepted answer: http://stackoverflow.com/a/22961817
favorite count: 0
score: 6
has body: I want to validate a "Hangul-Korean" text in java. I will be having the "Korean" text in the "String" and calling "matches()" i will be validating the string. The regular expression is to test whether that text is "Korean" and that Korean string characters length is in some range like 10 to 20. I don't want to use any other third party solutions. Thanks in advance.
tagged with: regex
upvote count: 6
tagged with: internationalization

http://stackoverflow.com/a/28903980
upvote count: 1
has body: Note, the code above is very slow. I've found that to optimize the code above it's necessary to make a byte array to store all the data before you put it. Of course, I was working in Xamarin C# so maybe that's why. Anyway, here's my Xamarin code in case anyone has the same problem. public class AndroidBmpUtil { private static int BMP_WIDTH_OF_TIMES = 4; private static int BYTE_PER_PIXEL = 3; /** * Android Bitmap Object to Window's v3 24bit Bmp Format File * @param orgBitmap * @param filePath * @return file saved result */ public static byte[] ConvertAndroidBitmapByteArray(Bitmap orgBitmap, String filePath) { if (orgBitmap == null) { return null; } if (filePath == null) { return null; } //image size int width = orgBitmap.Width; int height = orgBitmap.Height; //image dummy data size //reason : the amount of bytes per image row must be a multiple of 4 (requirements of bmp format) byte[] dummyBytesPerRow = null; bool hasDummy = false; int rowWidthInBytes = BYTE_PER_PIXEL * width; //source image width * number of bytes to encode one pixel. if (rowWidthInBytes % BMP_WIDTH_OF_TIMES &gt; 0) { hasDummy = true; //the number of dummy bytes we need to add on each row dummyBytesPerRow = new byte[(BMP_WIDTH_OF_TIMES - (rowWidthInBytes % BMP_WIDTH_OF_TIMES))]; //just fill an array with the dummy bytes we need to append at the end of each row for (int i = 0; i &lt; dummyBytesPerRow.Length; i++) { dummyBytesPerRow[i] = (byte)0xFF; } } //an array to receive the pixels from the source image int[] pixels = new int[width * height]; //the number of bytes used in the file to store raw image data (excluding file headers) int imageSize = (rowWidthInBytes + (hasDummy ? dummyBytesPerRow.Length : 0)) * height; //file headers size int imageDataOffset = 0x36; //final size of the file int fileSize = imageSize + imageDataOffset; //Android Bitmap Image Data orgBitmap.GetPixels(pixels, 0, width, 0, 0, width, height); //ByteArrayOutputStream baos = new ByteArrayOutputStream(fileSize); ByteBuffer buff…
has comment: http://stackoverflow.com/comment/46202138
has comment: http://stackoverflow.com/comment/46087008
type: Answer
has comment: http://stackoverflow.com/comment/55057887
has comment: http://stackoverflow.com/comment/46216535
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/46196987
answers question: http://stackoverflow.com/q/22909429
has comment: http://stackoverflow.com/comment/46198521

toarray
tags question: http://stackoverflow.com/q/22913122
tags question: http://stackoverflow.com/q/22950778
tags question: http://stackoverflow.com/q/22849897
type: Tag
tag name: toarray

http://stackoverflow.com/a/22935986
has comment: http://stackoverflow.com/comment/35012826
has comment: http://stackoverflow.com/comment/35013577
upvote count: 1
has body: When you use primitive with a Wrapper object, that wrapper object will be unboxed and then the operation will be applied. In your first case, when you comparing sn with isn1, isn1 will be unboxed and the value will be compared. So you got true. In second case, isn1, isn2 are two different object, so == operator will give false
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35013440
answers question: http://stackoverflow.com/q/22935935

http://stackoverflow.com/comment/35001583
score: 0
type: AnswerComment
has text: i did this SimpleDateFormat myFormat = new SimpleDateFormat("dd-mm-yy"); String text1 = myFormat.format(rs.getDate(index1)); text4.setText(text1); But in textfield i'm getting the date as "09-00-14" while in my table it's "09-JAN-14"
type: Comment
comment on: http://stackoverflow.com/a/22929281

http://stackoverflow.com/comment/91250396
has text: @FedericoPiazza: This is quite likely not strictly related to this question, which isn't using spring boot. Would you mind creating a new question?
comment on: http://stackoverflow.com/a/22904434
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22940292
answers question: http://stackoverflow.com/q/22939266
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Look into the collection examples. Modify your code to use collections of hash maps to serialize and deserialize. Serialization: Collection&lt;HashMap&lt;String, String&gt;&gt; details = new List&lt;HashMap&lt;String, String&gt;&gt;(); // add contents String json = gson.toJson(details); Deserialization: String json = // read in file content Type collectionType = new TypeToken&lt;Collection&lt;HashMap&lt;String, String&gt;&gt;&gt;(){}.getType(); Collection&lt;HashMap&lt;String, String&gt;&gt; details2 = gson.fromJson(json, collectionType); In the "Collections limitations" part is written the following: While deserializing, Collection must be of a specific generic type I'm not sure, but that could mean, that you have to to set collectionType to use List and not Collection as specific type.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22939266

http://stackoverflow.com/a/22823838
has comment: http://stackoverflow.com/comment/34990763
downvote count: 0
has comment: http://stackoverflow.com/comment/34838626
has comment: http://stackoverflow.com/comment/34846261
score: 3
has body: What i would like to know is why this regex isn't matching when escaped? When you escape string like "foo\nbar" which printed is similar to foo bar you are getting "foo\\nbar" which printed looks like foo\nbar It happens because StringEscapeUtils.escapeJava escapes also \n and is replacing it with \\n, so it is no longer line separator but simple literal, so it can't be matched with ^ or $. Possible solution could be replacing back "\\n" with "\n" after StringEscapeUtils.escapeJava. You will need to be careful here, not to "unescapee" real "\\n" which after replacing would give you "\\\\n" which printed would look like \\n. So maybe use text = org.apache.commons.lang3.StringEscapeUtils.escapeJava(text); text = text.replaceAll("(?&lt;!\\\\)\\\\n", "\n");// escape `\n` // if it is not preceded with `\` //do your job //and now you can unescape your text (\n will stay \n) text = org.apache.commons.lang3.StringEscapeUtils.unescapeJava(text); Another option could be creating your own implementation similar to StringEscapeUtils.escapeJava. If you take a look at this method body you will see return ESCAPE_JAVA.translate(input); Where ESCAPE_JAVA is CharSequenceTranslator ESCAPE_JAVA = new LookupTranslator( new String[][] { {"\"", "\\\""}, {"\\", "\\\\"}, }).with( new LookupTranslator(EntityArrays.JAVA_CTRL_CHARS_ESCAPE()) ).with( UnicodeEscaper.outsideOf(32, 0x7f) ); and EntityArrays.JAVA_CTRL_CHARS_ESCAPE() returns clone of String[][] JAVA_CTRL_CHARS_ESCAPE = { {"\b", "\\b"}, {"\n", "\\n"}, {"\t", "\\t"}, {"\f", "\\f"}, {"\r", "\\r"} }; array. So if you provide here your own table which will tell explicitly that \n should be left as it is (so it should be replaced with itself \n) your code will ignore it. So this is how your own implementation can look like private static CharSequenceTranslator translatorIgnoringLineSeparators = new LookupTranslator( new String[][] { { "\"", "\\\"" }, { "\\", "\\\\" }, }).with( new LookupTranslator(new String[][] { { "\b", "\\b" }, { "\n",…
has comment: http://stackoverflow.com/comment/34991127
accepted answer of: http://stackoverflow.com/q/22823634
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22823634
upvote count: 3
has comment: http://stackoverflow.com/comment/34817603
has comment: http://stackoverflow.com/comment/34989876
has comment: http://stackoverflow.com/comment/34844898
type: Answer

http://stackoverflow.com/comment/34966291
score: 0
type: Comment
type: QuestionComment
has text: I tried using ui:repeat but I was unable update any component by ID in an AJAX call, also I have tried p:datalist but the problem is that i need to know the exact component ID, as in another part of the page i'm using an overlay panel (which needs to know the exact component ID in the for attribute), and while searching as i understood that c:foreach is the right choice as it works on the build time while others work on the rendering time.
comment on: http://stackoverflow.com/q/22908896

android-radiogroup
tags question: http://stackoverflow.com/q/22828675
type: Tag
tag name: android-radiogroup

http://stackoverflow.com/a/22912254
upvote count: 9
downvote count: 0
has body: It's not a bug. From the docs: The length of the displayed values array must be equal to the range of selectable numbers which is equal to getMaxValue() - getMinValue() + 1. Your maxValue is 100, and minValue is 1. So, just use this instead: numberPicker.setMaxValue(14); numberPicker.setMinValue(0); You can also take a look here
score: 9
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22911819
answers question: http://stackoverflow.com/q/22911819
type: Answer

http://stackoverflow.com/a/25510760
type: AcceptedAnswer
type: Answer
has body: After a lot of time working on it, I found out that if it worked on Mac it didn't on windows, and if it worked in windows it didn't on Mac. So, basically, java's multi-platform as long as the virtual machine's fine with it.
accepted answer of: http://stackoverflow.com/q/22883670
answers question: http://stackoverflow.com/q/22883670
score: 0

http://stackoverflow.com/comment/34933538
has text: Spring MVC's `RequestMappingHandlerAdapter` provides a list of `HandlerMethodReturnValueHandler`s so you don't have to resort to AOP. I would use AOP only if it's the last possible solution.
score: 0
comment on: http://stackoverflow.com/a/22891575
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34792664
score: 1
has text: Do you mean that you want to process events in the component **and** propagate the event to component's parent after that? Or do you want the parent to disable the child's component listener?
comment on: http://stackoverflow.com/q/22813488
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35024315
comment on: http://stackoverflow.com/q/22942199
type: Comment
score: 0
has text: note: (the code is all the Main Activity of the app)
type: QuestionComment

http://stackoverflow.com/comment/34806449
type: QuestionComment
comment on: http://stackoverflow.com/q/22821258
score: 0
has text: @Steinar: Exactly, specially when he/she is talking about implementing some **design pattern**.
type: Comment

http://stackoverflow.com/q/22838271
has comment: http://stackoverflow.com/comment/34837637
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22844966
linked to: http://stackoverflow.com/q/5492405
score: 0
has title: Simple echo java client server program
answer count: 1
has answer: http://stackoverflow.com/a/22844966
has body: I am trying to make a simple echo client server program. I am able to send the value from client to server and print it . But I am not able to get the value back from server to client This is the code below Client code public class Client_1 { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { System.out.println("client signing on"); Socket soc = new Socket("127.0.0.1", 5556); t t = new t(soc); Thread t1 = new Thread(t); t1.start(); OutputStream os = soc.getOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(os); BufferedWriter bw = new BufferedWriter(osw); PrintWriter pw = new PrintWriter(bw, true); InputStream is = System.in; InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String s = br.readLine(); while (!s.equals("end")) { // System.out.println(s); pw.println(s); s = br.readLine(); } pw.println("end"); System.out.println("client signing off"); } } class t implements Runnable { static Socket soc; static String read; public t(Socket soc) { this.soc = soc; } @Override public void run() { try { System.out.println("conn established"); InputStream is = soc.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String s = br.readLine(); while (!s.equals("end")) { System.out.println(s); s = br.readLine(); } } catch (IOException ex) { } } } server code public class server { static Socket soc; static String r; static BufferedReader br; /** * @param args the command line arguments */ public static void main(String[] args) { try { System.out.println("server signing on"); ServerSocket ss = new ServerSocket(5556); soc = ss.accept(); InputStream is = soc.getInputStream(); InputStreamReader isr = new InputStreamReader(is); OutputStream os; os = soc.getOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(os); BufferedWriter bw = new BufferedWriter(osw); PrintWriter pw = new PrintWriter(bw,true); …

http://stackoverflow.com/comment/34827647
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22832855
has text: +1. But I don't think the code will "check whether the string pool already has the same string". The classloader should do that when the code is loaded. When it is run, it already points to a pooled instance.

http://stackoverflow.com/comment/35067787
type: AnswerComment
has text: In fact, in this case the very next permutation in lexicographical order is even, so this just makes a few trips through the digits.
type: Comment
comment on: http://stackoverflow.com/a/22958898
score: 0

http://stackoverflow.com/comment/70751340
has text: this is my favoured answer. you basically end up nesting an observable IN an observable IF that is what your method returns.
type: Comment
comment on: http://stackoverflow.com/a/37354549
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34925107
has text: @Kairos well yes -- how can you have an unmappable _character_ while decoding a _byte_ array? Since a decoder tries and turns a byte sequence into a legal char sequence
score: 0
comment on: http://stackoverflow.com/a/22886924
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34795351
comment on: http://stackoverflow.com/a/22815081
type: AnswerComment
score: 0
type: Comment
has text: Jeroen : sorry misread your question. staticx : The new array will only creates null references so I think it's the fastest you can get.

http://stackoverflow.com/comment/34869701
has text: the problem was in usage of xpath locator (//td/div/a) to find links in table cells. I just have replaced xpath to css, and the result was the same as expected.
type: AnswerComment
comment on: http://stackoverflow.com/a/22812666
score: 0
type: Comment

http://stackoverflow.com/comment/34919970
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22884235
has text: What about the slider value?

http://stackoverflow.com/q/22898756
has title: Is it good to separate game thread and display thread?
linked to: http://stackoverflow.com/q/22346385
upvote count: 2
has body: It is the first time I want to write a java game, and I chose to do a Snake Line. I learnt from a piece of source code from online. It updates the game states and displays in one thread. I changed around that code, and when I changed the FPS (from 60 to 30), animation slows down. More to this, the game behavior changes too. It is duck shooting game, and the space between ducks get narrower. So I decided to separate the game thread and the display thread to avoid the above problem. But then I realize it brings out the concurrency problem which will be all over the place. So as the title indicates, is it good to separate game thread and display thread? What is the common practice and why?
tagged with: multithreading
downvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: concurrency
type: Question
has answer: http://stackoverflow.com/a/22898959
answer count: 1
accepted answer: http://stackoverflow.com/a/22898959
favorite count: 0

http://stackoverflow.com/comment/34823090
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22830315
has text: Ah, ok. That's not what I wanted. Now I will try your solution Sirko.

http://stackoverflow.com/comment/34827827
comment on: http://stackoverflow.com/a/22833360
score: 0
type: AnswerComment
type: Comment
has text: I move onActivityResult() in my Fragment but is not called too.

http://stackoverflow.com/a/22953981
accepted answer of: http://stackoverflow.com/q/22953700
answers question: http://stackoverflow.com/q/22953700
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35065427
has comment: http://stackoverflow.com/comment/35072696
has comment: http://stackoverflow.com/comment/35076384
type: Answer
has comment: http://stackoverflow.com/comment/35072807
has comment: http://stackoverflow.com/comment/35065690
downvote count: 0
score: 1
has body: Apart from what Dimitri stated, your log seems to indicate that you are using Apache Tomcat/6.0.39 That version of Tomcat does not support ServletContainerInitializer which your Spring web application depends on for configuration. Upgrade to a Tomcat version 7+. It seems like the Maven update doesn't work for you (or for me). First, go into Properties -&gt; Deployment Assembly. You need to get rid of Web Content if it's there and add src/main/webapp (which is a maven convention). You also need to add the Maven Dependencies as shown below. Finally, and this might not be necessary, delete the web.xml provided to you and re-create it by selecting and right clicking Deployment Descriptor in the Project Explorer and clicking Generate Deployment Descriptor Stub. Also, make sure your Java Build Path in the Properties has a Java 7+ version of the JRE.

http://stackoverflow.com/comment/34841535
has text: Another point: as you use unique (UUID) keys you don;t need Concurrent map at all, ordinary HashMap will do the job. And - **don't** use `Iterator`, foreach loop is more than sufficient.
score: 0
comment on: http://stackoverflow.com/q/22840723
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22912547
score: 3
tagged with: ejb
has body: I have created a web based application using JSP and Servlets and the application uses an SQL Server DB as its backend. The architecture is like this: I have all my business logic in a jar file I have created my views using JSPs and am using servlets to interact with my business logic jar The jar connects to the database to persist and hydrate information, which is relayed to the JSP by my servlets. My web application runs on a remote Tomcat server. Now, I have been given a new requirement. I have to create a command line interface, where I should be able to specify a list of commands and hit enter (or alternatively, create a set of commands and save it in a .bat file or something, and run it), so that my application performs the necessary actions. Basically, I have to create a command line interface, which can be used along with the GUI i already have (JSPs). I am totally new to this. Can anyone throw light on where and how I can start? Any little help is greatly appreciated. EDIT This is what my web application does. User can see a list of test scripts (written in Selenium WebDriver). He can choose script(s), choose a host on where to run them from, and click "Run", and the test executes on the said machines. Now, I want a command line interface, which will eliminate the need for the GUI. Let's say, I simply want the user to be able to type a command like "execute My_Script_1", and the script should be executed. The test scripts, the selenium drivers, everything reside on the App server. My command line interface should be able to work on Windows command prompt. Thank you.
has answer: http://stackoverflow.com/a/22966940
upvote count: 3
has answer: http://stackoverflow.com/a/22912743
favorite count: 0
has answer: http://stackoverflow.com/a/22912853
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34970594
has comment: http://stackoverflow.com/comment/34970245
tagged with: command-line
tagged with: command-prompt
downvote count: 0
has comment: http://stackoverflow.com/comment/34970477
has title: How to build a command line interface in java for an existing web based application
tagged with: java
has answer: http://stackoverflow.com/a/22914017
type: Question
has answer: http://stackoverflow.com/a/22912868

http://stackoverflow.com/a/22826249
has body: Please try this: int initial; int last; this.initial=initial; this.last = limit; resultSet = statement.executeQuery("select * from weibo_olympics Limit "+initial+","+last); Hope this help
score: 1
answers question: http://stackoverflow.com/q/22824806
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/30211236
answers question: http://stackoverflow.com/q/22929908
has body: Try this sample Code Expandable CheckList
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/35034743
type: Comment
has text: I think he's asking about the differences between [abstract classes and interfaces](http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html).
type: QuestionComment
comment on: http://stackoverflow.com/q/22947781
score: 0

http://stackoverflow.com/comment/35031559
type: QuestionComment
comment on: http://stackoverflow.com/q/22945544
has text: You want to execute queries: http://docs.jboss.org/hibernate/core/4.3/manual/en-US/html_single/#objectstate-querying
score: 0
type: Comment

http://stackoverflow.com/comment/34796682
has text: @staticx, thanks. I've fixed it using nanoseconds. (but not that the high number of iterations reduce the error produced by the currentTimeMillis method).
type: AnswerComment
comment on: http://stackoverflow.com/a/22815568
score: 0
type: Comment

http://stackoverflow.com/a/22856000
score: 2
upvote count: 3
downvote count: 1
has body: Have a look at: Preferences | Java | Compiler | Errors/Warnings | Deprecated and Restricted API Make sure Deprecated API is set to Warning. Ensure the code which is deprecated has a @Deprecated annotation either at the class / method or in the JavaDoc.
type: Answer
answers question: http://stackoverflow.com/q/22855836

http://stackoverflow.com/q/22960648
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22961990
tagged with: nullpointerexception
tagged with: jlist
has answer: http://stackoverflow.com/a/22961990
possible better answer: http://stackoverflow.com/a/22960908
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35056708
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35056887
has body: I'm pretty new to Java, and I'm trying to populate my JList with data from a database. The data is retrieved from the database via the method visKunder() in the Database class. public ArrayList&lt;Kunde&gt; visKunder(){ String s1 = "select kundenavn, adresse, telefon from kunde"; Statement setning = null; String kundenavn = null; String adresse = null; int telefon = 0; ResultSet res = null; ArrayList&lt;Kunde&gt; kunder = new ArrayList&lt;&gt;(); try{ forbindelse.setAutoCommit(false); setning = forbindelse.createStatement(); res = setning.executeQuery(s1); while(res.next()){ kundenavn = res.getString("kundenavn"); adresse = res.getString("adresse"); telefon = res.getInt("telefon"); Kunde kunde = new Kunde(kundenavn, telefon, adresse); kunder.add(kunde); } forbindelse.commit(); }catch(SQLException error){ Opprydder.rullTilbake(forbindelse); Opprydder.skrivMelding(error, "visKunder()"); }finally{ Opprydder.lukkSetning(setning); Opprydder.lukkResSet(res); try { forbindelse.setAutoCommit(true); } catch (SQLException ex) { Opprydder.skrivMelding(ex, "setAutoCommit()"); } } return kunder; } The problem occurs when I invoke visKunder() in the GUI class RegVedKjøp. printStackTrace() lists visKunder() as the problem for the NullPointerException. public class RegVedKjøp extends javax.swing.JFrame { private static Database d1; public RegVedKjøp(Database d1) { initComponents(); this.d1 = d1; } private void initComponents(){ ... JList jList2 = new JList(); fyllListe(jList2); ... } private void fyllListe(JList list){ ArrayList&lt;Kunde&gt; kunder = d1.visKunder(); list = new JList(kunder.toArray()); } I don't know if it's relevant, but I used NetBeans' GUI Builder to design the GUI. Any tips on how to fix this issue would be very appreciated. EDIT: private void initComponents() { scrollbar1 = new java.awt.Scrollbar(); lagreKnapp = new javax.swing.JButton(); tKnapp = new javax.swing.JButton(); label1 = new java.awt.Label(); jLabel2 = new javax.swing.JLabel(); txtType = new javax.s…
has comment: http://stackoverflow.com/comment/35056798
tagged with: database
has answer: http://stackoverflow.com/a/22960908
has title: AWT-EventQueue-0 NullPointerException
has comment: http://stackoverflow.com/comment/35056755
tagged with: awt-eventqueue

http://stackoverflow.com/comment/34982548
score: 0
type: Comment
has text: @Gary it is indeed strange enough that `Files` does not have a recursive deletion method... That sounds like an obvious thing to have. But it probably isn't. How to deal with errors, for instance...
comment on: http://stackoverflow.com/a/22919054
type: AnswerComment

http://stackoverflow.com/comment/34922274
type: AnswerComment
comment on: http://stackoverflow.com/a/22885536
has text: Hi Merlin excellent code suggestion and thank you for implementing Masud's code. I updated my original post since I keep getting errors
type: Comment
score: 0

http://stackoverflow.com/q/22936139
has title: RuntimeVisibleAnnotations and RuntimeInvisibleAnnotations - How to access from code?
has comment: http://stackoverflow.com/comment/35399857
has answer: http://stackoverflow.com/a/23013020
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 8
accepted answer: http://stackoverflow.com/a/23013020
tagged with: jvm
tagged with: attributes
tagged with: annotations
has body: Section 4.7.16 of the JVM specification includes a description of "RuntimeVisibleAnnotations". I am wondering what can cause an attribute to be included in this attributes table, is this only by applying @Retention(RetentionPolicy.RUNTIME) on an attribute? Conversely, for "RuntimeInvisibleAnnotations" (see further in 4.7.17) is this @Retention(RetentionPolicy.CLASS) only or is it also @Retention(RetentionPolicy.SOURCE) ?
type: AnsweredQuestion
tagged with: java
type: Question
score: 8

http://stackoverflow.com/comment/35015147
type: Comment
type: QuestionComment
has text: What is not working exactly? What are you trying to do? Btw, there is no battlecruiser variable.
comment on: http://stackoverflow.com/q/22937199
score: 0

http://stackoverflow.com/q/22871017
has title: Java Array input and length
tagged with: arrays
has body: Does a Java Array have to be assigned a length in the beginning? or can it be dynamic and accept unlimited amounts of data until the user decides that is enough? Everywhere I look the length is always defined... example public static void main(String[] args) { int a[] = new int[10]; System.out.println("Please enter your number: "\n); } Instead of having 10, is it possible to say at a time in the future when the user decides by entering a certain number, like -1, the array is complete? Therefore, a user can continue to input information because they do not know how much information they will enter into the array. I did find in one place using (int ... number), is this a viable way of declaring no declared amount?
has answer: http://stackoverflow.com/a/37005079
has comment: http://stackoverflow.com/comment/34895458
has answer: http://stackoverflow.com/a/22871049
score: 0
has answer: http://stackoverflow.com/a/22871145
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/22871147
tagged with: java
type: Question

http://stackoverflow.com/q/22849868
tagged with: websphere
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/32392039
favorite count: 0
has comment: http://stackoverflow.com/comment/34888721
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34892769
has body: I am trying to get Mojarra 2.2.6 (or MyFaces 2.2.2, same exception on both) up and running in Websphere 8.5. I've set the class loader setting correctly to PARENT_LAST and SINGLE as usual. The new jars are being picked up successfully but the following pesky exception is being thrown and causing the app to not start. Any help is appreciated, Thanks! An exception occurred while validating an annotation: com.ibm.wsspi.amm.validate.ValidationException: SRVE8016E: The @MultipartConfig annotation can not be applied to the class, javax.faces.webapp.FacesServlet, because it extends the wrong super class full stack trace 4/3/14 17:21:16:800 EDT] 00000715 annotations E CWWAM0003E: An exception occurred while validating an annotation: com.ibm.wsspi.amm.validate.ValidationException: SRVE8016E: The @MultipartConfig annotation can not be applied to the class, javax.faces.webapp.FacesServlet, because it extends the wrong super class com.ibm.wsspi.amm.validate.ValidationException: SRVE8016E: The @MultipartConfig annotation can not be applied to the class, javax.faces.webapp.FacesServlet, because it extends the wrong super class at com.ibm.ws.webcontainer.annotation.validator.MultipartConfigValidator.validateClassAnnotation(MultipartConfigValidator.java:44) at com.ibm.ws.webcontainer.annotation.validator.MultipartConfigValidator.validateClassAnnotation(MultipartConfigValidator.java:39) at com.ibm.ws.webcontainer.annotation.validator.MultipartConfigValidator.validate(MultipartConfigValidator.java:35) at com.ibm.wsspi.amm.merge.AbstractMergeAction.mergeClassTargets(AbstractMergeAction.java:353) at com.ibm.wsspi.amm.merge.AbstractMergeAction.merge(AbstractMergeAction.java:123) at com.ibm.ws.amm.AnnotativeMetadataManagerImpl.performMergeOperations(AnnotativeMetadataManagerImpl.java:509) at com.ibm.ws.amm.AnnotativeMetadataManagerImpl.merge(AnnotativeMetadataManagerImpl.java:274) at com.ibm.ws.amm.commonarchive.AnnotationsProcessorImpl.merge(AnnotationsProcessorImpl.java:144) at com.ibm…
tagged with: jsf
has answer: http://stackoverflow.com/a/25740453
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/18544763
upvote count: 1
tagged with: mojarra
tagged with: myfaces
type: Question
has title: Websphere 8.5.5.1 JSF 2.2 @MultipartConfig
has answer: http://stackoverflow.com/a/23495056

http://stackoverflow.com/comment/34927789
comment on: http://stackoverflow.com/q/22888720
score: 0
type: Comment
has text: Actually I think I just got it, but any more explanation would help.
type: QuestionComment

http://stackoverflow.com/comment/35199384
type: QuestionComment
has text: This is encrypted key (TripleDES with CBC mode and input vector 68949227DD8A502D). Thus, before PEMReader can read it, it must be decrypted first.
type: Comment
comment on: http://stackoverflow.com/q/22920131
score: 0

http://stackoverflow.com/a/22867806
has comment: http://stackoverflow.com/comment/34938748
upvote count: 1
answers question: http://stackoverflow.com/q/22850457
score: 1
has comment: http://stackoverflow.com/comment/34941490
has body: I would say don't worry about scaling them up and making the virtual resolution bigger. If you want to see picture still pixelated when you scale it use Texture filter. For your case you want to use Nearest filter. use it like this: yourTexture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest); where yourTexture is the texture that you have all your bitmaps and skin elements on. If you are using texturePacker than you can specify the filter before packing too. Or just open the .pack file and on the top you will see filtering options, and edit those to Nearest.
downvote count: 0
type: Answer

http://stackoverflow.com/a/22870911
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I reworked your myTimer() method and found that calling cancel() on the Timer instance (instead of the TimerTask) correctly stops the Timer. This happens because invoking cancel() on the TimerTask may cancel the task, but not the timer. The below code shows the class I used to test with. public class TimerTest { public static final int TIMEOUT = 5; private static Timer timer; public static void main(String[] args) { // Creates and starts the Timer. The TimerTask cancels the Timer when // it's done, so we don't need to keep a reference to it. timer = myTimer(TIMEOUT); try { // Suppose the correct answer is given after 2.5 seconds Thread.sleep(2500); } catch (InterruptedException e) { } timer.cancel(); System.out.println("Timer interrupted by main"); } public static Timer myTimer(final int timeout) { // We keep the Timer instance with the TimerTask, to prevent us from // having to worry about managing multiple timers. Each Timer is // guaranteed to stop when sec drops to 0. final Timer t = new Timer(); TimerTask timerTask = new TimerTask() { // We keep the current time in each TimerTask. This ensures that // multiple TimerTasks will not interfere with each other. private int sec = timeout; @Override public void run() { sec--; if (sec &lt; 0) { t.cancel(); // cancel the Timer here. System.out.println("Timer stopped by TimerTask"); } else { // Replace this with whatever you do each second System.out.println("Current time: " + (sec &lt; 10 ? "0" : "") + sec + " seconds"); } } }; t.schedule(timerTask, 1000, 1000); return t; } } Running the example starts a Timer, and then stops it after 2.5 seconds (this also exits the JVM, as there are no more running Threads). Changing t.cancel() in the TimerTask to this.cancel() seems to cancel the task (nothing is printed anymore), but fails to cancel the timer (the JVM keeps running).
answers question: http://stackoverflow.com/q/22869081
score: 1
accepted answer of: http://stackoverflow.com/q/22869081

http://stackoverflow.com/a/22963500
downvote count: 0
has comment: http://stackoverflow.com/comment/35062787
has comment: http://stackoverflow.com/comment/35062118
upvote count: 2
type: Answer
has body: As far as I know, the Repository is meant for directly accessing the database. This is where direct calls to the stored procedures or whatever your data storage mechanism is will be. The service layer is the API to your data. There is usually some logic level that you would do hear, or in another layer of abstraction between the service and the repository. For example, a website would call a method in your service. Your service would call your repository for getting that data, then your service would transform it somehow (build objects, generate dynamic information based on business rules, etc.) then pass that back up to the website.
score: 2
answers question: http://stackoverflow.com/q/22963352

http://stackoverflow.com/q/22832563
linked to: http://stackoverflow.com/q/4773778
has body: I want to create a zip file and write it the data from InputStream and save it in a specified folder in java. How can I achieve it?
type: UnansweredQuestion
has title: How can I write a zip file using InputStream (uploaded file) in Java?
answer count: 0
tagged with: java
tagged with: fileoutputstream
has comment: http://stackoverflow.com/comment/34826325
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34826237
tagged with: file-io
tagged with: fileinputstream
tagged with: outputstream

http://stackoverflow.com/comment/34927013
type: Comment
score: 0
has text: @Jeff you are wrong. It is initialized if it's an instance variable.
type: AnswerComment
comment on: http://stackoverflow.com/a/22888276

http://stackoverflow.com/comment/35295186
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/50718/discussion-between-joaofilipeclementemartins-and-dcharms)
comment on: http://stackoverflow.com/a/22885403
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22907629
has comment: http://stackoverflow.com/comment/34962037
has body: Renaming the field variable is the most convenient way. Take a look on Android Code Style Guideline. They suggest to name all static fields like sVariable. It's not ugly and very understandable. So, it would be like this: private static int sVar; public static void setVar(int var) { sVar = var; }
type: Answer
has comment: http://stackoverflow.com/comment/34962636
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/54084593
answers question: http://stackoverflow.com/q/22907470
upvote count: 2

http://stackoverflow.com/q/22836655
tagged with: applet
has title: run time error while checking this code
has comment: http://stackoverflow.com/comment/34833652
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34833259
type: UnansweredQuestion
has body: Here i am not able to read the integer value,can anyone suggest me what is the problem in thios code.iam trying to write calculator code here step by stem i chewcking the eroor, while checkig the code whether it will take integer input from butten anfd textfield,here if i remove int cv=Integer.parseInt(t.getText()); code will work fine if add it it is giving error import java.awt.*; import java.applet.Applet; import java.awt.event.*; public class ca_today extends Applet implements ActionListener{ TextField t = new TextField(5); String str[] = {"+","-","/","%","*","&lt;-","1/x","=","C",".","MR","MS"}; Button b[]= new Button[12]; Button b1[]= new Button[10]; Button exit = new Button("EXIT"); String pv,op; public void init() { setBackground( Color.CYAN ); t.setBackground(Color.yellow); Panel p = new Panel(); p.add(t); t.addActionListener(this); p.setLayout(new GridLayout(3,6)); for( int i = 0 ; i &lt; 10; i++ ){ b1[i]=new Button(""+i); p.add(b1[i]); b1[i].addActionListener(this); } for(int j = 0 ; j &lt;12; j++ ){ b[j]=new Button(str[j]); p.add(b[j]); b[j].addActionListener(this); } p.add(exit); exit.addActionListener(this); add(p); } public void actionPerformed(ActionEvent a){ int res=0; String c=a.getActionCommand(); int cv=Integer.parseInt(t.getText());//takes the i/p from textarea t.setText(""+cv); } }
linked to: http://stackoverflow.com/q/6255106
tagged with: java
has comment: http://stackoverflow.com/comment/34864991
type: Question
has answer: http://stackoverflow.com/a/22836934

http://stackoverflow.com/q/22903465
has answer: http://stackoverflow.com/a/22903478
has answer: http://stackoverflow.com/a/22903547
tagged with: null
has answer: http://stackoverflow.com/a/22903489
has answer: http://stackoverflow.com/a/22903912
score: 0
has comment: http://stackoverflow.com/comment/34955017
tagged with: string
has answer: http://stackoverflow.com/a/22903476
answer count: 5
type: UnansweredQuestion
has body: I am reading CSV file and inserting into table.but when I get completdate as null I want to insert default date.i checked this if(COMPLETEDATE == null){ css.setString(24, "2013-06-12 00:00:00.0"); }else{ css.setString(24, COMPLETEDATE); } Here is the whole function. public void ImportCSV() { String csvFile = "C:\\seema\\CSV Files\\2013\\August\\15.csv"; BufferedReader br = null; String line = ""; String cvsSplitBy = ","; String PRODLINE,EMPID,EMPFNAME,SHIFT,STATIONID,CURWKDATE,OPCODE,OPDESC,STARTWORKTIME,ENDWORKTIME,PIECECNT, BUNDLECNT,PIECERATE,SAM,SKILLLEVEL,DAILYBONUS,NORMALRATE,OVERTIMERATE,WORKDURATION,MONO,DESIGNCODE, DESIGNCOLOR,DESIGNSIZE,COMPLETEDATE; int i=0; try { br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { try { PreparedStatement css = null; css= conn.prepareStatement("exec uspInsertEWLProduction ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?"); String[] country = line.split(","); PRODLINE=country[0]; EMPID=country[1]; EMPFNAME =country[2]; SHIFT=country[3]; STATIONID=country[4]; CURWKDATE =country[5]; OPCODE=country[6]; OPDESC=country[7]; STARTWORKTIME =country[8]; ENDWORKTIME=country[9]; PIECECNT=country[10]; BUNDLECNT =country[11]; PIECERATE=country[12]; SAM=country[13]; SKILLLEVEL =country[14]; DAILYBONUS=country[15]; NORMALRATE=country[16]; OVERTIMERATE =country[17]; WORKDURATION=country[18]; MONO=country[19]; DESIGNCODE =country[20]; DESIGNCOLOR=country[21]; DESIGNSIZE=country[22]; COMPLETEDATE =country[23]; if(i!=0) { css.setString(1, PRODLINE); css.setString(2, EMPID); css.setString(3, EMPFNAME); css.setString(4, SHIFT); css.setString(5, STATIONID); css.setString(6, CURWKDATE); css.setString(7, OPCODE); css.setString(8, OPDESC); css.setString(9, STARTWORKTIME); css.setString(10, ENDWORKTIME); css.setString(11, PIECECNT); css.setString(12, BUNDLECNT); css.setString(13, PIECERATE); css.setString(14, SAM); css.setString(15, SKILLLEVEL); css.setString(16, DAILYBONUS); css.setString(17, NORMALRATE); css.…
has title: Handle null string in java
tagged with: java
has comment: http://stackoverflow.com/comment/34954398
has comment: http://stackoverflow.com/comment/34954475
type: Question

semaphore
type: Tag
tags question: http://stackoverflow.com/q/22834614
tags question: http://stackoverflow.com/q/22871800
tag name: semaphore

http://stackoverflow.com/q/22852758
tagged with: arrays
has answer: http://stackoverflow.com/a/69043594
has comment: http://stackoverflow.com/comment/34906622
upvote count: 2
has body: I am finishing up a program but having a bit of trouble with one last aspect. In this part of the program, I am testing to see if the array is jagged (same number of rows and columns). I want to use a nested for loop to do this but am having trouble with the logic and structure. For example, the following array is jagged: 1, 2, 3 4, 5, 6 7, 8, 9, 10 And the following array is not: 1, 2, 3 4, 5, 6 7, 8, 9 Can anyone offer guidance on how to do this?
has answer: http://stackoverflow.com/a/26475090
accepted answer: http://stackoverflow.com/a/22874074
favorite count: 0
has title: Checking to see if a 2d array is jagged
linked to: http://stackoverflow.com/q/46917834
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/22874074
answer count: 4
type: AnsweredQuestion
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/10271540
tagged with: java
type: Question
tagged with: jagged-arrays
has answer: http://stackoverflow.com/a/67014825
has comment: http://stackoverflow.com/comment/34863195
possible better answer: http://stackoverflow.com/a/26475090

http://stackoverflow.com/a/22868793
answers question: http://stackoverflow.com/q/22868648
type: Answer
has comment: http://stackoverflow.com/comment/34891771
has comment: http://stackoverflow.com/comment/34908072
upvote count: 2
has comment: http://stackoverflow.com/comment/34897027
has comment: http://stackoverflow.com/comment/34906790
score: 2
has comment: http://stackoverflow.com/comment/34891879
has comment: http://stackoverflow.com/comment/34906310
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22868648
has body: You should specify the timezone, too (and also the english locale for safety): &lt;h:outputText value="#{someBean.endDate}"&gt; &lt;f:convertDateTime pattern="d MMM yyyy" timeZone="GMT" locale="en" /&gt; &lt;/h:outputText&gt; Hereby I assume that the input is in UTC-timezone (that is the literal date was originally stored relative to UTC), so using the same offset for output format will not change the date (and your intermedium output of "5/1/2014" was just the default US-format changed by the same offset effect). If you have stored your date using another timezone conversion then you have to adjust the timeZone-attribute (for example "Europe/London"). UPDATE: I have found this SO-question which should help you, too.

http://stackoverflow.com/q/22951249
type: AnsweredQuestion
score: 0
type: Question
has answer: http://stackoverflow.com/a/22951373
has comment: http://stackoverflow.com/comment/35040943
tagged with: java
has comment: http://stackoverflow.com/comment/35040796
has title: Please arrays, and loops
tagged with: arrays
accepted answer: http://stackoverflow.com/a/22951373
possible better answer: http://stackoverflow.com/a/22951340
has answer: http://stackoverflow.com/a/22951352
answer count: 3
has comment: http://stackoverflow.com/comment/35040704
has answer: http://stackoverflow.com/a/22951340
has comment: http://stackoverflow.com/comment/35040754
has body: A. how do i write this simpler? if (fclass[0] == 0 &amp;&amp; fclass[1] == 0 &amp;&amp; fclass[2] == 0 &amp;&amp; fclass[3] == 0 &amp;&amp; fclass[4] == 0 &amp;&amp; fclass[5] == 0 &amp;&amp; fclass[6] == 0 &amp;&amp; fclass[7] == 0 &amp;&amp; fclass[8] == 0 &amp;&amp; fclass[9] == 0 &amp;&amp; fclass[10] == 0){ }else{ } B. Solved! How would i scan an array (atm all values in it are at 0), when i change some of the element are set to one and show only the ones that have a 0 still. example: if fclass[1], fclass[2], fclass[4], fclass[5], fclass[6], fclass[10], were all set to 1. How would i get my program to show me fclass[3], fclass[7], fclass[8], and fclass[9]? Thanks for the help... for (int f = 0; f &lt;= fclass.length; f++){ if (fclass[f] == 0){ System.out.println(fclass[f]); } C. My teacher requires us to learn GUI but doesn't know it herself, any good websites to start learning that?

http://stackoverflow.com/comment/35000272
has text: From localdate to date?
comment on: http://stackoverflow.com/a/22928347
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22823235
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22820861
type: AcceptedAnswer
downvote count: 0
has body: If the authorization only makes sense to be given to the full list, then to do this you would have to wrap the list in a list wrapper that contains a getId() method: public class ListWrapper { private List&lt;Test&gt; tests; public Serializable getId() { ... some id ... } } To validate one by one, you need to annotate a method only for one test, and not the method with the loop: public void update(List&lt;Test&gt; tests) { for (Test test : tests) { update(test); } } @PreAuthorize("hasPermission(#test, write) or hasAnyRole('ROLE_ADMIN', 'ROLE_SUPERADMIN')") public void update(Test test) { testRepository.save(test); updateDeviceAcl(test); } If you are not using aspectJ compile time or load time weaving to apply the aspects, then put these two methods in separate beans and inject one into the other. Normal JDK or CGLIB proxies will not apply @PreAuthorize (or any other aspect) on reentrant calls.
answers question: http://stackoverflow.com/q/22820861
type: Answer

http://stackoverflow.com/comment/34911795
type: Comment
comment on: http://stackoverflow.com/a/22879717
has text: sir. already fix it. i just added that code to private boolean isGPSEnabled(){} . thnak you so much for helping me in fixing this basic problem but, a little bit harder for me. hehehe More Power Sir. God Bless :)
type: AnswerComment
score: 0

http://stackoverflow.com/a/52157090
type: Answer
has body: It may also be helpful to do: channel.setOption(StandardSocketOptions.SO_REUSEADDR, true); Search for information about this option to learn more.
score: 0
answers question: http://stackoverflow.com/q/22870027

http://stackoverflow.com/a/22884187
answers question: http://stackoverflow.com/q/22884087
downvote count: 0
score: 1
has body: Need the scrollbar to increase to the panel height even when maximized. JPanel panel = new JPanel(new BorderLayout()); This will solve your first problem.
upvote count: 1
type: Answer

http://stackoverflow.com/comment/35047385
has text: Run the C++ version, then the Java version, then the C++ version again. This may catch system caching. (However, 69 seconds is quite long even accounting for disk I/O).
comment on: http://stackoverflow.com/q/22955178
type: Comment
type: QuestionComment
score: 13

http://stackoverflow.com/q/22893583
tagged with: java
has answer: http://stackoverflow.com/a/22893630
possible better answer: http://stackoverflow.com/a/22893605
type: Question
has answer: http://stackoverflow.com/a/22893609
has body: I'm stuck on a (simple, I think) String validation. I use the following method to get a text from an EditText which can have 420 chars and must to contain a specific word (whatever its place): if(edittext.getText().toString().toLowerCase().contains(stringToHave)) { } // stringToHave = the specific String However, I want to improve this condition. For example, you have this: String a = "This not a MetaStackOverflow question"; String b = "stackoverflow"; And you want to know if a contains b regardless is case sensitive, then, you do as follows: if(a.toLowerCase().contains(b)) { } This condition is true because indeed a contains StackOverflow. However, a doesn't contain exactly b, there is a prefix as Meta. And this is not exactly the same word.. I tried to find a way on SO and on other Java websites without result. How can I improve contains() method to find only the exact String without prefix or suffix? Should I use another method (as containsOnly(), I already tried it but it seems that is undefined for String, it's to check if it contains numeric/alphabetic/etc. chars)? EDIT: Add a "two spaces" verification is very attractive and ingenious. However, if the specific text is at the end of the sentence and we add a . this will not work, isn't it? a = "This is great. This is on StackOverflow." // false because we have "."
score: 0
answer count: 3
has title: contains() method without prefix and suffix in Java
tagged with: string
accepted answer: http://stackoverflow.com/a/22893609
has answer: http://stackoverflow.com/a/22893605
type: AnsweredQuestion

http://stackoverflow.com/q/22908520
has answer: http://stackoverflow.com/a/22908575
has comment: http://stackoverflow.com/comment/35005113
linked to: http://stackoverflow.com/q/15145152
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/34963819
has body: I came across this line "some functions are inherently thread-safe, for example memcpy()" Wikipedia defines "thread-safe" as: A piece of code is thread-safe if it only manipulates shared data structures in a manner that guarantees safe execution by multiple threads at the same time. OK. But what does inherently mean? Is it related to inheritance?
score: 36
downvote count: 4
has comment: http://stackoverflow.com/comment/34992306
has answer: http://stackoverflow.com/a/22908573
has comment: http://stackoverflow.com/comment/34984089
has answer: http://stackoverflow.com/a/22913915
has comment: http://stackoverflow.com/comment/34983430
has comment: http://stackoverflow.com/comment/35003156
has answer: http://stackoverflow.com/a/22908712
favorite count: 0
answer count: 5
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34963264
has comment: http://stackoverflow.com/comment/34963700
has comment: http://stackoverflow.com/comment/34963463
has title: What does "inherently thread-safe" mean?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22908573
has comment: http://stackoverflow.com/comment/34984619
has comment: http://stackoverflow.com/comment/34980479
tagged with: java
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/35182319
possible better answer: http://stackoverflow.com/a/22908575
has answer: http://stackoverflow.com/a/22908629
type: Question
upvote count: 40

http://stackoverflow.com/comment/34968134
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22911295
has text: Are you sure that s2 is a String?
type: Comment

helper
tags question: http://stackoverflow.com/q/22852558
tag name: helper
type: Tag

http://stackoverflow.com/a/22870387
answers question: http://stackoverflow.com/q/22870139
has comment: http://stackoverflow.com/comment/34894564
score: 0
has body: Pretty straightforward. The sourcewr raster is larger than the targetwr raster. You are iterating over the length and height of the sourcewr and never check to see if the coordinates are in-bounds for the targetwr. You can check to see if i and j are within bounds or ensure that the rasters are the same size before the nested for loops. e.g., if(i &lt; targetwr.getWidth() &amp;&amp; j &lt; targetwr.getHeight()) { targetwr.setPixels(i, j, 3, 3, pixel); } This is obviously also affected by the variable rate, whatever that is. It's not defined in your code snippet.
type: Answer

robovm
tags question: http://stackoverflow.com/q/22824608
tags question: http://stackoverflow.com/q/22941444
tags question: http://stackoverflow.com/q/22949176
type: Tag
tag name: robovm

class
tags question: http://stackoverflow.com/q/22858074
tags question: http://stackoverflow.com/q/22815953
tags question: http://stackoverflow.com/q/22928733
tags question: http://stackoverflow.com/q/22948234
tags question: http://stackoverflow.com/q/22850759
tags question: http://stackoverflow.com/q/22877921
tags question: http://stackoverflow.com/q/22920070
tags question: http://stackoverflow.com/q/22897311
tags question: http://stackoverflow.com/q/22883558
tags question: http://stackoverflow.com/q/22828320
tags question: http://stackoverflow.com/q/22963859
tags question: http://stackoverflow.com/q/22900910
tags question: http://stackoverflow.com/q/22821663
tags question: http://stackoverflow.com/q/22864211
tags question: http://stackoverflow.com/q/22861374
tags question: http://stackoverflow.com/q/22962856
tags question: http://stackoverflow.com/q/22927706
tags question: http://stackoverflow.com/q/22902151
tags question: http://stackoverflow.com/q/22883297
tags question: http://stackoverflow.com/q/22893152
tags question: http://stackoverflow.com/q/22877473
tags question: http://stackoverflow.com/q/22951702
tags question: http://stackoverflow.com/q/22840259
tags question: http://stackoverflow.com/q/22888771
type: Tag
tags question: http://stackoverflow.com/q/22933263
tags question: http://stackoverflow.com/q/22821711
tags question: http://stackoverflow.com/q/22950587
tags question: http://stackoverflow.com/q/22891421
tags question: http://stackoverflow.com/q/22846942
tags question: http://stackoverflow.com/q/22826945
tags question: http://stackoverflow.com/q/22858268
tags question: http://stackoverflow.com/q/22927388
tag name: class
tags question: http://stackoverflow.com/q/22837700
tags question: http://stackoverflow.com/q/22915805
tags question: http://stackoverflow.com/q/22851439
tags question: http://stackoverflow.com/q/22892665
tags question: http://stackoverflow.com/q/22876234
tags question: http://stackoverflow.com/q/22843536
tags question: http://stackoverflow.com/q/22915588
tags question: http://stackoverflow.com/q/22852187

http://stackoverflow.com/comment/34843567
comment on: http://stackoverflow.com/a/22842351
type: Comment
has text: Well, not exactly at this point.. Maybe after I start with the implementation of this skeleton, it will become Jira specific. now it doesn't matter
score: 0
type: AnswerComment

jdbc-odbc
tags question: http://stackoverflow.com/q/22824809
tag name: jdbc-odbc
tags question: http://stackoverflow.com/q/22904390
type: Tag
tags question: http://stackoverflow.com/q/22945827

http://stackoverflow.com/comment/34929342
score: 0
type: Comment
has text: Bzzzt ... your answer contains `Integer`! But thanks for playing :-)
comment on: http://stackoverflow.com/a/22889005
type: AnswerComment

http://stackoverflow.com/comment/34862009
comment on: http://stackoverflow.com/a/22852095
score: 0
type: Comment
has text: wow thank you! very helpful! Does the System.out.println("Result : "+result); print the result for whichever is true?
type: AnswerComment

http://stackoverflow.com/comment/35047065
type: Comment
comment on: http://stackoverflow.com/a/22954996
has text: You should get an error for Long result, this should be Boolean. since the <String, Void, Boolean>. I get the error remove @Override annotation
score: 0
type: AnswerComment

nullpointerexception
tags question: http://stackoverflow.com/q/22948737
tags question: http://stackoverflow.com/q/22852106
tags question: http://stackoverflow.com/q/22872980
tags question: http://stackoverflow.com/q/22902437
tags question: http://stackoverflow.com/q/22818032
tags question: http://stackoverflow.com/q/22963904
tags question: http://stackoverflow.com/q/22815953
tags question: http://stackoverflow.com/q/22924073
tags question: http://stackoverflow.com/q/22904987
tags question: http://stackoverflow.com/q/22926200
tags question: http://stackoverflow.com/q/22960648
tags question: http://stackoverflow.com/q/22842943
tags question: http://stackoverflow.com/q/22939753
tags question: http://stackoverflow.com/q/22855163
tags question: http://stackoverflow.com/q/22848361
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/22952405
tags question: http://stackoverflow.com/q/22901885
tags question: http://stackoverflow.com/q/22953084
tags question: http://stackoverflow.com/q/22844368
tags question: http://stackoverflow.com/q/22825845
tags question: http://stackoverflow.com/q/22956779
tags question: http://stackoverflow.com/q/22927184
tags question: http://stackoverflow.com/q/22959554
tags question: http://stackoverflow.com/q/22902712
tags question: http://stackoverflow.com/q/22947788
tags question: http://stackoverflow.com/q/22812329
tags question: http://stackoverflow.com/q/22964342
tags question: http://stackoverflow.com/q/22845480
tags question: http://stackoverflow.com/q/22859466
tags question: http://stackoverflow.com/q/22896682
tags question: http://stackoverflow.com/q/22928251
tags question: http://stackoverflow.com/q/22849049
tags question: http://stackoverflow.com/q/22903199
tags question: http://stackoverflow.com/q/22951012
tags question: http://stackoverflow.com/q/22960394
tags question: http://stackoverflow.com/q/22919535
tags question: http://stackoverflow.com/q/22864813
tags question: http://stackoverflow.com/q/22851768
tags question: http://stackoverflow.com/q/22880419
tags question: http://stackoverflow.com/q/22830399
tags question: http://stackoverflow.com/q/22863357

http://stackoverflow.com/comment/34951290
type: Comment
comment on: http://stackoverflow.com/q/22901666
score: 0
type: QuestionComment
has text: thanks for letting me know . so should I assume that ASCII char will use only one byte i.e. output of above program will be always 1 for ASCII charcater ?

http://stackoverflow.com/comment/35593365
has text: I followed below refferences to find out the fix. http://docs.spring.io/spring/docs/2.5.6/reference/jms.html http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/jms.html But unfortunately I couldn't find the exact reason behind of that. According to my understands upgraded struts xwork unable to find the bean id **container** it finds **jmsContainer** I need to get to know what is the reason, where they mentioned it and why it is happening. Appreciate If anyone can give an idea about it. Thanks Andrea Ligios and Lukasz Lenart.
type: Comment
comment on: http://stackoverflow.com/a/22931920
type: AnswerComment
score: 0

http://stackoverflow.com/a/22909977
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/34966402
score: 2
has comment: http://stackoverflow.com/comment/34965881
has body: The MongoClient doesn't create a persistent network connection. It creates a connection when it needs one and closes it again when it doesn't. You won't get a network error message before you actually attempt to do something with a database. The first thing you will usually do in a real-world application after creating a MongoClient is get a database and authenticate to it. That's the first time you will notice when MongoDB is offline.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22909793
answers question: http://stackoverflow.com/q/22909793
has comment: http://stackoverflow.com/comment/34969919

get
tags question: http://stackoverflow.com/q/22844511
tags question: http://stackoverflow.com/q/22920498
type: Tag
tag name: get
tags question: http://stackoverflow.com/q/22926348
tags question: http://stackoverflow.com/q/22836104
tags question: http://stackoverflow.com/q/22884863
tags question: http://stackoverflow.com/q/22846406
tags question: http://stackoverflow.com/q/22902804
tags question: http://stackoverflow.com/q/22855191

http://stackoverflow.com/q/22819984
has answer: http://stackoverflow.com/a/22824710
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22824710
upvote count: 1
type: Question
has title: Neo4j-spatial importing OSM missmatching vertices found
downvote count: 0
answer count: 1
tagged with: neo4j
has body: This is my method to import osmdata: private void importOSM(String osm){ OSMImporter importer = new OSMImporter(osm); importer.setCharset(Charset.forName("UTF-8")); try{ importer.importFile(graphDb,osm,false,5000,true); importer.reIndex(graphDb,10000); }catch(Exception e){ System.out.println("__________Import Error!! "+e.getMessage()); e.printStackTrace(); } } When I import an osmdata I get this: Mismatching vertices size for Polygon:Node[1799298]: 1 != 2 Mismatching vertices size for LineString:Node[2118494]: 14 != 23 Mismatching vertices size for Polygon:Node[1776324]: 1 != 2 Mismatching vertices size for Polygon:Node[1886154]: 1 != 2 Mismatching vertices size for Polygon:Node[2124799]: 1 != 6 Mismatching vertices size for LineString:Node[2207017]: 60 != 85 Mismatching vertices size for LineString:Node[2207587]: 45 != 154 Mismatching vertices size for LineString:Node[2213928]: 8 != 16 Mismatching vertices size for LineString:Node[2213939]: 8 != 16 Mismatching vertices size for LineString:Node[2212505]: 3 != 14 Mismatching vertices found 100 times Mismatching vertices found 200 times Mismatching vertices found 300 times Mismatching vertices found 400 times Mismatching vertices found 500 times Mismatching vertices found 600 times Mismatching vertices found 700 times Mismatching vertices found 800 times Mismatching vertices found 900 times Mismatching vertices found 1000 times Mismatching vertices found 1100 times I think this is because the osmdata I imported is only an extract and some streets can't be imported as whole. I imported san-francisco.osm from http://metro.teczno.com/#san-francisco (21 MB bzip’ed XML OSM data). So my question is, is there something wrong in my code or with the data I am importing or is this normal? greetings
tagged with: neo4j-spatial

http://stackoverflow.com/q/22880419
has comment: http://stackoverflow.com/comment/34912695
has body: I want to create JLabel with icon in for loop. Here is my code; final JLabel[] box = new JLabel[27]; for(int i = 0; i &lt; 25; i++){ int j = 1; String r = "case" + j + ".png"; box[i] = new JLabel(new ImageIcon(getClass().getResource(r))); j++; } names of icons are like case1.png, case2.png;.... But there is a null point exception. Exception in thread "main" java.lang.NullPointerException at java.awt.Container.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at Game.&lt;init&gt;(Game.java:185) at Game.main(Game.java:243) here are the exceptions Is it just because I did not create names of icons truely? Thanks in advance.
score: 0
tagged with: nullpointerexception
answer count: 1
has comment: http://stackoverflow.com/comment/34912573
has comment: http://stackoverflow.com/comment/34913019
tagged with: jlabel
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/34912668
has comment: http://stackoverflow.com/comment/34913013
has comment: http://stackoverflow.com/comment/34912599
tagged with: java
has title: Null Pointer Exception at JLabel Array
type: Question
has answer: http://stackoverflow.com/a/22880711
tagged with: arrays

http://stackoverflow.com/q/22914783
tagged with: memory-management
has body: Consider these similar pieces of code: for (int iteration = 0; iteration&lt;a_lot; iteration++) { int[] re = new int[large]; for (int i = 0; i&lt;large; i++) re[i] = computeValue(); ... } and int[] re = new int[large]; for (int iteration = 0; iteration&lt;a_lot; iteration++) { for (int i = 0; i&lt;large; i++) re[i] = computeValue(); ... } In the first example we reallocate new space for the array in each iteration and let the garbage collector deal with freeing up the space of the array in the previous iteration, while in the second example we reuse the same array. I can imagine that in some circumstances the first algorithm causes (or contributes to) a StackOverflowException, while the downside of the second algorithm is that the array is never garbage collected in between iterations, even though it might be the case that after some point in the iteration the array isn't used anymore. In which circumstances is it better to use which algorithm?
type: UnansweredQuestion
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/22915530
tagged with: java
has comment: http://stackoverflow.com/comment/34974537
type: Question
linked to: http://stackoverflow.com/q/377763
tagged with: arrays
has title: Optimizing reiterated array allocation
has comment: http://stackoverflow.com/comment/34974786
tagged with: optimization
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22933104
has comment: http://stackoverflow.com/comment/34974428
has comment: http://stackoverflow.com/comment/34974392

http://stackoverflow.com/a/22891773
has comment: http://stackoverflow.com/comment/34934228
type: Answer
answers question: http://stackoverflow.com/q/22890952
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34933686
has body: You could use a HandlerMethodReturnValueHandler to replace the result. The key point is: to replace the return value before delegating the (modified) retunr value to the serialisation. See this blog: http://martypitt.wordpress.com/2012/11/05/custom-json-views-with-spring-mvc-and-jackson/ for an example how to archive a similar (not the same) goal. It also describe one way to register the HandlerMethodReturnValueHandler (for an other see Bart´s answer)
upvote count: 2

http://stackoverflow.com/comment/34815231
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22826360
type: QuestionComment
has text: @Kon Sorry sir, added //null on the methods

http://stackoverflow.com/q/22960874
upvote count: 1
tagged with: maven
tagged with: maven-release-plugin
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35091620
has comment: http://stackoverflow.com/comment/35057019
answer count: 1
downvote count: 0
tagged with: maven-2
favorite count: 0
has title: How to build multiple maven modules project?
tagged with: maven-plugin
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22960938
has body: I have Module based maven project. Project structure is like that : Prarent project name is - Parent1 That has Three childs : Child 1 project name is - Children1 Child 2 project name is - Children2 Child 3 project name is - Children3 So, When i am change some js, css or images in Children2 then i have to build Parent1 project , so it takes too much time. so Is there any way to build only Children2 project and see new changes ?

http://stackoverflow.com/comment/34796679
has text: Affected in what way? Are you displaying something? Maybe a screenshot of your UI (with explanations about what is not as expected) would help people help you.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22809526

http://stackoverflow.com/a/22839830
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34844195
type: Answer
answers question: http://stackoverflow.com/q/22839590
has comment: http://stackoverflow.com/comment/34846561
accepted answer of: http://stackoverflow.com/q/22839590
has body: This feature does not seem to be supported by eclipse yet (Apr 2014). It is a known issue and a ticket is already open for it. However, you can have a look to the "launch group" feature from the CDT plugin. It seems to be compatible with any launch configuration, including maven, and it should offer better control on sequantial execution of your tasks.

http://stackoverflow.com/q/22873864
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/22873956
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22873916
possible better answer: http://stackoverflow.com/a/22873956
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22873916
downvote count: 0
tagged with: jframe
has body: I am trying to get a JButton from a GridLayout by using a point object (move) using the getComponentAt() method. By using the frame of the gridlayout, I can make the following call: JButton button2 = frame.getComponentAt(move); The trouble is these two types are incompatible. The button2 is a JButton, but frame.getComponentAt(move) is a component. I get the following error message when I try to compile. incompatible types found : java.awt.Component required: javax.swing.JButton I know these two are from the same class hierarchy, however, and JButton is much lower. http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html http://docs.oracle.com/javase/7/docs/api/javax/swing/JButton.html How can I get the JButton out of the component so that I can specify this button?
tagged with: swing
has title: How to get an object of a class lower in a class hierarchy
type: Question
score: 1

http://stackoverflow.com/a/22812216
upvote count: 1
type: Answer
downvote count: 0
has body: Maybe I don't understand correctly your problem description, but if you create the server in Java, it listens to its port and not your Flash application. If you want your Flash application to wait for messages from other applications, it must have a server role and listen to a TCP port the same way as this Java server does. You can connect to and test the given Java server easily by telnet program (available in all operating systems) by providing a host name or an IP address and a port as parameters: telnet 127.0.0.1 8080 Any other application can connect in a similar way, using just a hostname/IP address and a port. For example in Java, you can create a client socket: Socket clientSocket = new Socket("localhost", 8080); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
score: 1
answers question: http://stackoverflow.com/q/22811237

http://stackoverflow.com/a/32088408
answers question: http://stackoverflow.com/q/22953084
score: 2
downvote count: 0
upvote count: 2
has body: hi，that maybe the project's problem, chose the project and setting you eclipse: project -&gt; clean...
type: Answer

http://stackoverflow.com/comment/35037641
type: AnswerComment
has text: Try this: MATCH (n)-[r:RELATIONSHIP*1..3]->(m) SET m:LABEL WITH m MATCH (m)-[r2:RELATIONSHIP]->(q:OTHERLABEL) WITH m, count(m) AS cm, r2, q WHERE r2.time<100 AND cm = 3 RETURN m,r2,q;
type: Comment
comment on: http://stackoverflow.com/a/22945747
score: 2

http://stackoverflow.com/comment/34957261
type: Comment
has text: @user3495522 also what does this `HjorthClass` do ?. I guess you are updating ui there
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22904987

http://stackoverflow.com/comment/34924892
has text: Yes I am right. I am also thinking in the same way. Means I have to compare it character by character if needed.
comment on: http://stackoverflow.com/a/22885411
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22858488
answer count: 2
has answer: http://stackoverflow.com/a/22859140
type: UnansweredQuestion
has title: GWT native function - reference per string
has answer: http://stackoverflow.com/a/22858642
tagged with: java
has body: I would like to make references in native javascript based on names in strings in gwt: private String reference = "testFunction"; private native void initTool() /*-{ $wnd.reference = function(){ //function action } }-*/; The idea then is that i from javascript should be able to run the method like this: window.testFunction(); I hope this is possible some how? I havent found anything online explaining this, maybe because i dont know what to search for. regards
type: Question
tagged with: gwt
tagged with: native
has comment: http://stackoverflow.com/comment/34873106
linked to: http://stackoverflow.com/q/359788
tagged with: javascript
score: 0

http://stackoverflow.com/comment/35018648
score: 1
comment on: http://stackoverflow.com/q/22939074
has text: Make it `@Configurable`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34862875
has text: Sure, primarily. And internally, `Thread` simply does call `run` on the `Runnable` instance you pass it. There's nothing preventing you from doing the same. But note, that that alone does not start a thread.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22852770

http://stackoverflow.com/q/22888961
has answer: http://stackoverflow.com/a/22889041
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34928534
has answer: http://stackoverflow.com/a/22889336
tagged with: integer
has body: I have this question that has completely stumped me. I have to create a variable that equals Integer.MAX_VALUE... (in Java) // The answer must contain balanced parentesis public class Exercise{ public static void main(String [] arg){ [???] assert (Integer.MAX_VALUE==i); } } The challenge is that the source code cannot contain the words "Integer", "Float", "Double" or any digits (0 - 9).
has comment: http://stackoverflow.com/comment/34928128
type: Question
has answer: http://stackoverflow.com/a/76261993
tagged with: java
upvote count: 6
has answer: http://stackoverflow.com/a/22889005
has comment: http://stackoverflow.com/comment/34928173
has title: How to get the value of Integer.MAX_VALUE in Java without using the Integer class
has answer: http://stackoverflow.com/a/22889035
tagged with: int
has comment: http://stackoverflow.com/comment/34928261
has answer: http://stackoverflow.com/a/30394294
score: 5
tagged with: max
downvote count: 1
answer count: 7
has answer: http://stackoverflow.com/a/22889389

http://stackoverflow.com/q/22905724
tagged with: java
score: 0
answer count: 1
tagged with: neural-network
tagged with: bias-neuron
has title: Simple neural network multiply training on untrained data gives big errors
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22908890
has comment: http://stackoverflow.com/comment/34958502
tagged with: encog
has body: I have made small multiplication neural network by using the encog library with sigmoid activation function on the basic network. My problem is I got big errors on untrained data. First I tried: train.getError() > 0.00001 to train.getError() > 0.0000001 decreasing error to less will make more sharp results. But this did not help. Increasing hidden layer did not helped also: network.addLayer(new BasicLayer(new ActivationSigmoid(),false,128)); I tried to increase neuron count per layer but that also did not help. How can I get more sharp results? I've read: http://www.heatonresearch.com/wiki/Activation_Function But I am only using sigmoid. When to use others or i need to change activation function? Here is my code: package org.encog.examples.neural.xor; import org.encog.Encog; import org.encog.engine.network.activation.ActivationSigmoid; import org.encog.ml.data.MLData; import org.encog.ml.data.MLDataPair; import org.encog.ml.data.MLDataSet; import org.encog.ml.data.basic.BasicMLDataSet; import org.encog.neural.networks.BasicNetwork; import org.encog.neural.networks.layers.BasicLayer; import org.encog.neural.networks.training.propagation.resilient.ResilientPropagation; import java.awt.*; import java.text.DecimalFormat; import java.text.NumberFormat; public class MulHelloWorld { /** * The input necessary for MUL. */ public static double MUL_INPUT[][] = { { 0.0, 0.0 }, { 1.0, 0.0 }, { 0.2, 0.4 }, { 0.3, 0.2 } , {0.12 , 0.11} , {0.7,0.2} , {0.32,0.42} , {0.9,0.3} , {0.5,0.2} , { 0.4 , 0.6 } , {0.9,0.1} }; /** * The ideal data necessary for MUL. */ public static double MUL_IDEAL[][] = { { 0.0 }, { 0.0 }, { 0.08 }, { 0.06 } , {0.0132} , {0.14} , {0.1344} , {0.27} , {0.1} , {0.24} , {0.09} }; private static BasicNetwork network; private static NumberFormat formatter = new DecimalFormat("###.#####"); public static final void retrain() { network = new BasicNetwork(); network.addLayer(new BasicLayer(null,true,2)); network.addLayer(new BasicLayer(new ActivationSigmoid(),false,1…
type: Question

http
tags question: http://stackoverflow.com/q/22850361
tags question: http://stackoverflow.com/q/22841607
tags question: http://stackoverflow.com/q/22958966
tags question: http://stackoverflow.com/q/22956014
tags question: http://stackoverflow.com/q/22816335
tags question: http://stackoverflow.com/q/22913634
tags question: http://stackoverflow.com/q/22936821
tags question: http://stackoverflow.com/q/22946204
tags question: http://stackoverflow.com/q/22848510
tags question: http://stackoverflow.com/q/22906688
tags question: http://stackoverflow.com/q/22956176
tags question: http://stackoverflow.com/q/22949507
tags question: http://stackoverflow.com/q/22870782
tags question: http://stackoverflow.com/q/22884863
tag name: http
tags question: http://stackoverflow.com/q/22853321
tags question: http://stackoverflow.com/q/22874303
tags question: http://stackoverflow.com/q/22949347
tags question: http://stackoverflow.com/q/22822100
tags question: http://stackoverflow.com/q/22876607
tags question: http://stackoverflow.com/q/22920498
type: Tag
tags question: http://stackoverflow.com/q/22830482
tags question: http://stackoverflow.com/q/22819876
tags question: http://stackoverflow.com/q/22931720
tags question: http://stackoverflow.com/q/22831793
tags question: http://stackoverflow.com/q/22830193
tags question: http://stackoverflow.com/q/22902804
tags question: http://stackoverflow.com/q/22933083

http://stackoverflow.com/comment/34944577
has text: What will be key in case of HashMap?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22897903
score: 0

http://stackoverflow.com/comment/35009370
has text: @GauravBhor: No, don't even clear it - let the GC notice that nothing is referring to the entries any more. I can count the number of times I've tried to explicitly "help" the GC on my fingers...
comment on: http://stackoverflow.com/a/22933956
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/42754590
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22902588
has text: So how can i unmarshal the xml file to a java class object?

http://stackoverflow.com/comment/35048699
type: AnswerComment
has text: Thx ...) In such stuck situations I usually set up a completely clean project with usage of clean server. Looks like the issue not in the code, but with your env configuration.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22892991

http://stackoverflow.com/comment/35218859
type: Comment
has text: I don't understand when you say "I don't know how my problem is solved". Does that mean your problem **is** solved, but you want to know how? The simple answer is because there's bugs in the GNU version.
type: AnswerComment
comment on: http://stackoverflow.com/a/22922503
score: 0

http://stackoverflow.com/q/22952047
accepted answer: http://stackoverflow.com/a/23350974
type: Question
score: 4
has answer: http://stackoverflow.com/a/23350974
tagged with: spring-security
has comment: http://stackoverflow.com/comment/35086582
favorite count: 0
has title: Integrating Spring Security with SiteMinder
has body: How do you integrate Spring Security with SiteMinder to receive a User and Role? I have a project setup with Spring Security 'in-memory' and I want to use convert it to accept SiteMinder header with User and Roles. If SiteMinder will send the role of the user (ROLE_READ,ROLE_WRITE) and have the Service layer grant access. How do you convert the in-memory to use SiteMinder? In-Memory User Roles List of users and roles for in-memory &lt;authentication-manager&gt; &lt;authentication-provider&gt; &lt;user-service&gt; &lt;user name="test" password="test" authorities="ROLE_READ" /&gt; &lt;user name="admin" password="admin" authorities="ROLE_READ,ROLE_WRITE" /&gt; &lt;/user-service&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; Service Layer Protection Here the service methods are protected with specific roles &lt;beans:bean id="testService" class="com.stackoverflow.test" scope="request"&gt; &lt;security:intercept-methods&gt; &lt;security:protect access="ROLE_WRITE" method="do*"/&gt; &lt;security:protect access="ROLE_READ" method="find*"/&gt; &lt;/security:intercept-methods&gt; &lt;/beans:bean&gt; This source (Spring Security Java Config for Siteminder) looks promising but its always assigned role RoleEmployee.
answer count: 1
upvote count: 4
linked to: http://stackoverflow.com/q/22844236
has comment: http://stackoverflow.com/comment/35071917
tagged with: siteminder
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35102704

http://stackoverflow.com/comment/34884923
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22858998
has text: Thanks Andrea, I have edited my initial post to show you what I did to work around the nested forms. thanks!
score: 0

http://stackoverflow.com/a/22896457
answers question: http://stackoverflow.com/q/22891841
has comment: http://stackoverflow.com/comment/34983180
type: Answer
has body: I'd strongly recommend staying in Processing, instead of reaching into the underlying virtual machine API (just because you run it in java, doesn't mean every implementation of Processing has a JVM. Processing.js comes to mind). Just make a state class and keep track that way: class SketchState { color background_color, stroke_color, fill_color; SketchState(color bg, color st, color fl) { sketch = s; background_color = bg; stroke_color = st; fill_color = fl; } } ArrayList&lt;SketchState&gt; stateCache = new ArrayList&lt;SketchState&gt;(); void cacheState() { stateCache.add(new SketchState(...)); } void restoreState() { SketchState rest = stateCache.remove(stateCache.size()-1); background(rest.background_color); stroke(rest.stroke_color); fill(rest.fill_color); } and add whatever other state aspects you want saved to that class.
score: 0
has comment: http://stackoverflow.com/comment/34983394

http://stackoverflow.com/q/22889434
has comment: http://stackoverflow.com/comment/34929740
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34929045
has answer: http://stackoverflow.com/a/22889627
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34929052
favorite count: 0
type: Question
has title: "the method getSupportFragmentManager() is undefined for the type MainActivity"
tagged with: android
tagged with: cordova
has body: I apologize if I'm missing something simple here, but this is my first time using java and I'm stumped. public class MainActivity extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.loadUrl("file:///android_asset/www/index.html"); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } The error message I get: The method getSupportFragmentManager() is undefined for the type MainActivity thanks
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/34969334
comment on: http://stackoverflow.com/q/22911722
type: QuestionComment
type: Comment
has text: Have you genuinely put efforts to solve this?
score: 0

http://stackoverflow.com/a/22871049
has comment: http://stackoverflow.com/comment/34895717
has comment: http://stackoverflow.com/comment/34896151
answers question: http://stackoverflow.com/q/22871017
has comment: http://stackoverflow.com/comment/34895646
downvote count: 0
has body: Java arrays have a fixed length. If you want something which can grow as needed, I would suggest using an ArrayList, which is backed by an array, and does all the hard work for you.
type: Answer
has comment: http://stackoverflow.com/comment/34895749
has comment: http://stackoverflow.com/comment/34895738
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34895666

http://stackoverflow.com/q/22829164
accepted answer: http://stackoverflow.com/a/22829253
has body: I'm creating a Frogger-like game and my sprite(frog)(image), if you will, is created but does not move on my keypress, and I believe the error is occurring somewhere in the draw() method for the actual frog.java class. This is my own project and I'm trying to incorporate polymorphism and inheritance. Is there a way to move my sprite using the draw and move methods that I have, else what would be the correct way to do so. This is being done in Netbeans unfortunately. import java.awt.*; import java.awt.event.*; public class FroggerForm extends Frame implements ActionListener { private Frog frog; private javax.swing.Timer moveTimer = new javax.swing.Timer(500, this); /** Creates new form FroggerForm */ public FroggerForm() { initComponents(); this.setSize(400, 400); frog = new Frog(froggerPanel); moveTimer.start(); } /** 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. */ // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { froggerPanel = new java.awt.Panel(); setMinimumSize(new java.awt.Dimension(500, 500)); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); setLayout(null); froggerPanel.setBackground(new java.awt.Color(190, 190, 190)); froggerPanel.setPreferredSize(new java.awt.Dimension(400, 400)); froggerPanel.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { keyAdapter(evt); } }); add(froggerPanel); froggerPanel.setBounds(100, 0, 400, 400); pack(); }// &lt;/editor-fold&gt; /** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) { System.exit(0); } private void keyAdapter(java.awt.event.KeyEvent evt) { frog.hide(); if(evt.getSource() == KeyEvent.VK_UP) frog.move(0, -10); else if(evt.getSource() == KeyEvent.VK_DOWN) frog.move(0, 10…
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22829253
tagged with: inheritance
score: 0
has title: Java: Moving an Image/ImageIcon
answer count: 1
tagged with: polymorphism

http://stackoverflow.com/q/22894206
has answer: http://stackoverflow.com/a/22894678
has answer: http://stackoverflow.com/a/22895413
tagged with: list
tagged with: linked-list
score: 1
has title: Finding uppercase in linkedlist and returning new linkedlist with found elements?
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
accepted answer: http://stackoverflow.com/a/22895413
tagged with: eclipse
answer count: 2
has body: I have to write a method which will search a linkedlist(ListNode, cointaining one char per listnode), finding all uppercase chars, copy them to a new ListNode and returning the new ListNode. This is my code so far, but it fails the JUnit testing (Provided by prof.) This is list node: public class ListNode { public char element; public ListNode next; } And this is the method ive wrote, which dont seem to work: public static ListNode copyUpperCase(ListNode head) { ListNode newListNode = mkEmpty(); if(head == null){ throw new ListsException("Lists: null passed to copyUpperCase"); }else{ char[] sss = toString(head).toCharArray(); for(int i = 0; i &lt; sss.length ; i++ ) if(Character.isUpperCase(sss[i])){ newListNode.element = sss[i]; } newListNode = newListNode.next; } return newListNode; } What is worng with the code? Why does it fail?
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/22894678

http://stackoverflow.com/comment/34857779
type: AnswerComment
score: 0
type: Comment
has text: That means you have a node in the stack with no element. Are you sure that's what you want? That certainly is not normal stack behaviour.
comment on: http://stackoverflow.com/a/22849792

http://stackoverflow.com/comment/35046635
comment on: http://stackoverflow.com/a/22954737
type: AnswerComment
score: 0
type: Comment
has text: whats your android version

http://stackoverflow.com/comment/35276672
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23079233
score: 1
has text: In my actual program, I start two different JVMs, and one hazelcast instance per JVM, but that does not solve the problem.

http://stackoverflow.com/a/22957718
has comment: http://stackoverflow.com/comment/35087389
has body: Instead use document.evaluate() for JavaScript executor method.something like this: executeScript("document.evaluate( \"" ,document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue.click()");
answers question: http://stackoverflow.com/q/22956260
score: 0
type: Answer

http://stackoverflow.com/comment/34929636
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22889520
has text: Have you tried your own suggestions?

http://stackoverflow.com/comment/34933366
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22891869
has text: https://gist.github.com/anonymous/1816aa699885ae4d5670 is FormTTS.java
score: 0

http://stackoverflow.com/a/60644644
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22850354
has body: Using regexs, you can use ^ at the beginning and $ at the end: Pattern pattern = Pattern.compile("^Hello world!$"); Also this question is a repeat of this.

http://stackoverflow.com/comment/34830109
score: 0
type: AnswerComment
has text: javafx.util.Pair [Javadoc](http://docs.oracle.com/javafx/2/api/javafx/util/Pair.html)
comment on: http://stackoverflow.com/a/22834915
type: Comment

http://stackoverflow.com/q/22950351
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22950373
accepted answer: http://stackoverflow.com/a/22950373
tagged with: java
has answer: http://stackoverflow.com/a/22950396
type: Question
answer count: 2
tagged with: random
has body: In this program, the computer generates a random number (between 1-100) and the user attempts to guess it. Runs until the user correctly guesses the number. Needs to print out the total number of tries it took before the number was guessed correctly. Program runs fine, but there is a logical error. Nothing prints out when I correctly guess the number; the program just stops instead. import java.util.*; public class Problem3 { public static void main(String[] args) { Random rand = new Random(); Scanner console = new Scanner(System.in); int num = rand.nextInt(100)+1; System.out.println(num); //prints out the random number so I know test works correctly int count = 0; System.out.println("Guess the random number. The number is between 1 and 100. Enter it below"); console = new Scanner(System.in); int guess = console.nextInt(); while(guess != num){ //while guess is not = to number if(guess &lt; num){ //if less than num System.out.println("Your guess is too low"); System.out.println("Guess the random number. The number is between 1 and 100. Enter it below"); guess = console.nextInt(); count++; }else if( guess &gt; num){ //if greater than num System.out.println("Your guess is too high"); System.out.println("Guess the random number. The number is between 1 and 100. Enter it below"); guess = console.nextInt(); count++; }else{ count++; System.out.println("You guessed correctly after " + count + " tries!"); } } } }
score: 0
possible better answer: http://stackoverflow.com/a/22950396
has title: logical error with random number guessing game

http://stackoverflow.com/comment/34922086
type: QuestionComment
type: Comment
has text: Why are you trying to parse JSON with an XML parser?
comment on: http://stackoverflow.com/q/22885015
score: 0

http://stackoverflow.com/a/22885437
score: 0
answers question: http://stackoverflow.com/q/22885387
has comment: http://stackoverflow.com/comment/34921930
has body: You've answered your question. The problem is that dataSet is null therefore the NullPointerException. You have to initialize it before using int[][] dataSet = new int[size1][size2] where size1 and size2 are the known sizes of the array. And here comes the second problem, would you know about the sizes before reading the file. First I would change 2 dimension array to list of list, but there could be better data structures as well.
type: Answer

java-8
tags question: http://stackoverflow.com/q/22845699
tags question: http://stackoverflow.com/q/22933296
tags question: http://stackoverflow.com/q/22923505
tags question: http://stackoverflow.com/q/22917270
tags question: http://stackoverflow.com/q/22917138
tags question: http://stackoverflow.com/q/22928247
tags question: http://stackoverflow.com/q/22819804
tags question: http://stackoverflow.com/q/22921259
tags question: http://stackoverflow.com/q/22838634
tags question: http://stackoverflow.com/q/22812488
tags question: http://stackoverflow.com/q/22893263
tags question: http://stackoverflow.com/q/22929820
tags question: http://stackoverflow.com/q/22881873
tags question: http://stackoverflow.com/q/22940416
tags question: http://stackoverflow.com/q/22950786
tags question: http://stackoverflow.com/q/22866491
tags question: http://stackoverflow.com/q/22840170
tags question: http://stackoverflow.com/q/22912675
tags question: http://stackoverflow.com/q/22867286
tags question: http://stackoverflow.com/q/22921623
tags question: http://stackoverflow.com/q/22958774
tags question: http://stackoverflow.com/q/22890326
tags question: http://stackoverflow.com/q/22870346
tags question: http://stackoverflow.com/q/22959427
tags question: http://stackoverflow.com/q/22929237
tags question: http://stackoverflow.com/q/22950642
tags question: http://stackoverflow.com/q/22936972
tags question: http://stackoverflow.com/q/22837922
tags question: http://stackoverflow.com/q/22808820
tags question: http://stackoverflow.com/q/22911030
tags question: http://stackoverflow.com/q/22918207
tags question: http://stackoverflow.com/q/22824587
tags question: http://stackoverflow.com/q/22845574
tags question: http://stackoverflow.com/q/22918979
tag name: java-8
tags question: http://stackoverflow.com/q/22881350
tags question: http://stackoverflow.com/q/22942223
tags question: http://stackoverflow.com/q/22918847
tags question: http://stackoverflow.com/q/22905562
tags question: http://stackoverflow.com/q/22855670
tags question: http://stackoverflow.com/q/22874374
tags question: http://stackoverflow.com/q/22962792
tags question: http://stackoverflow.com/q/22917462
tags question: http://stackoverflow.com/q/22810921
tags question: http://stackoverflow.com/q/22926077
tags question: http://stackoverflow.com/q/22903669
type: Tag
tags question: http://stackoverflow.com/q/22822830
tags question: http://stackoverflow.com/q/22958624
tags question: http://stackoverflow.com/q/22893824
tags question: http://stackoverflow.com/q/22945870

http://stackoverflow.com/comment/34897257
type: QuestionComment
comment on: http://stackoverflow.com/q/22871800
type: Comment
score: 0
has text: I suppose I am. I guess the examples I encountered all had different syntax or were personalized to suit specific program needs. Thanks! I'll just use acquire and release.

http://stackoverflow.com/q/22937716
tagged with: parsing
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1863250
tagged with: http://stackoverflow.com/tag/xml
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22937840
has body: I have a very large XML which I receive as input. From this XML I just need a single child element. Parsing the entire XML to retrieve just one element seems like an performance overkill. Are there any better approaches to resolve this issue? One approach would be to use the DocumentBuilder API to parse the XML and then using XPath to retrieve the desired field. But the parse method will still unnecessarily parse the entire xml. Is there an overloaded parse method in any implementation of parser which takes the xpath and parses the XML only according to the XPath.
type: Question
linked to: http://stackoverflow.com/q/7215931
has answer: http://stackoverflow.com/a/22937889
has comment: http://stackoverflow.com/comment/35016007
has answer: http://stackoverflow.com/a/22937878
answer count: 3
has title: XML Parsing: Parsing the entire xml for one field

http://stackoverflow.com/q/22844430
answer count: 1
has body: I have searched few several questions with similar titles to this (for example how to use jpanel with paint (or repaint)) but I can't find a reason for my code not to work. I'm a graphics with JPanels newbie so my first attempt at this sort of thing is to make a triangle that one can move with the arrow keys. I got the triangle drawn fine, with no problems. However, when I tried to move the triangle with the arrows, it didn't move. Can anyone find why it won't repaint? JPanel code (I also have a separate class for the JFrame itself which only makes the frame and adds the panel, if you need to see that tell me and I'll edit it in): import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Drawpanel extends JPanel implements KeyListener{ int[] xcoords = {-20,0,20};//Triangle x coordinates int[] ycoords = {20,-20,20};//Triangle y coordinates int x = 100;//X coordinate for drawing the triangle int y = 100;//Y coordinate for drawing the triangle Graphics2D g2d; Polygon tri = new Polygon(xcoords,ycoords,xcoords.length);//triangle public void paintComponent(Graphics g) { super.paintComponent(g); g2d = (Graphics2D)g; g2d.translate(x,y);//draw triangle at x and y coordinates g2d.setColor(new Color(234,22,72)); g2d.fill(tri); } public void keyTyped(KeyEvent k){} public void keyReleased(KeyEvent k){} public void keyPressed(KeyEvent k) { int keycode = k.getKeyCode(); switch(keycode) { case KeyEvent.VK_DOWN://if down arrow pressed, decrease ship y coordinate by 10 y -= 10; case KeyEvent.VK_UP: y += 10; case KeyEvent.VK_LEFT: x -= 10; case KeyEvent.VK_RIGHT: x += 10; } repaint();//screen doesn't repaint } }
tagged with: paintcomponent
accepted answer: http://stackoverflow.com/a/22844496
tagged with: repaint
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22844496
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/22741215
linked to: http://stackoverflow.com/q/8631670
score: 0
has comment: http://stackoverflow.com/comment/34847665
tagged with: graphics2d
has title: JPanel repaint() not working

http://stackoverflow.com/q/22889227
tagged with: jbutton
tagged with: java
has body: In a game I am making with buttons, when I click on the "next" button, I would some other buttons to become 'grayed out' so that you cannot click on them. I have this code in my ActionListener for the 'Next' button: public class NextListener implements ActionListener { public void actionPerformed(ActionEvent e) { nextButton.setEnabled(false); callButton.setEnabled(false); raiseButton.setEnabled(false); } } However, when I run the program, the buttons do not gray out, and I get the error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException Why doesn't this work?
type: Question
has answer: http://stackoverflow.com/a/22889236
tagged with: actionlistener
has title: Calling setEnable within an ActionListener
has comment: http://stackoverflow.com/comment/34928628
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/q/22959459
has answer: http://stackoverflow.com/a/41778245
favorite count: 0
tagged with: spring-el
tagged with: spelevaluationexception
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/24322108
answer count: 4
linked to: http://stackoverflow.com/q/24301074
score: 8
has body: I have SPRING METHOD security fully configured for my web application. (with PRE/POST annotations enabled). However recently I encountered a strange issue with them. Summary as follows: Summary of POJOS // User Class public class User { int id; String name; // getters and setters } // Group Class public class Group { int id; String name; // getters and setters } // GroupMembership class public class GroupMembership { private int id; private User user; private Group group; // getters and setters } PreAuthorise filter on method . @PreAuthorize("canIEditGroupProfile(#membership.group.id)") public int updateGroupMembership(GroupMembership membership) throws GroupsServiceException; Upon passing a fully populated GroupMembership object (proper user and group compositions present), the security filter throws following exception: errorMessage: "Failed to evaluate expression canIEditGroupProfile(#membership.group.id)'" Upon digging into the exception: The cause is found to be: org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 33): Field or property 'group' cannot be found on null Please provide pointers to address the same.
upvote count: 8
type: Question
has title: SpelEvaluationException: EL1007E:(pos 43): Field or property 'group' cannot be found on null
tagged with: java
has answer: http://stackoverflow.com/a/23055113
has comment: http://stackoverflow.com/comment/35055543
has comment: http://stackoverflow.com/comment/35054486
linked to: http://stackoverflow.com/q/18157058
downvote count: 0
tagged with: spring-security
has answer: http://stackoverflow.com/a/59396805

country
tag name: country
tags question: http://stackoverflow.com/q/22874262
type: Tag
tags question: http://stackoverflow.com/q/22814828

http://stackoverflow.com/a/22867056
type: Answer
has body: Yes, you could make duplicate packages in separate directories, but I can't think of a good reason to do it. If the classes within the package have the same names you can certainly get namespace collisions. I am not sure what "module" means in this context but I'd recommend com.abc.module1.xyz com.abc.module2.xyz instead. Those would be distinct packages to the classloader. You can still keep your /home/user1/project/module1/ directory structure up front, that doesn't matter.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22866748
downvote count: 0

http://stackoverflow.com/a/22900231
upvote count: 1
downvote count: 0
score: 1
has body: Start off with extending a Set (since you dont want any objects to be repeated)
type: Answer
answers question: http://stackoverflow.com/q/22900173

http://stackoverflow.com/comment/34789356
has text: It's a guess, but maybe the PHP script tries to determine your preferred language. You could try to emulate that as well by setting the `Accept-Language` to `nl-NL`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22812295
score: 0

http://stackoverflow.com/a/22871219
has body: Yes, this is perfectly normal in Java
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/22868287
answers question: http://stackoverflow.com/q/22868287
upvote count: 1

http://stackoverflow.com/a/22872413
has comment: http://stackoverflow.com/comment/34898374
has comment: http://stackoverflow.com/comment/34898299
has comment: http://stackoverflow.com/comment/34898389
downvote count: 0
has comment: http://stackoverflow.com/comment/34898997
has comment: http://stackoverflow.com/comment/34898272
type: Answer
has body: Don't provide default constructor. Eg. - Consider following class - class User{ private String firstName; private String lastName; public User(String firstName, String lastName){ this.firstName = firstName; this.lastName = lastName; } } In the above example by not providing default constructor User(), the programmer using User class will be forced to set firstName and lastName while creating User object. Edit - To address the situation where the programmer passes null value, you can check the value and throw an exception to handle that.
has comment: http://stackoverflow.com/comment/34898892
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22872348

http://stackoverflow.com/comment/34984782
comment on: http://stackoverflow.com/a/22919819
type: AnswerComment
type: Comment
score: 0
has text: That's because after you call it the first time, it's going to return a value that's not a power of 2, which then results in the 'normal' path being taken in nextInt(), so that the series will randomize. As it is, you're calling nextInt repeatedly with '4' and only one time, so that it will always just return (4*next(31))>>31).

http://stackoverflow.com/q/22955429
tagged with: opencv
has answer: http://stackoverflow.com/a/22959065
has body: i have configured opencv 2.4.8 for android with my eclipse . its working fine i have implemented a test example to check it opens opencv loader using folowing code OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback); then i load a image and converts it to gray scale it successfully converts the image. Now i want to use more functions of opencv on image like image filtering etc. for kindly suggest me to start doing that and how to use C++ functions in java eclipse android. kindly suggest me any tutorial for that or any example so that i can proceed
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22955969
score: 0
tagged with: android
tagged with: c++
type: UnansweredQuestion
has title: OpenCV android function use

http://stackoverflow.com/q/22902437
has answer: http://stackoverflow.com/a/22902572
accepted answer: http://stackoverflow.com/a/22902572
answer count: 2
downvote count: 0
has title: nullpointerexception run error
favorite count: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/22902611
has body: I'm writing a java video poker game. When I run the test file, I get a nullpointexception error. It points to this line in my shuffling method theDeck[i] = theDeck[j];I'm still a novice in java... import java.util.Random; public class Deck { private Card[] theDeck; private int top; // add more instance variables if needed public Deck(){ top = 0; Card[] theDeck = new Card[52]; for(int s = 1; s &lt;= 4; s++) { for (int v = 1; v &lt;= 13; v++) { for (int i = 0; i &lt; theDeck.length; i++) { theDeck[i] = new Card(s,v); } } } } public void shuffle() { // shuffle the deck here Random generator = new Random(); int i; int j; i = generator.nextInt(51) + 1; j = generator.nextInt(51) + 1; Card temp = theDeck[i]; for(int k = 1; k &lt;100; k++) { theDeck[i] = theDeck[j]; theDeck[j] = temp; } top = 0; } this is the part of the class that calls the shuffle method: public void play() { cards.shuffle(); for( int i =1; i &lt;= 5; i++) { p.addCard(cards.deal()); cards.incrementTop(); } for( int j = 1; j &lt; 5; j++) { p.getHand().get(j).toString(); } System.out.println("These are your cards:"); for( Card c : p.getHand()) {
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22902611
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/comment/35048201
has text: Once try this `String string = "Android"; System.out.println(string.substring(0, string.length()));`... Does not throw any Exception...
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22955442
score: 1

http://stackoverflow.com/q/22876051
has title: String returning a float with one decimal place
has answer: http://stackoverflow.com/a/22876087
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34905271
tagged with: decimalformat
has body: I'm trying to format my decimal to show only one decimal place. In my testprogram I set gpa to 3.5454 and it is returning to me the value 3.5454. How do I format it to show 3.5. I tried the code below and it doesn't work. I also tried it in my setGpa method and still no luck /** * This method return the student's gpa * @return This student's gpa */ public float getGpa(){ NumberFormat formatter= new DecimalFormat("#0.0"); formatter.format(gpa); return gpa; } Solved! - I just needed to cast type it (float) ((int)(gpa*10) / 10)
tagged with: format
has answer: http://stackoverflow.com/a/22897322
has answer: http://stackoverflow.com/a/22876103
tagged with: java
type: Question
tagged with: decimal
has comment: http://stackoverflow.com/comment/34905535
score: 0
answer count: 3

http://stackoverflow.com/q/22868511
type: Question
has body: I have a biginteger number, say BigInteger a=Biginteger.valueOf(50); Besides the following BigInteger a=(BigInteger.ZERO).subtract(BigInteger.valueOf(50)); is there another way to get the negative value of my number? Can't seem to find a method.
answer count: 1
has answer: http://stackoverflow.com/a/22868530
favorite count: 0
upvote count: 8
type: AnsweredQuestion
tagged with: biginteger
accepted answer: http://stackoverflow.com/a/22868530
score: 7
tagged with: java
has title: BigInteger negative value
downvote count: 1

http://stackoverflow.com/q/22890256
has comment: http://stackoverflow.com/comment/34931584
tagged with: rest
has body: I'm writing a Neo4j Client, I'm running Neo4j client and server on two different machines (windows operating system). Sometimes (after many times) that I'm issuing a query (I'm using java-rest-bind api and issuing Cypher queries), an exception of Unexpected end of file from server raises. Is there any explanation? (My whole data size is 10G but I'm accessing 1 node and counting about 200 relationships per transaction) This is the full exception: Stdout: com.sun.jersey.api.client.ClientHandlerException: java.net.SocketException: Unexpected end of file from server Stdout: at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149) Stdout: at org.neo4j.rest.graphdb.UserAgent$1.handle(UserAgent.java:68) Stdout: at com.sun.jersey.api.client.Client.handle(Client.java:648) Stdout: at com.sun.jersey.api.client.WebResource.handle(WebResource.java:670) Stdout: at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) Stdout: at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:553) Stdout: at org.neo4j.rest.graphdb.ExecutingRestRequest.post(ExecutingRestRequest.java:151) Stdout: at org.neo4j.rest.graphdb.ExecutingRestAPI.query(ExecutingRestAPI.java:547) Stdout: at org.neo4j.rest.graphdb.ExecutingRestAPI.query(ExecutingRestAPI.java:568) Stdout: at org.neo4j.rest.graphdb.RestAPIFacade.query(RestAPIFacade.java:235) Stdout: at org.neo4j.rest.graphdb.query.RestCypherQueryEngine.query(RestCypherQueryEngine.java:50) Stdout: at Neo4j.Neo4jRestClient2.viewProfile(Neo4jRestClient2.java:440) Stdout: at edu.usc.bg.base.DBWrapper.viewProfile(DBWrapper.java:101) Stdout: at edu.usc.bg.workloads.CoreWorkload.doActionGetProfile(CoreWorkload.java:2329) Stdout: at edu.usc.bg.workloads.CoreWorkload.doTransaction(CoreWorkload.java:1061) Stdout: at edu.usc.bg.base.ClientThread.run(ClientThread.java:201) Stdout: Caused by: java.net.SocketException: Unexpected end of file from server Stdout: at sun.net.www.http.HttpCl…
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34981846
tagged with: java
type: Question
score: 0
has title: Unexpected end of file from server, Neo4j Rest client
tagged with: neo4j

http://stackoverflow.com/a/22817136
answers question: http://stackoverflow.com/q/22817012
type: AcceptedAnswer
downvote count: 0
has body: Every time you connect to the server initially a jsessionid is generated and saved to a cookie on the client side. That jsessionid is what identifies your session on the server. So, HttpSession object is generated on the server side which contains all the details of your particular session until it expires. Yes the jsessionid is sent every time you send a request to the server. The only way this is thwarted is if the browser isn't allowing the saving of cookies. In which case, there are other mechanisms that can still ensure that the jsessionid is retained. That's my understanding of the process anyway. Hope this helps.
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/22817012

http://stackoverflow.com/comment/34946989
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22899372
has text: Post the error please; it will give us specific information as to what exactly is causing the NullPointerException.
type: Comment

http://stackoverflow.com/q/22911030
has answer: http://stackoverflow.com/a/22923449
has comment: http://stackoverflow.com/comment/34972443
has body: I have little problem with code design that use new streaming API from Java 8. I would like to learn new things and one of the task is: Reject max and min from list. List not contains duplicates. Looks simple? Nope... My code: List&lt;Integer&gt; ranges = Lists.newArrayList(new Range(1, 15)); List&lt;Integer&gt; collect = ranges.stream() .filter(x -&gt; x != ranges.stream() .mapToInt(Integer::intValue) .max() .getAsInt()) .filter(x -&gt; x != ranges.stream() .mapToInt(Integer::intValue) .min() .getAsInt()) .collect(Collectors.toList()); assertThat(collect).hasSize(13); // OK assertThat(collect).isEqualTo(Lists.newArrayList(new Range(2,14))); // OK this code is good (if only we dont have duplicates of min/max, but this is not a core problem here) but problem is that I use here three streams. First is main stream, second to remove max and third to remove min. Is there any possibility to do this task in one stream? //edit: Very primitive Scala version: val list = List.range(1, 15).sortWith(_&gt;_).tail.reverse.tail with additional sort because we could have shuiffeled list.
possible better answer: http://stackoverflow.com/a/24681064
accepted answer: http://stackoverflow.com/a/22923449
has comment: http://stackoverflow.com/comment/34986000
upvote count: 11
has answer: http://stackoverflow.com/a/24681064
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34992260
has answer: http://stackoverflow.com/a/77074281
linked to: http://stackoverflow.com/q/22923505
tagged with: java-stream
has comment: http://stackoverflow.com/comment/34973142
score: 11
tagged with: collections
tagged with: java-8
has title: Remove max (or min) from collection using Java8 streaming API
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34991894
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34987401
has comment: http://stackoverflow.com/comment/34967475

http://stackoverflow.com/q/22914371
score: 1
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/4252257
type: Question
tagged with: simpledateformat
has answer: http://stackoverflow.com/a/22916975
tagged with: java
has body: My current Java project requires me to work with dates and through my research and tinkering around I discovered the setLenient() method is defaulted to true. When I set it to false I begin to have problems with my code. I have a JFormattedTextField intialized with a SimpleDateFormat. For my project, I need to have / placeholders always present so using the answer to this question, I was able to install /s as place holders in the form of MM/dd/yyyy When the SimpleDateFormat is set to setLenient(false), and an incomplete date is entered (such as 12/34/5), and then have the focus shift away from the formatted textfield, the entire field including the /s is removed. When SimpleDateFormat is set to setLenient(true), this doesn't happen. Instead, the incomplete entry of 12/34/5 is set to 01/03/0006 once focus is lost. I need to be able to usesetLenient(false) on my simple date formatter while also always having / placeholders. I do not really know where the core issue lies in the unwanted behavior of the program and would appreciate any insight. Simplified program concerning issue: 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 dateFormatter = new SimpleDateFormat("MM/dd/yyyy"); private JFormattedTextField formattedText = new JFormattedTextField(dateFormatter); private JLabel label1 = new JLabel(); private JLabel label2 = new JLabel(); private TextArea ta = new TextArea(); private Button b = new Button("click"); public Hello() { //setPreferredSize(new Dimension(500,500)); b.addActionListener(this); label1 = new JLabel("test"); label2 = new JLabel("test"); formattedText.setColumns(10); dateFormatter.setLenient(false); // not efficient try { MaskFormatter dateMask = new MaskFormatter("##/##/####"); dateMask.install(formattedText); } catch (ParseException ex) { Logger.getLogger(Hello.class.getName()).log(…
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22916975
has title: Java: where is source of unwanted behavior in my JFormattedTextField?
type: AnsweredQuestion
tagged with: jformattedtextfield

swingworker
tags question: http://stackoverflow.com/q/22811087
tags question: http://stackoverflow.com/q/22938953
tags question: http://stackoverflow.com/q/22949488
tags question: http://stackoverflow.com/q/22816564
tag name: swingworker
tags question: http://stackoverflow.com/q/22822625
type: Tag

http://stackoverflow.com/a/22851947
has body: As cybersam mentioned your webView is null. Since the WebView is actually in the fragment, you need to load it within the fragment, not in the onCreate of AutosActivity. Therefore, it must be done in your PlaceholderFragment class instead. public static class PlaceholderFragment extends Fragment { WebView webView; public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_autos, container, false); // load your webview here using fragment_autos layout. webView = (WebView) rootView.findViewById(R.id.webView1); webView.loadUrl("http://www.example.com"); return rootView; } }
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22849714
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22849714

http://stackoverflow.com/q/22958647
tagged with: java
type: Question
upvote count: 4
has body: I have an SQLite database that contains a table that has 3 columns, I'm using an EditText and a ListView in my layout. What I've done by now is applying a search using the EditText and displaying the filtered results in a ListView. The following code is applied to the EditText called myFilter. The words is the SimpleCursorAdapter: myFilter.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void onTextChanged(CharSequence s, int start, int before, int count) { words.getFilter().filter(s.toString()); } }); What I want to do is to filter two CharSequences, for example I want to display in my ListView words that starts with a and b, can I do something like that (for example words.getFilter().filter("a","b"); ? Any help ?
tagged with: filter
score: 3
tagged with: android
favorite count: 0
answer count: 0
type: UnansweredQuestion
has title: How to filter strings in ListView
downvote count: 1

http://stackoverflow.com/a/22845973
type: Answer
answers question: http://stackoverflow.com/q/22844717
has comment: http://stackoverflow.com/comment/34850763
accepted answer of: http://stackoverflow.com/q/22844717
has body: Seems to me you don't need reduce at all. The collect and consume are for you: @Test public void testCollect() { Stream&lt;String&gt; stream = Streams.defer(Arrays.asList("1", "2", "3", "4", "5")).get(); stream.map(Integer::parseInt) .collect() .consume(integers -&gt; assertThat(integers, Matchers.contains(1, 2, 3, 4, 5))); } This sample (Java 8) demonstrates how to send a List&lt;String&gt; to Reactor's Stream, convert each item to String, collect them to the List&lt;Integer&gt; and do process on the result List. UPDATE Note collect(5) isn't needed: Stream applies batchSize from deffered Collection. Looks like .collect(int batchSize) has been introduced recently.
upvote count: 1
has comment: http://stackoverflow.com/comment/34853243
has comment: http://stackoverflow.com/comment/34851315
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34850600
downvote count: 0
has comment: http://stackoverflow.com/comment/34851459
score: 1
has comment: http://stackoverflow.com/comment/34850954

http://stackoverflow.com/q/22917138
type: AnsweredQuestion
upvote count: 311
tagged with: java-stream
has answer: http://stackoverflow.com/a/28450253
tagged with: java-8
score: 311
type: Question
has comment: http://stackoverflow.com/comment/34978818
possible better answer: http://stackoverflow.com/a/28450253
has comment: http://stackoverflow.com/comment/88984132
tagged with: java
has answer: http://stackoverflow.com/a/22917186
linked to: http://stackoverflow.com/q/39076077
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/44781319
accepted answer: http://stackoverflow.com/a/22917186
has body: I'd like to use java.util.Optional.orElseThrow() with an Exception type that asks for a constructor parameter. Something like this: .orElseThrow(MyException::new(someArgument)) // obviously NOT working Is there a way to create a Supplier that passes my argument value in?
has title: Java 8 method references: provide a Supplier capable of supplying a parameterized result

specifications
type: Tag
tags question: http://stackoverflow.com/q/22916675
tag name: specifications

http://stackoverflow.com/q/22903604
has comment: http://stackoverflow.com/comment/34955077
answer count: 1
downvote count: 1
tagged with: java
upvote count: 4
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22904108
favorite count: 0
has body: Hiii, I am working on an app in which i have to get the running time of all the apps that are installed on the device. So, is it possible to know how long somebody else's app is running for on the phone? Ex: How long is the gmail app running on the phone? Is there any API for this or we have to develop are own logic to make it work???
type: Question
tagged with: android
has title: Get all apps running time on android
accepted answer: http://stackoverflow.com/a/22904108
has comment: http://stackoverflow.com/comment/34954886

http://stackoverflow.com/a/22920443
type: Answer
answers question: http://stackoverflow.com/q/22920371
upvote count: 4
downvote count: 0
score: 4
has body: This method call result.getString(name) expects the name of a column, not the name of a table. Probably that's where your confusion comes from. You need to loop through all your column names and call this method for each one. Also, the ArrayIndexOutOfBoundsException comes from the salesTable not from the ResultSet. Review these two items and you should be able to fix this.

http://stackoverflow.com/q/22902347
tagged with: java
tagged with: error-handling
score: -1
type: Question
has title: non-static method count(int) cannot be referenced from a static context
duplicate of: http://stackoverflow.com/q/2559527
has body: this is N queens problem that i try to solve ,but i have this problem of non-static method .. how can i solve it ..... *> at the count(int) method .. i don't understand how to solve this problem error: non-static method count() cannot be referenced from a static context import java.util.*; public class NQueens { static int n; int[][] board = new int[n][n]; public static void main(String[] args) { //int result; int col = 0; Scanner input=new Scanner(System.in); n=input.nextInt(); if(n &lt; 4) System.out.println("the result is 0"); else count(0); } int cnt=0; void count(int col){ if(col == n){ cnt++; System.out.println("the result is " + cnt); } else{ for(int row=0 ; row&lt;n ; row++){ if(placeQueen(row, col)) count(col+1); else removeQueen(row , col); } } } boolean placeQueen(int row , int col){ boolean x =false; if(validPlace(row , col)){ setQueen(row , col); x = true; } return x; } boolean validPlace(int row ,int col){ boolean x = false; if(board[row][col] != -1) x=true; return x; } void setQueen(int row , int col){ board[row][col] = 1; killCell(row , col); } void killCell(int row , int col){ for(int i=col+1 ; i&lt;n ; i++) board[row][i] = -1; for(int k=col+1 ; k&lt;n ; k++){ for(int j=0 ; j&lt;n ; j++) if(Math.abs(row-j) == Math.abs(col-k)) board[j][k] = -1; } } void removeQueen(int row , int col ){ board[row][col] = 0; refreshCell(row , col); } void refreshCell(int row , int col){ for(int i =col+1 ; i&lt;n ; i++) board[row][i]=0; for(int k=col+1 ; k&lt;n ; k++){ for(int j=0 ; j&lt;n ; j++) if(Math.abs(row-j) == Math.abs(col-k)) board[j][k]=0; } } }
has answer: http://stackoverflow.com/a/22902397
accepted answer: http://stackoverflow.com/a/22902397
tagged with: non-static
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34952463
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/2559527
tagged with: n-queens

http://stackoverflow.com/comment/35510856
type: AnswerComment
score: 0
has text: Cheers for expanding with a nice spring based example on a best practice using prepared statements.
type: Comment
comment on: http://stackoverflow.com/a/23132762

http://stackoverflow.com/comment/34828105
score: 0
type: AnswerComment
has text: yes you should use multiple ServerSocket.receive(receivePacket) invocations, probably inside a while. Of course it is a blocking action, you cannot in the same time write a buffer and wait for an input.
type: Comment
comment on: http://stackoverflow.com/a/22831922

http://stackoverflow.com/q/22849607
upvote count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/34859389
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34858949
tagged with: client
has comment: http://stackoverflow.com/comment/34858478
has comment: http://stackoverflow.com/comment/34858501
has title: tcp connect doesn't work java android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34858914
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/34857190
has answer: http://stackoverflow.com/a/22879846
has comment: http://stackoverflow.com/comment/34893600
has comment: http://stackoverflow.com/comment/34887063
type: Question
has comment: http://stackoverflow.com/comment/34857609
favorite count: 0
has comment: http://stackoverflow.com/comment/34887116
score: 0
has body: I'm new to the network communication and Java programing. I'm making application (client) on Android which will connect with server on computer. Both programs are connected with the same Wifi network. But I have a problem. When I'm sending message from android client to server, nothing happen. What is wrong? Android Client try { Socket s = new Socket("192.168.0.101", 5555); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(s.getOutputStream())); String outMsg = ""; outMsg = "jakas wiadomosc"; out.write(outMsg); out.flush(); out.close(); s.close(); } catch(Exception e) { Log.d("Error", "something goes wrong"); } } and server on computer try { ServerSocket ss = null; ss = new ServerSocket(5555); Socket s = ss.accept(); BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream())); String incomingMsg = in.readLine() + System.getProperty("line.separator"); jTextArea1.setText(incomingMsg); System.out.print(incomingMsg); in.close(); s.close(); } catch(Exception e) { System.out.print("not work"); }

http://stackoverflow.com/a/22824082
answers question: http://stackoverflow.com/q/22824019
has comment: http://stackoverflow.com/comment/34811337
has comment: http://stackoverflow.com/comment/34811295
upvote count: 0
has comment: http://stackoverflow.com/comment/34811303
score: -1
has comment: http://stackoverflow.com/comment/34811446
has comment: http://stackoverflow.com/comment/34811534
has comment: http://stackoverflow.com/comment/34811806
type: Answer
has body: The value of count++ is the same as the value of count; the program uses the value and then increments it. But the result is that computeSumPositive keeps calling itself with the same value of count, which leads to infinite recursion. Note that each time computeSumPositive calls another computeSumPositive, each call has its own copy of the parameters (like count) and the local variables; so incrementing one computeSumPositive's copy of count has no effect on the value of count used by other recursive calls. Change count++ to count + 1, and also add a way to halt the recursion. (At some point, you will be calling computeSumPositive to look at zero integers, and at that point, it should just return 0 and not call itself. You need to think about: how do you test whether you've reached that point?)
has comment: http://stackoverflow.com/comment/34811364
downvote count: 1

http://stackoverflow.com/a/22889473
downvote count: 0
has body: The behaviour you are seeing cannot be explained by looking just at the Java code. Rather, I suspect that it is something to do with what you are using to look at the output. First this: char[] str = { 'a', 'b', 'c', 0, 'c', 'c', 'f' }; System.out.print(str); According to the PrintWriter javadoc, System.out.print(str); would be equivalent to calling System.out.print(str[i]); for each character. (Yes each one, including the zero character!). And the behaviour of write(char) to to just encode the character according to the default platform encoding, and write it. For a Zero character (codepoint zero) and a typical 7 or 8 bit charset, that is going to write the NUL character. There is no funky "zero means of end of string" stuff on the Java side with standard Java strings of standard Java I/O classes. Period. I can think of 3 possible explanations: You are mistaken. Your actual code is writing something different. (For example, you might have forgotten to recompile ... if you are doing your testing from the command line.) The strange behaviour you are seeing is happening because your console and/or the utility you are using to display the output is doing something "special" with NUL characters. (However, I don't recall hearing of a console, etc program that handled NUL in this strange way ...) Your application has created a custom subtype of PrintWriter that implements some special handling for codepoint zero, and it has used System.setOut(...) to redirect the output via that class. Having said that, it is probably a bad idea to try to print strings or character arrays that contain zero / NUL characters. The NUL character is a "control code" and is generally classed as not printable. What you will see when you try to print it is ... unpredictable. If you want to pursue this further, I suggest that you redirect the suspect output to a file, and then use some (OS specific) utility to view the bytes of the file; e.g. od on a Unix / Linux system. I would expect to see the …
has comment: http://stackoverflow.com/comment/34929167
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/22889298
score: 3

http://stackoverflow.com/q/22840697
type: AnsweredQuestion
has body: I tried this but couldent think of any ideas how to make a showerror message property to auto fade after a certain point of time. If anybody has any ideas please share. Thanks
tagged with: android-edittext
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Auto fading of edittext set error property
linked to: http://stackoverflow.com/q/13269503
upvote count: 1
linked to: http://stackoverflow.com/q/15361983
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22841177
accepted answer: http://stackoverflow.com/a/22841177
tagged with: android

http://stackoverflow.com/a/23020164
has comment: http://stackoverflow.com/comment/35236339
has comment: http://stackoverflow.com/comment/66049047
downvote count: 1
has comment: http://stackoverflow.com/comment/35302348
has comment: http://stackoverflow.com/comment/35247641
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/22850228
has comment: http://stackoverflow.com/comment/35300188
has body: JBoss AS7 version of the configuration discussed in the answer for AS6 with multiple http connectors and a rewrite valve. --- standalone/configuration/standalone.xml.orig 1970-01-01 00:00:00.000000000 -0100 +++ standalone/configuration/standalone.xml 1970-01-01 00:00:00.000000000 -0100 @@ -257,9 +257,17 @@ <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/> + <connector name="http1" protocol="HTTP/1.1" scheme="http" socket-binding="http1"/> + <connector name="http2" protocol="HTTP/1.1" scheme="http" socket-binding="http2"/> <alias name="localhost"/> <alias name="example.com"/> + + <condition test="%{SERVER_PORT}" pattern="=8081" flags=","/> + + + <condition test="%{SERVER_PORT}" pattern="=8082" flags=","/> + @@ -293,6 +301,8 @@ <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/> <socket-binding name="ajp" port="8009"/> <socket-binding name="http" port="8080"/> + <socket-binding name="http1" port="8081"/> + <socket-binding name="http2" port="8082"/> <socket-binding name="https" port="8443"/> <socket-binding name="osgi-http" interface="management" port="8090"/> <socket-binding name="remoting" port="4447"/> See also: http://docs.jboss.org/jbossweb/7.0.x/config/http.html https://docs.jboss.org/jbossweb/7.0.x/rewrite.html
score: 3
has comment: http://stackoverflow.com/comment/65043024

http://stackoverflow.com/comment/35037586
score: 0
has text: Thank you so much for the response however when I tried that I wasn't able to successfully access all the table rows with the Item #'s only a few of them popped up, any idea why that would happen?
type: Comment
comment on: http://stackoverflow.com/a/22926103
type: AnswerComment

http://stackoverflow.com/comment/35033438
score: 0
comment on: http://stackoverflow.com/a/22945549
type: Comment
type: AnswerComment
has text: That **sun**.misc.Unsafe!!!

http://stackoverflow.com/comment/34903157
type: Comment
has text: Here is an example: http://examples.javacodegeeks.com/android/core/thread/android-thread-example/
comment on: http://stackoverflow.com/a/22874754
score: 0
type: AnswerComment

http://stackoverflow.com/q/22945967
has answer: http://stackoverflow.com/a/22946119
tagged with: java
has title: Android Eclipse Split for newline
tagged with: eclipse
has body: In my application android I've inserted : Log.i("myApp1", response.toString()); This is the output of LogCat in Eclipse for response.toString: 04-08 20:54:21.674: I/myApp1(9930): 23/03/2014&lt;br /&gt;Pics 1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;09/03/2014&lt;br /&gt;Pics 2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; How do I get this output in layout android? I need tried to split for &lt; br /> without success... 23/03/2014 Pics 1 09/03/2014 Pics 2
type: Question
accepted answer: http://stackoverflow.com/a/22946119
score: 0
answer count: 1
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/q/22852474
tagged with: oop
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22852507
has title: clear textview on update
type: Question
tagged with: android
has body: In my application I have a Spinner which shoots various https request and request for string of data. I use TextView.append() to display a set of String in the TextView. I want to clear the textview and update it with new text when new item is selected from Spinner and update the TextView with new set of String and clear the previously displayed data. for (int m = 0; m &lt; topTenUsers.size(); m++) { users = topTenUsers.get(m).getString("fullName") + "\n"; toptenusers.append(users); } Can you tell me how to clear textzView everytime Spinner option is changed
score: 0
answer count: 1

http://stackoverflow.com/comment/34870601
type: Comment
type: QuestionComment
has text: Octopus thats exactly it, the external jar is complied in 1.7. Now the question is: is javax.ws.rs-api-2.0.jar available in 1.6?
comment on: http://stackoverflow.com/q/22842971
score: 0

apache
tags question: http://stackoverflow.com/q/22942665
tag name: apache
tags question: http://stackoverflow.com/q/22829125
tags question: http://stackoverflow.com/q/22922744
tags question: http://stackoverflow.com/q/22957753
tags question: http://stackoverflow.com/q/22854346
tags question: http://stackoverflow.com/q/22847935
tags question: http://stackoverflow.com/q/22914592
tags question: http://stackoverflow.com/q/22886641
tags question: http://stackoverflow.com/q/22844268
tags question: http://stackoverflow.com/q/22954452
tags question: http://stackoverflow.com/q/22841246
tags question: http://stackoverflow.com/q/22893855
tags question: http://stackoverflow.com/q/22817343
tags question: http://stackoverflow.com/q/22919337
type: Tag
tags question: http://stackoverflow.com/q/22860265
tags question: http://stackoverflow.com/q/22931720
tags question: http://stackoverflow.com/q/22919359
tags question: http://stackoverflow.com/q/22882887

http://stackoverflow.com/q/22846430
accepted answer: http://stackoverflow.com/a/41860484
answer count: 1
downvote count: 0
favorite count: 0
has title: two optional arguments in maven command: "-fn" v.s "-Dmaven.test.failure.ignore=true", any difference?
score: 2
has body: I looked at the "mvn --help", it says -fn means "NEVER fail the build, regardless of project result", what does it mean exactly? does it have the same effect as in "-Dmaven.test.failure.ignore=true"? I tried both in the mvn command, ironically the command (mvn clean install) with "NEVER fail" option ends with a "build failure" result while the command with "-Dmaven.test.failure.ignore=true" ends with a successful build. Anyone can have a clear explanation? Thanks, John
tagged with: build
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/41860484
upvote count: 2
tagged with: java
tagged with: maven
type: Question

http://stackoverflow.com/comment/34853522
score: 0
type: Comment
has text: ok Cool. Did it working taking out the while loop for count = 0?
comment on: http://stackoverflow.com/a/22847066
type: AnswerComment

http://stackoverflow.com/comment/34785831
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22809975
has text: I added simple generation/storing mechanism.. Its true that the question is a bit ambiguous.

http://stackoverflow.com/comment/34889404
has text: Yes, actually I was looking for `cls.getEnclosingClass().
score: 0
comment on: http://stackoverflow.com/q/22867693
type: Comment
type: QuestionComment

togglebutton
tags question: http://stackoverflow.com/q/22842943
tag name: togglebutton
type: Tag

http://stackoverflow.com/comment/34909928
comment on: http://stackoverflow.com/a/22876016
score: 1
has text: Correct, @Sotirios, the entire world was created, the day before you were born, for your personal entertainment. That's why the Stack Exchange servers are so close to your house.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22833506
type: Answer
answers question: http://stackoverflow.com/q/22833379
has body: Try this, for (int i=(int)mantissaMultiplierArray[0];i&lt; mantissaCharArray.length;i++) { // } mantissaMultiplierArray[0] will return float value.
score: 0

http://stackoverflow.com/comment/34978301
score: 0
type: Comment
has text: I **do** see data in the JPanel when I run the code above. Screenshot attached.
type: AnswerComment
comment on: http://stackoverflow.com/a/22864643

http://stackoverflow.com/q/22853070
answer count: 2
has body: import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JLabel; public class gui extends JFrame{ private static final long serialVersionUID = 1L; private JLabel item1; public void createGUI(){ setTitle("Window Title"); setLayout(new FlowLayout()); item1 = new JLabel("This is a sentence."); item1.setToolTipText("This is a tip..."); add(item1); } import javax.swing.JFrame; public static void main(String[] args) throws Exception{ gui guiObj = new gui(); guiObj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); guiObj.setSize(300,300); guiObj.setVisible(true); } The window's title isn't being applied and the label isn't showing up. I'm not sure why... Does anyone see something I might have overlooked?
has answer: http://stackoverflow.com/a/22853102
possible better answer: http://stackoverflow.com/a/22853089
accepted answer: http://stackoverflow.com/a/22853102
tagged with: constructor
tagged with: swing
type: AnsweredQuestion
has title: JFrame/JLabel issues
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22853089
score: 0

http://stackoverflow.com/comment/35037526
score: 0
comment on: http://stackoverflow.com/q/22949347
type: Comment
type: QuestionComment
has text: Have you tried `\\#`?

http://stackoverflow.com/comment/90723597
type: AnswerComment
has text: This value can be up to 6 hours old.
score: 0
comment on: http://stackoverflow.com/a/51787806
type: Comment

http://stackoverflow.com/a/22923826
has body: Try comparing your implementation to https://github.com/forge/plugin-spring-mvc. That is another Forge plugin that overrides the default scaffold (uses Spring instead of JSF). In particular for your problem, it has a metawidget-qbe.xml file: https://github.com/forge/plugin-spring-mvc/tree/master/src/main/resources/scaffold/spring
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22909301

http://stackoverflow.com/a/22956287
has comment: http://stackoverflow.com/comment/80739713
type: Answer
accepted answer of: http://stackoverflow.com/q/22956156
answers question: http://stackoverflow.com/q/22956156
score: 2
downvote count: 0
upvote count: 2
has body: There are more ways to select WebElement objects than just hooking onto their ID. You can check the various ways HERE but I recommend you look specifically at the CSS Selector which you can probably use in your situation to traverse through the DOM from the nearest element that has an ID for example. Example of CSS Selector from the docs I linked: WebElement cheese = driver.findElement(By.cssSelector("#food span.dairy.aged")); You could also use the XPath selector if you are more comfortable with XPath than CSS. Example: List&lt;WebElement&gt; inputs = driver.findElements(By.xpath("//input")); Since it seems that you are dealing with a select element you could also use something along the lines of this: WebElement select = driver.findElement(By.tagName("select")); List&lt;WebElement&gt; allOptions = select.findElements(By.tagName("option")); for (WebElement option : allOptions) { if("yourDesiredValue".equals(option.getAttribute("value"))){ option.click(); } } Where "yourDesiredValue" is a String representing the value attribute of the option tag you wish to select.
type: AcceptedAnswer

http://stackoverflow.com/comment/34984291
comment on: http://stackoverflow.com/a/22917218
score: 1
has text: If you do want to compile using an older JDK, you can either run Gradle with that JDK, or configure Gradle compile tasks with the old JDK path (which users could set in `init.gradle` or via an environment variable), or configure Gradle compile tasks with a bootstrap class path pointing to the old JDK. The Eclipse compiler simply doesn't issue such a warning.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34904233
type: AnswerComment
has text: Well, it chooses the radix of your numbers; the default is 10, therefore accepted digits range from 0 to 9; if 8 (octal), it will be 0 to 7; and 16, 0 to 9 plus a to f (or A to F). Decoding hexadecimal is therefore done using a radix of 16 ;)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22875334

http://stackoverflow.com/a/22907413
has comment: http://stackoverflow.com/comment/34971094
score: 0
has body: It's called Polish (or prefix) Notation, you can find many examples (also for Reverse Polish Notation which is very similar) and online calculators (e.g. http://prefix-calc.appspot.com/)
answers question: http://stackoverflow.com/q/22906146
type: Answer
has comment: http://stackoverflow.com/comment/34961770

http://stackoverflow.com/a/23143010
answers question: http://stackoverflow.com/q/22953732
type: Answer
upvote count: 1
score: 1
has body: The only way this is workable is if you subclass StringObjectKeyValueStore: class FriendStore extends StringObjectKeyValueStore&lt;Friend&gt;{} The you can resolve V for a particular type, such as KeyValueStore, using TypeTools (which I authored): Class&lt;?&gt; v = TypeResolver.resolveRawArguments(KeyValueStore.class, FriendStore.class)[1]; assert v == Friend.class;
downvote count: 0

http://stackoverflow.com/a/22841339
has comment: http://stackoverflow.com/comment/34841663
has comment: http://stackoverflow.com/comment/34842067
answers question: http://stackoverflow.com/q/22841218
downvote count: 0
has comment: http://stackoverflow.com/comment/34841983
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/34841815
score: 2
has comment: http://stackoverflow.com/comment/34841905
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34842403
has body: Double-click on your Tomcat service under the Servers tab, and click on the "Open launch configuration" to open the Tomcat launch configuration window. Then, in their change your VM args (different from default VM args). EDIT: If you are running a JAR from a Junit Test, you will need to change the VM Arguments in the Junit Launch configruation. You can view your Run/Debug launch configs and then edit the arguments tab.
accepted answer of: http://stackoverflow.com/q/22841218

http://stackoverflow.com/q/22900376
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34949114
has comment: http://stackoverflow.com/comment/34949070
has body: I think because my ListView is set to layout_height="match_parent", the Buttons are not called onClick method. @Override public View getView(final int position, View convertView, ViewGroup parent) { if(convertView == null) { Log.d(TAG_DEBUG,"0"); } else{ Button button1 = (Button) convertView.findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG_DEBUG, "TEST"); } }); } return super.getView(position, convertView, parent); } My layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:id="@+id/num_ord" android:background="@drawable/fon_ord" android:layout_gravity="center_horizontal" android:layout_marginTop="10dp" android:textColor="#FFFFFF" android:focusable="false" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:id="@+id/title_ord" android:textColor="#000000" android:typeface="serif" android:textStyle="normal|italic" android:focusable="false" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="Sum:" android:id="@+id/textView2" android:textColor="#FFFFFF" android:background="@drawable/fon_ord" android:focusable="false" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:id="@+id/sum_ord" android:layout_gravity="left|center_horizontal" android:layout_marginTop="-24dp" android:textColor="#000000" android:layout_marginLeft="64dp" android:fo…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34949380
score: 0
tagged with: android-listview
has title: don't work onClick in buttons at list_view height = match_parent
tagged with: android

http://stackoverflow.com/q/22921259
upvote count: 6
has answer: http://stackoverflow.com/a/22932390
type: AnsweredQuestion
has body: Consider the following code, which is an extraction of a real use case where LinkedList&lt;E&gt; implements both List&lt;E&gt; and Deque&lt;E&gt;. One can observe that both interfaces have a size() and an isEmpty() method, where the isEmpty() method could be made default in terms of size(). So, let's do that (with dummy interfaces), since Java 8 does not do it yet: interface List&lt;E&gt; { public int size(); default public boolean isEmpty() { return (size() == 0); } //more list operations } interface Deque&lt;E&gt; { public int size(); default public boolean isEmpty() { return (size() == 0); } //more deque operations } class LinkedList&lt;E&gt; implements List&lt;E&gt;, Deque&lt;E&gt; { private int size; @Override public int size() { return size; } } Oops! We get a compile-time error on LinkedList, as it does not know which isEmpty() implementation to use, so we add this: @Override public boolean isEmpty() { return List.super.isEmpty(); } Now we have lost practically all benefits of default methods for this use case, as it still takes us as much code to write the isEmpty() method as it did before. But can it be solved? Yes! Consider the following implementation: interface Sizable { public int size(); default public boolean isEmpty() { return (size() == 0); } } interface List&lt;E&gt; extends Sizable { //list operations } interface Deque&lt;E&gt; extends Sizable { //deque operations } class LinkedList&lt;E&gt; implements List&lt;E&gt;, Deque&lt;E&gt; { private int size; @Override public int size() { return size; } } So the question: Is this how we, and also the JDK, are supposed to handle it in future implementations?
tagged with: default-method
has comment: http://stackoverflow.com/comment/34987199
tagged with: java
has comment: http://stackoverflow.com/comment/34988245
has comment: http://stackoverflow.com/comment/34987134
has comment: http://stackoverflow.com/comment/34986974
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34987449
score: 5
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/22932390
answer count: 1
favorite count: 0
has title: Are sub-interfaces the solution to default-method conflicts?
has comment: http://stackoverflow.com/comment/34986860
has comment: http://stackoverflow.com/comment/34987142
tagged with: java-8

http://stackoverflow.com/a/22894597
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: I think the problem is your web.xml file. It's redundant. Context.xml specifies a data source with the appropriate configuration and then web.xml specifies one without a URL or driver class name. Try removing this resource-ref block from web.xml and try again: Resource reference to a DataSource for managing a connection pool. jdbc/aName javax.sql.DataSource Container You also have extra quotes in your URL attribute in context.xml: url="jdbc:mysql://"whateverhost":"whateverport"/dbSchema?autoReconnect=true"/> Make this: url="jdbc:mysql://whateverhost:whateverport/dbSchema?autoReconnect=true"/>
has comment: http://stackoverflow.com/comment/34949375
accepted answer of: http://stackoverflow.com/q/22894499
answers question: http://stackoverflow.com/q/22894499
upvote count: 1

http://stackoverflow.com/q/22891803
has title: System.out.print .. printing not in order
has comment: http://stackoverflow.com/comment/34933441
has comment: http://stackoverflow.com/comment/34933222
has comment: http://stackoverflow.com/comment/34933310
has comment: http://stackoverflow.com/comment/34933432
has comment: http://stackoverflow.com/comment/34933308
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34933291
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34933282
has comment: http://stackoverflow.com/comment/34933334
has comment: http://stackoverflow.com/comment/34933260
has answer: http://stackoverflow.com/a/22891969
answer count: 1
has body: I'm using System.out.print to print an arrayList (cl), The code looks like this: System.out.print("Returning \n"); for(int i = 0 ; i &lt;cl.size(); i++){ if(i+1 == cl.size()) System.out.print(cl.get(i)); else System.out.print(cl.get(i)+" ,"); } The output should look like: Returning 1,2,3.... but it shows up like this: 0 ,5 ,6 Returning Edit: The problem is not in the order of the elements, but in "Returning" position. I'm using Windows 8 as an operations system and NetBeans as IDE. Why?!
has comment: http://stackoverflow.com/comment/34933244
score: 0

http://stackoverflow.com/comment/34974783
type: Comment
comment on: http://stackoverflow.com/a/22902940
score: 0
type: AnswerComment
has text: If that fixed the solution, feel free to choose my answer.

http://stackoverflow.com/comment/34874382
type: QuestionComment
comment on: http://stackoverflow.com/q/22859510
type: Comment
has text: I am using smtp.gmail.com and port 587. and its work in standalone application in java but not in servelets.
score: 0

http://stackoverflow.com/a/22869415
has body: You're probably good. The Inet class includes the method public static synchronized void setIfNotSet(int newPolicy) { /* * When setting the new value we may want to signal that the * cache should be flushed, though this doesn't seem strictly * necessary. */ if (!propertySet) { checkValue(newPolicy, cachePolicy); cachePolicy = newPolicy; } } Which seems designed to set a new policy. The checkValue method makes sure you don't lax the policy as a security measure, which you're not doing in this case so it's okay. (I'm still researching where it's used, would like something more definite.)
type: Answer
answers question: http://stackoverflow.com/q/22869218
score: 0

http://stackoverflow.com/comment/34969630
score: 0
type: QuestionComment
has text: Please share the logcat details
type: Comment
comment on: http://stackoverflow.com/q/22912206

http://stackoverflow.com/q/22847935
tagged with: apache
answer count: 1
downvote count: 1
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/34854106
has comment: http://stackoverflow.com/comment/34854563
has comment: http://stackoverflow.com/comment/34868749
has answer: http://stackoverflow.com/a/22848293
has comment: http://stackoverflow.com/comment/34868353
has comment: http://stackoverflow.com/comment/34854400
has body: After 2 to 3 deployments, I'm continuously getting PemSpace Error in windows8. I have been trying with different approaches like setting pemgen variables as java start parameter in Apache but no idea worked .could anyone help me in resolving this.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34854307
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/88235
has comment: http://stackoverflow.com/comment/34855086
has title: how to prevent PemGen space error in Apache Tomcat
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34859308

http://stackoverflow.com/q/22835321
type: Question
has comment: http://stackoverflow.com/comment/34831005
score: -1
has comment: http://stackoverflow.com/comment/34831291
has comment: http://stackoverflow.com/comment/34831004
upvote count: 0
favorite count: 0
has title: Property file could not be resolved
type: UnansweredQuestion
tagged with: spring
tagged with: properties
has comment: http://stackoverflow.com/comment/34832775
has body: I have 2 maven modules - Webapp and Persistence. Persistence module has a property file - database.properties and two context files - persistenceContext.xml (main), datasourceContext.xml (imported to persistenceContext.xml). persistenceContext.xml &lt;context:annotation-config/&gt; &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt; &lt;context:component-scan base-package="com.example.persistence"/&gt; &lt;context:property-placeholder location="classpath:database.properties, classpath:application.properties" /&gt; &lt;import resource="classpath:datasourceContext.xml" /&gt; Files persistenceContext.xml, datasourceContext.xml and database.properties are in directory resources of Persistence module. datasourceContext.xml &lt;bean id="dataSource" destroy-method="close" class="com.mchange.v2.c3p0.ComboPooledDataSource"&gt; &lt;property name="driverClass" value="com.mysql.jdbc.Driver"/&gt; &lt;property name="jdbcUrl" value="${database.url}"/&gt; &lt;property name="user" value="${database.username}"/&gt; &lt;property name="password" value="${database.password}"/&gt; &lt;property name="debugUnreturnedConnectionStackTraces" value="true"/&gt; &lt;property name="unreturnedConnectionTimeout" value="20"/&gt; &lt;property name="minPoolSize" value="5"/&gt; &lt;property name="initialPoolSize" value="10"/&gt; &lt;property name="maxPoolSize" value="50"/&gt; &lt;property name="maxStatements" value="50"/&gt; &lt;property name="idleConnectionTestPeriod" value="120"/&gt; &lt;property name="maxIdleTime" value="1200"/&gt; &lt;/bean&gt; database.properties database.url=jdbc:mysql://255.255.255.255:3306/... database.username=... database.password=... Persistence maven module is dependency of Webapp module. When I deploy Webapp to Tomcat it failed with exception: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in class path resource [spring-datasource.xml]: Could not resolve placeholder 'database.url' i…
has comment: http://stackoverflow.com/comment/34830888
answer count: 0
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/35247149
comment on: http://stackoverflow.com/a/23031415
type: AnswerComment
type: Comment
score: 1
has text: Right, I have not thought of the general calendar-system-support in `WeekFields`. Well, the french revolutionary calendar with its 10-day-week is surely not supported, but upvoted your enlightening answer.

http://stackoverflow.com/comment/34963546
type: QuestionComment
comment on: http://stackoverflow.com/q/22904390
has text: Could you give us your connect String?
score: 0
type: Comment

http://stackoverflow.com/comment/35022098
comment on: http://stackoverflow.com/q/22924173
score: 0
type: Comment
type: QuestionComment
has text: Your quotes on your latest edits in the read.csv part are messed up. Is that what you had in your code?

http://stackoverflow.com/a/66696034
has comment: http://stackoverflow.com/comment/133374883
downvote count: 0
score: 4
type: Answer
upvote count: 4
has body: I think the problem is that you are using builder, According to the documentation of the Java API: using a builder requires setting all fields, even if they are null
answers question: http://stackoverflow.com/q/22938124

http://stackoverflow.com/q/22866024
has title: LiquiBase : is the SQL Code specified between platform independent?
answer count: 1
has answer: http://stackoverflow.com/a/22866875
type: AnsweredQuestion
tagged with: java
tagged with: liquibase
accepted answer: http://stackoverflow.com/a/22866875
type: Question
has body: As mentioned in the tilte, I wonder if the sql code provided between the sql tag in Liquibase changeset is independent of the database type.I mean, is it refactored before executed to different DB Type ? Thanks.
tagged with: database
score: 0
tagged with: sql

http://stackoverflow.com/a/22912586
type: Answer
answers question: http://stackoverflow.com/q/22912472
has body: Since your ViewPagerIndicator library already have the android-support-v4.jar and so remove it from Demoapp and appcompact_v7, then it will work. As both the projects are inheriting it from the ViewPagerIndicator
score: 0
has comment: http://stackoverflow.com/comment/34971635

http://stackoverflow.com/comment/34966652
type: QuestionComment
comment on: http://stackoverflow.com/q/22860902
score: 1
has text: Is the remote RESTful service under your control at all? Can you make a copy of it for testing purposes to prevent any poisoning of a live environment? If not, you may want to look into mocking out this RESTful service (by creating your own simplified version of it), and running integration tests against that instead.
type: Comment

http://stackoverflow.com/q/22901369
favorite count: 0
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
has title: Saving user input in Multidimentional array
has answer: http://stackoverflow.com/a/22901652
score: -1
upvote count: 0
has body: I want to make an application that takes (Username,password,Phone No.,And E-mail) from user, but I can't save the string values of user input how can i save the user input if I want to take many usernames or passwords.....etc? public static void main(String[] args) { Scanner o = new Scanner(System.in); String a[] = new String[10000]; String g[] = new String[10000]; String k[] = new String[10000]; String l[] = new String[10000]; for (int rr = 0;; rr++) { for (int i = 0; i &lt; a.length; i++) { System.out.println("Username : "); a[i] = o.nextLine(); break; } for (int j = 0; j &lt; g.length; j++) { System.out.println("Password : "); g[j] = o.nextLine(); break; } for (int s = 0; s &lt; k.length; s++) { System.out.println("E-Mail : "); k[s] = o.nextLine(); break; } for (int r = 0; r &lt; l.length; r++) { System.out.println("Phone number : "); l[r] = o.nextLine(); break; } } }
answer count: 1
has comment: http://stackoverflow.com/comment/34950896

http://stackoverflow.com/comment/35014844
comment on: http://stackoverflow.com/a/22935626
type: AnswerComment
has text: Sorry but I didn't get you. In my jar, if I extract, I see that swt dll is present. Shouldn't that be enough ?
score: 0
type: Comment

http://stackoverflow.com/comment/34993308
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22921073
has text: It is a plug-in for eclipse

http://stackoverflow.com/q/22833361
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/22833652
accepted answer: http://stackoverflow.com/a/22833457
has answer: http://stackoverflow.com/a/22833652
type: Question
has title: Hibernate update java object field from database
upvote count: 0
tagged with: persistence
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/22833494
score: -2
has answer: http://stackoverflow.com/a/22833457
downvote count: 2
has body: I have bean @Entity @Table(name = "Users") public class User { @Id @GeneratedValue @Column(name = "userId") private Integer userId; @Column(name = "username") private String username; @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "parentId") @Fetch(value = FetchMode.SUBSELECT) private List&lt;User&gt; childs; @Column(name = "password") private String password; @Column(name = "email") private String email; @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "userId") @Fetch(value = FetchMode.SUBSELECT) private List&lt;Role&gt; roles; and an object loaded by hibernate, but before saving all changes to database I need to get current password from database. I am trying to do this if (user.getPassword() == null) { user.setPassword(userDao.getUserById(user.getUserId()).getPassword());} but I am getting DuplicateKeyException. So, how can I do this? Or, can I save all fields except password?
type: AnsweredQuestion

http://stackoverflow.com/comment/34788523
score: 0
type: QuestionComment
has text: Did you read my second comment?
type: Comment
comment on: http://stackoverflow.com/q/22811379

http://stackoverflow.com/q/22835782
favorite count: 0
has answer: http://stackoverflow.com/a/22837071
has title: Can i have 2 separate log files for the same class using log4j?
has body: I have a class in which i am using log4j to log messages. I have log messages in if and else part of the code. I need to log the messages in if{} condition to a separate log file and the else part log messages to a separate log file. For example in the below code the message inside if should be logged in log1 file and inside else message should be logged in log2 file. I am using log4J XML configuration file. May i know if this is possible using log4j?? Any help is highly appreciated. Thanks in advance. if(id=1){ logger.info("inside if"); }else{ logger.info("inside else"); }
has comment: http://stackoverflow.com/comment/34832012
type: UnansweredQuestion
upvote count: 1
tagged with: logging
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22836110
downvote count: 0
linked to: http://stackoverflow.com/q/6358836

http://stackoverflow.com/comment/34969403
type: Comment
score: 1
has text: If you do as Brad suggests and create a factory of your own, don't forget to create an interface for the implementation(s) you are creating. Declare your factory as returning the interface. This interface would typically not include the init() method. This keeps the user of the class from seeing it and being tempted to call it themselves.
comment on: http://stackoverflow.com/a/22912042
type: AnswerComment

http://stackoverflow.com/a/63199878
score: 1
answers question: http://stackoverflow.com/q/22908086
downvote count: 0
type: Answer
upvote count: 1
has body: I had the same issue, but I fixed it by using: com.smartbear.soapui soapui 4.6.1

http://stackoverflow.com/comment/34810801
comment on: http://stackoverflow.com/q/22823446
score: 0
has text: Basically, I'm talking about using a [model-view-control](http://blog.codinghorror.com/understanding-model-view-controller/) and [observer pattern](http://www.oodesign.com/observer-pattern.html) to link the various parts of the program and provide notifications when things change
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/64357147
has text: Let me guess, you were implementing dhash in java? Is your implementation open source by any chance?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22866219

http://stackoverflow.com/q/22909433
tagged with: eclipse
answer count: 0
has comment: http://stackoverflow.com/comment/35010371
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35013404
has comment: http://stackoverflow.com/comment/35008341
has comment: http://stackoverflow.com/comment/35010994
has comment: http://stackoverflow.com/comment/35009300
has comment: http://stackoverflow.com/comment/35007592
has title: Runing plugin project from another java project
has comment: http://stackoverflow.com/comment/35011420
has comment: http://stackoverflow.com/comment/34970875
tagged with: eclipse-plugin
has body: I have a plugin project project say pluginProject in workspace workspace1 and a java project say javaProject in workspace workspace2. Now my requirement is that I want run a pluginProject's test from a class inside javaProject. How can this be achieved? Detailed description along with snippet is appreciated.
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/35013293

http://stackoverflow.com/comment/35035232
has text: There is no problem with the console, it outputs arabic text. The full text is printed in the console, the problem starts after the tokenization.
score: 0
comment on: http://stackoverflow.com/q/22946736
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35104822
comment on: http://stackoverflow.com/a/22986805
type: Comment
has text: And remove the line `cc.setClientProperty(this.getItem());` from the constructor of NewClientCell as the item is null anyway.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35080952
score: 0
comment on: http://stackoverflow.com/q/22957241
type: QuestionComment
type: Comment
has text: Have you looked at the server output to see if there are any exceptions, and have you inspected with a logger or with a simple print if the service method is able to read the `Chapitre` instance passed through `@PathParam`? Have you inspected the query result before returning it?

http://stackoverflow.com/q/22814360
answer count: 1
favorite count: 0
tagged with: io
has answer: http://stackoverflow.com/a/22815806
has body: Would be possible to unzip tar.gz file partially e.g. unzip only few megabytes from the middle of the large tar.gz file ? I got this idea as we have a lot zipped log files and it's very time consuming to unzip 100mb log file into ~1gb file and then search in it. Would be great to have option of 'partial unzip'.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34793655
has title: Unzipping tar.gz file partially
has comment: http://stackoverflow.com/comment/34818334
downvote count: 1
has comment: http://stackoverflow.com/comment/34795722
tagged with: algorithm
tagged with: gzip
tagged with: java
tagged with: compression
score: -1
type: Question
upvote count: 0

http://stackoverflow.com/a/22947124
upvote count: 2
has body: Either Rserve or JRI would work. The key distinction is that Rserve separates the R logic from the rest of the application while JRI will include it in the application. I think the former would be the better option for your set up but the best way to figure out which is best is to test various scenarios that your application will run under and compare their performance.
accepted answer of: http://stackoverflow.com/q/22947010
has comment: http://stackoverflow.com/comment/35036662
answers question: http://stackoverflow.com/q/22947010
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/35060069

http://stackoverflow.com/comment/34848164
type: QuestionComment
comment on: http://stackoverflow.com/q/22844048
has text: @Mani you are right i need to modify the format of xml while sending back to supplier.Mani i edited my second point based on your last comment.Good question.
score: 0
type: Comment

http://stackoverflow.com/q/22924411
has comment: http://stackoverflow.com/comment/35045163
has body: I'm struggling with a matter that confuses me and leaves me thinking if the problem comes from the tomcat or vaadin. The application: The application i created is the starting project you can build with eclipse and vaadin 7 plugin, that builds a page with a button. Whenever you click the button, a line of text appears below, clicking more times adds more lines. The problem: This application ran on eclipse like a charm with a tomcat server. However, when i deploy to a tomcat 7 server running on an apache server, i retreive the "Cookies Disabled" message, in whatever browser i use (IE, Firefox and chrome), and even removing all security and accepting all cookies from each browser, it doesn't seem to work. The code it generates is the following: EvotestUI.java import javax.servlet.annotation.WebServlet; import com.vaadin.annotations.Theme; import com.vaadin.annotations.VaadinServletConfiguration; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinServlet; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; @SuppressWarnings("serial") @Theme("evotest") public class EvotestUI extends UI { @WebServlet(value = "/*", asyncSupported = false) @VaadinServletConfiguration(productionMode = false, ui = EvotestUI.class) public static class Servlet extends VaadinServlet { } @Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout); Button button = new Button("Click Me"); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { layout.addComponent(new Label("Thank you for clicking")); } }); layout.addComponent(button); } } ivysettings.xml <?xml version="1.0" encoding="UTF-8"?> <settings defaultResolver="default" /> <ibiblio name="public" m2compatible="true" /> <ibiblio name="vaadin-addons" usepoms="true" m2compatible="true"root=…
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/28497100
favorite count: 0
tagged with: vaadin7
downvote count: 0
has title: Vaadin 7 example showing "Cookies Disabled" message when deployed to tomcat 7
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35753530
tagged with: tomcat7
type: Question
tagged with: cookies
score: 1
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/34866388
comment on: http://stackoverflow.com/q/22854781
type: QuestionComment
type: Comment
has text: https://communities.vmware.com/thread/232203?start=15&tstart=0 might help
score: 0

http://stackoverflow.com/a/22956164
answers question: http://stackoverflow.com/q/22945589
downvote count: 0
has body: Running dependency:tree instead of dependency:list will show you the dependency tree for the project, which should reveal the origin of the Spring 3 dependencies. Here is an example of how the dependency tree output looks like: [INFO] [dependency:tree] [INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT [INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile [INFO] | \- commons-validator:commons-validator:jar:1.2.0:compile [INFO] | \- commons-digester:commons-digester:jar:1.6:compile [INFO] | \- (commons-collections:commons-collections:jar:2.1:compile - omitted for conflict with 2.0) [INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile [INFO] \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile [INFO] \- commons-collections:commons-collections:jar:2.0:compile
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/35041633
type: Comment
comment on: http://stackoverflow.com/q/22951727
score: 0
type: QuestionComment
has text: If I did int[][] x = new int[10][10], doing System.out.println(x[0][0]) would give me 0 because primitives have 0 by default. So I guess class objects would have null then?

http://stackoverflow.com/comment/34944117
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22897738
has text: @JeffGohlke - What if deals with speed trading or any other extremely time-sensitive activities?
score: 0

http://stackoverflow.com/comment/34931986
comment on: http://stackoverflow.com/a/22835867
type: AnswerComment
score: 0
type: Comment
has text: It is just a behavior in Java. If you would have used '10' instead of '1000' in your example both prints would have been 'true'. JonK explain it above, and vishal linked to a different thread with all the relevant info.

http://stackoverflow.com/q/22898363
answer count: 1
accepted answer: http://stackoverflow.com/a/22898455
tagged with: swing
has body: I just tested this code for GridBagLayout, I wonder why there's error with this code but it isn't with another code. This code got exception IllegalArgumentException: cannot add to layout: constraint must be a string (or null): import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Layout extends JFrame { gridbag g=new gridbag(); public Layout() { add(g, BorderLayout.CENTER); } public static void main(String[]args) { Layout lay=new Layout(); lay.setSize(500, 500); lay.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); lay.setLocationRelativeTo(null); lay.setVisible(true); } class gridbag extends JPanel { private JLabel label=new JLabel("Test"); public gridbag() { setLayout(new GridBagLayout()); GridBagConstraints gbc=new GridBagConstraints(); Container container=getContentPane(); addC(label, container, gbc, 0, 0, 1, 4, 0, 0); } private void addC(Component c, Container container, GridBagConstraints gbc, int C, int R, int nC, int nR, double wX, double wY ) { gbc.gridx=C; gbc.gridy=R; gbc.gridwidth=nC; gbc.gridheight=nR; gbc.weightx=wX; gbc.weighty=wY; container.add(c, gbc); } } } But this code worked: import java.awt.*; import javax.swing.*; import java.awt.event.*; class gridbag extends JPanel { private JLabel label=new JLabel("Test"); public gridbag() { setLayout(new GridBagLayout()); GridBagConstraints gbc=new GridBagConstraints(); Container container=this; addC(label, container, gbc, 0, 0, 1, 4, 0, 0); } private void addC(Component c, Container container, GridBagConstraints gbc, int C, int R, int nC, int nR, double wX, double wY ) { gbc.gridx=C; gbc.gridy=R; gbc.gridwidth=nC; gbc.gridheight=nR; gbc.weightx=wX; gbc.weighty=wY; container.add(c, gbc); } public static void main(String[]args) { gridbag g=new gridbag(); JFrame frm=new JFrame(); frm.setSize(500, 500); frm.add(g, BorderLayout.CENTER); frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frm.setLocationRelativeTo(null); frm.setVisible(true); } } One of the difference is there's a new La…
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22898455
type: Question
tagged with: gridbaglayout
tagged with: layout
has title: Java - Two Codes Comparison with GridBagLayout - IllegalArgumentException
tagged with: illegalargumentexception
score: 0

http://stackoverflow.com/q/22942419
has comment: http://stackoverflow.com/comment/35025065
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35031575
tagged with: java
has title: How to execute a .vbs file in a linux OS from java
has answer: http://stackoverflow.com/a/22942745
downvote count: 1
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/35025052
score: -1
has body: I have a .vbs file that makes the conversion of a docx file to a pdf type file, i run this .vbs from java in windows. Since i need this program running in a linux based OS i don't know if this solution would work. the .vbs and the java code that i use for the project is here in this link: http://mydailyjava.blogspot.mx/2013/05/converting-microsoft-doc-or-docx-files.html Note: I tried other solutions to convert the docx file to a pdf, but these solutions (docx4j, xdocreports, jodConverter) causes loss of format in the final pdf file, so those apis are not an option.
has answer: http://stackoverflow.com/a/22977732

http://stackoverflow.com/comment/34842176
type: Comment
type: QuestionComment
score: 1
has text: I strongly advice to use the defined URL encoding instead of inventing your own.
comment on: http://stackoverflow.com/q/22841607

http://stackoverflow.com/q/22967635
score: 1
tagged with: updating
favorite count: 0
type: Question
tagged with: android
tagged with: textview
has title: Updating an array in TextView
has answer: http://stackoverflow.com/a/22967791
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/35069488
accepted answer: http://stackoverflow.com/a/22967791
has body: I am working on an "app" that allows me to print an array in a text view and I need to be able to update the array every time an element is changed/updated. But I can't get it right. I tried to print the array again after an element is changed using printArrayToScreen(); but it prints and array directly under the original array, which makes sense, but I can't seem to update the array without reprinting it under the original each time. here is my java file. package com.example.taplature; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { int counter=0; Button prev; Button a; Button next; TextView tv; int row=6; int col=15; String[][] array = new String [row][col]; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); prev=((Button) findViewById(R.id.prev)); a=((Button) findViewById(R.id.printA)); next=((Button) findViewById(R.id.next)); tv=((TextView) findViewById(R.id.arrayTv)); setButtonOnClickListeners(); setUpArray(); printArrayToScreen(); } //prints the array to the screen private void printArrayToScreen() { // TODO Auto-generated method stub for(int i=0;i&lt;row;i++){ for(int j=0; j&lt;col;j++) { tv.append(array[i][j]+" "); } tv.append("\n"); } } //sets up the array private void setUpArray() { // TODO Auto-generated method stub for(int i=0; i&lt;row;i++) for(int j=0; j&lt;col;j++) array[i][j]="-"; } private void setButtonOnClickListeners() { // TODO Auto-generated method stub prev.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub if(counter==0) counter=0;//if the counter is equal to 0 it does nothing else counter--;//subtracts from counter to traverse the array } }); next.setOnClickListener(new OnClickListen…
tagged with: java
type: AnsweredQuestion
tagged with: arrays
downvote count: 0

http://stackoverflow.com/a/22902195
answers question: http://stackoverflow.com/q/22902111
score: 0
has body: you should try something like: public static int max(String s){ int max = -1; char current; for(int i = 0; i&lt;s.length; i++){ current = s.charAt(i); if(current &gt; '0' &amp;&amp; current &lt; '9') if(current &gt; max) max = current; } return max; }
type: Answer

http://stackoverflow.com/q/22908072
upvote count: 1
tagged with: gwt
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22908313
type: Question
tagged with: inetaddress
tagged with: development-mode
has title: GWT Development Mode error
has comment: http://stackoverflow.com/comment/34963701
answer count: 1
downvote count: 0
favorite count: 0
has body: When i try to execute the project, even the default "Web Application Project", I receive this error: INFO: Module instance default is running at localhost:8888 apr 07, 2014 9:02:46 AM com.google.appengine.tools.development.AbstractModule startup INFO: The admin console is running at localhost:8888/_ah/admin apr 07, 2014 11:02:46 AM com.google.appengine.tools.development.DevAppServerImpl doStart INFO: Dev App Server is now running Exception in thread "Code server listener" java.lang.IllegalArgumentException: invalid host wildcard specification at java.net.SocketPermission.init(Unknown Source) at java.net.SocketPermission.(Unknown Source) at java.lang.SecurityManager.checkConnect(Unknown Source) at java.net.InetAddress.getHostFromNameService(Unknown Source) at java.net.InetAddress.getCanonicalHostName(Unknown Source) at com.google.gwt.dev.shell.BrowserListener$1.run(BrowserListener.java:78) How can i resolve this error? Thanks.
has comment: http://stackoverflow.com/comment/34962666
accepted answer: http://stackoverflow.com/a/22908313
tagged with: exception

http://stackoverflow.com/q/22885858
has comment: http://stackoverflow.com/comment/34925307
tagged with: swing
has comment: http://stackoverflow.com/comment/34923471
has comment: http://stackoverflow.com/comment/34925883
answer count: 0
score: 1
tagged with: java
has body: ============== I am creating a small 2D game which consists of a 'Main Menu' GUI, and an 'In-game' GUI (which is used to render the graphics). The Main Menu naturally has a "Start" button to create a game world and the In-Game GUI. All components work fine if you run them independently, but if "actionPerformed" in the action listener on the Start button is called, the In-Game GUI does not render all buttons/labels/scroll-pane properly, and doesn't apply the default close operation. Image: https://i.sstatic.net/EKHiY.jpg On the Left, the buttons are not rendered. On the Right, they are. The difference between code to produce left/right images: -FOR LEFT IMAGE- import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class BensGUI extends JFrame{ public BensGUI() { final JFrame bensGUI = this; Container pane = this.getContentPane(); JPanel mainPanel = new JPanel(); JButton start = new JButton("Start"); mainPanel.add(start); //This GUI is simplified from the real Main Menu start.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Player p1 = new Player("player 1", new AntBrainParser().parseBrain("cleverbrain2.brain")); Player p2 = new Player("player 2", new AntBrainParser().parseBrain("horseshoe.brain")); Pos[][] ps = new MapParser().parseMap("5.world"); //The World class creates the in-game GUI inside its constructor World w = new World(p1, p2, ps, 3427); } } ); pane.add(mainPanel); this.pack(); this.setVisible(true); } } -FOR RIGHT IMAGE- import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class BensGUI extends JFrame{ public BensGUI() { final JFrame bensGUI = this; Container pane = this.getContentPane(); JPanel mainPanel = new JPanel(); JButton start = new JButton("Start"); mainPanel.add(start); Player p1 = new Player("player 1", new AntBrainParser().parseBrain("cleverbrain2.brain")); Player p2 = new P…
tagged with: render
has comment: http://stackoverflow.com/comment/34923371
downvote count: 1
has comment: http://stackoverflow.com/comment/34923795
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/34923545
has comment: http://stackoverflow.com/comment/34943090
tagged with: user-interface
has title: Buttons/Labels not displayed when creating GUI inside actionListener
has comment: http://stackoverflow.com/comment/34934796
favorite count: 0
has comment: http://stackoverflow.com/comment/34929225
has comment: http://stackoverflow.com/comment/34923697
has comment: http://stackoverflow.com/comment/34922854
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/22966568
answers question: http://stackoverflow.com/q/22965738
has comment: http://stackoverflow.com/comment/35068180
has comment: http://stackoverflow.com/comment/35068040
has comment: http://stackoverflow.com/comment/35103247
type: Answer
has comment: http://stackoverflow.com/comment/35069212
has comment: http://stackoverflow.com/comment/35095928
score: 3
has comment: http://stackoverflow.com/comment/35067970
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/35068109
has comment: http://stackoverflow.com/comment/35068320
has body: It seems to me like Chart.js is stored in the same folder with your servlet source. Usually you should have a structure like this one (I have simplified it): /css/your-css.css /js/your-script.js /src/your-package/YourServlet.java Whenever you run your application, your compiler creates a set of files that will be copied to your web container. The copied files do not include your src folder, but instead a copy of your built (compiled) classes. All other files (with some exceptions that we should not care about right now) must be outside your src folder in order to get copied. Try moving your JS inside a js directory outside your src directory. Then, link it like this: &lt;script src='/Your-Context-Path/js/Chart.js'&gt; There must be a function to get your context path automatically, I think it is ServletContext.getContextPath() You can read about it here. That should make the trick.

http://stackoverflow.com/a/22836830
type: Answer
score: 0
has body: Simply: for(long current = a ; current &lt;= a+5*60*1000 ; current += 60*1000) { // do something with current }
answers question: http://stackoverflow.com/q/22836740

http://stackoverflow.com/q/22847918
upvote count: 17
type: Question
has answer: http://stackoverflow.com/a/22854304
has body: I have a group of classes which are instantiated by reflection, hence these are not managed by the CDI container, and no injections are made by the context. My question is, is there any way to register these classes in the CDI context, so the classes get managed by the context? Bellow, is how I create the classes: String clazz = "org.myorg.thisIsMyClass"; MyClass myClass = Class.forName(clazz).newInstance(); // myClass instance not managed by CDI How do I make the instance of myClass managed by the CDI container?
has answer: http://stackoverflow.com/a/22855526
has answer: http://stackoverflow.com/a/22928977
accepted answer: http://stackoverflow.com/a/22928977
downvote count: 0
has answer: http://stackoverflow.com/a/22916790
favorite count: 0
tagged with: cdi
answer count: 4
type: AnsweredQuestion
has title: Manually Register Class in CDI Container
tagged with: java
possible better answer: http://stackoverflow.com/a/22916790
score: 17

http://stackoverflow.com/a/22883172
answers question: http://stackoverflow.com/q/22883070
type: AcceptedAnswer
has body: You should add getter/setter to your component class so that outer class can update component's members public class Components { private int numberOfNets; private String nameOfComp; private String nameOfCompPart; private int numOfPin; public components(int i, String compName, String partName, int pin) { setNumberOfNets(i); setNameOfComp(compName); setNameOfCompPart(partName); setNumOfPin(pin); } public void setNumberOfNets(int numberOfNets) { this.numberOfNets = numberOfNets; } // Similarly other getter and setters } You can now modify any data by using following code because get() will return reference to original object so modifying this object will update in ArrayList compList.get(0).setNumberOfNets(newNumberOfNets);
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22883070
score: 5

http://stackoverflow.com/q/22874910
upvote count: 5
has answer: http://stackoverflow.com/a/22875212
type: AnsweredQuestion
downvote count: 0
has title: Weld OSGi + Apache Felix = can't find packages
has body: I use Apache Felix and weld-osgi for a Java SE application. The problem is that in injected bean I use @ApplicationScoped from package javax.enterprise.context.ApplicationScoped. But there is no such package in weld-osgi-bundle-2.1.2.Final. This package exist in weld-se but it's not in the OSGi bundle. How can I solve this problem?
favorite count: 0
tagged with: cdi
linked to: http://stackoverflow.com/q/22878449
type: Question
tagged with: osgi
linked to: http://stackoverflow.com/q/29592181
score: 5
accepted answer: http://stackoverflow.com/a/22875212
linked to: http://stackoverflow.com/q/9819090
tagged with: java
answer count: 1
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/8431859
tagged with: jboss-weld

http://stackoverflow.com/q/22906953
has comment: http://stackoverflow.com/comment/34998547
has comment: http://stackoverflow.com/comment/35000987
has comment: http://stackoverflow.com/comment/34998725
answer count: 2
has comment: http://stackoverflow.com/comment/34999628
score: 0
accepted answer: http://stackoverflow.com/a/22956877
tagged with: android
tagged with: io
tagged with: facebook
has body: I'm having issues with reading decrypted data from conceal. It looks like I can't correctly finish streaming. I pretend there is some issue with conceal, because of when I switch my proxyStream (just the encryption part) to not run it through conceal, everything works as expected. I'm also assuming that writing is ok, there is no exception whatsoever and I can find the encrypted file on disk. I'm proxying my data through contentprovider to allow other apps read decrypted data when the user wants it. (sharing,...) In my content provider I'm using the openFile method to allow contentResolvers read the data @Override public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { try { ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe(); String name = uri.getLastPathSegment(); File file = new File(name); InputStream fileContents = mStorageProxy.getDecryptInputStream(file); ParcelFileDescriptor.AutoCloseOutputStream stream = new ParcelFileDescriptor.AutoCloseOutputStream(pipe[1]); PipeThread pipeThread = new PipeThread(fileContents, stream); pipeThread.start(); return pipe[0]; } catch (IOException e) { e.printStackTrace(); } return null; } I guess in the Facebook app Facebook android team could be rather using a standard query() method with a byte array sent in MediaStore.MediaColumns() which is not suitable for me because of I'm not only encrypting media files and I also like the approach of streams better. This is how I'm reading from the Inpustream. It's basically a pipe between two parcelFileDescriptors. The inputstream comes from conceal and it is a FileInputstream wrapped into a BufferedInputStream originaly. static class PipeThread extends Thread { InputStream input; OutputStream out; PipeThread(InputStream inputStream, OutputStream out) { this.input=inputStream; this.out=out; } @Override public void run() { byte[] buf=new byte[1024]; int len; try { while ((len=input.read(buf)) &gt; 0) { out.write(buf, 0, len); } input.close(…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22956877
has title: Problems with facebooks conceal library
tagged with: encryption
has comment: http://stackoverflow.com/comment/35000329
type: Question
possible better answer: http://stackoverflow.com/a/26866216
tagged with: java
has comment: http://stackoverflow.com/comment/35000912
has answer: http://stackoverflow.com/a/26866216

http://stackoverflow.com/q/22895235
tagged with: java
has answer: http://stackoverflow.com/a/22895491
has comment: http://stackoverflow.com/comment/34939299
type: Question
has comment: http://stackoverflow.com/comment/34939320
accepted answer: http://stackoverflow.com/a/22895491
has comment: http://stackoverflow.com/comment/34939427
has title: Android/Java: How to make a static write method
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34939243
tagged with: static
has comment: http://stackoverflow.com/comment/34939295
tagged with: android
has comment: http://stackoverflow.com/comment/34939714
has body: I currently have a write method to save a few variables and I would like to use this method throughout more than one class. I can but I need to use it in static places in those classes which won't work because the save method cannot be static. Here's the method: public void saveLesson(int lessons2, int problem2, int mlessons2, int mproblem2, String checkAccuracy) { String newline = System.getProperty("line.separator"); final String saved = new String(lessons + newline + problem + newline + mlessons + newline + mproblem + newline + dontCheckMaxString()); FileOutputStream fOut = null; try { fOut = openFileOutput("lessonStore.properties", Context.MODE_PRIVATE); } catch (FileNotFoundException e) { e.printStackTrace(); } OutputStreamWriter osw = new OutputStreamWriter(fOut); try { osw.write(saved); osw.flush(); osw.close(); } catch (IOException e) { Toast andEggs = Toast.makeText(Lessons.this, "Error while writing...", Toast.LENGTH_SHORT); andEggs.show(); e.printStackTrace(); } } So I guess my question is: How do I make that method useable throughout all my classes; static or nonstatic methods?
type: AnsweredQuestion

http://stackoverflow.com/q/22884458
has answer: http://stackoverflow.com/a/22884518
tagged with: java
linked to: http://stackoverflow.com/q/453018
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34920278
has comment: http://stackoverflow.com/comment/34920179
accepted answer: http://stackoverflow.com/a/22884518
has comment: http://stackoverflow.com/comment/34920307
has body: Hey I have problem with this simple program: package werd; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; public class Werd { /** * @param args the command line arguments */ public static void main(String[] args) throws FileNotFoundException, IOException { BufferedReader in = new BufferedReader( new InputStreamReader(new FileInputStream("ikso.txt"), "UTF-8")); String line; String[] tmp = null; int slowa = 0; int lines = 0; while ((line = in.readLine())!= null){ lines++; tmp = line.split("\\s"); System.out.println(line); //System.out.println(line); for(String s : tmp){ slowa++; } } in.close(); System.out.println("Liczba wierszy to " +line+" a liczba slow w tekscie to " + slowa) } } Problem is that the variable counting is not increasing. Moreover Netbeans telling me that variable limits is not used. I had glanced at similar questions as min on this page. Way of solving counting number of lines was similar to mine. I don't understand why it doesn't work... Thanks
has title: Counting number of lines in .txt file Java
type: AnsweredQuestion
type: Question

http://stackoverflow.com/a/22925281
type: Answer
has comment: http://stackoverflow.com/comment/34998994
answers question: http://stackoverflow.com/q/22920225
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/22920225
type: AcceptedAnswer
downvote count: 0
has body: Bindings support in the EJB container has been expanded. The EJB container assigns default JNDI bindings for EJB 3.x business interfaces based on application name, module name, and component name. You do not have to explicitly define JNDI binding names for each of the interfaces or EJB homes within an EJB 3.x module or no-interface views within an EJB 3.1 module. When defining bindings, you specify Java Naming and Directory Interface (JNDI) names for the referenceable and referenced artifacts in an application. The jndiName values specified for artifacts must be qualified lookup names. You do not need to manually assign JNDI bindings names for each of the interfaces, EJB homes, or no-interface views on your enterprise beans in EJB 3.x modules. If you do not explicitly assign bindings, the EJB container assigns default bindings. So, it seems to change the name you will have to configure the specific deployment descriptor for your container. How to specify a different jndi-name than the default for an EJB in JBoss 4.2.2.GA? EDITED: Here more information for weblogic: In the book "Oracle WebLogic Server" (written by Robert Patrick, Gregory Nyberg, and Philip Aston, with Josh Bregman and Paul Done) Chapter 6: Building Enterprise JavaBeans in WebLogic Server Page 194 " WebLogic Server provides two options for mapping a session bean's remote business interfaces into the global JNDI tree. The mapping can be specified in the weblogic-ejb-jar.xml deployment descriptor or the mappedName element of the @ Stateless or @ Stateful annotations can be used." So there is no default jndi name if you do not use mappedName or weblogic-ejb-jar.xml Weblogic 10.3.5 &amp; EJB 3 JNDI names

http://stackoverflow.com/q/22950782
has comment: http://stackoverflow.com/comment/35040299
has comment: http://stackoverflow.com/comment/35041380
has comment: http://stackoverflow.com/comment/35040651
has answer: http://stackoverflow.com/a/22956257
has comment: http://stackoverflow.com/comment/35040247
has answer: http://stackoverflow.com/a/37328801
has comment: http://stackoverflow.com/comment/35041478
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22956257
tagged with: java
tagged with: collision-detection
tagged with: bufferedimage
has answer: http://stackoverflow.com/a/22951756
type: Question
has comment: http://stackoverflow.com/comment/35040238
tagged with: game-physics
has comment: http://stackoverflow.com/comment/35041278
has answer: http://stackoverflow.com/a/49622141
score: 0
has title: Detect Collision of multiple BufferedImages Java
has body: I am making a 2d rpg game in java and I have run into a problem. I can make the player move around the stage and I have rocks, trees, walls, etc. on the stage as well. I don't know how to detect the collision and make it to where the player can't move through the object. The code that reads map file and draws image on the canvas is as follows: public void loadLevel(BufferedImage levelImage){ tiles = new int[levelImage.getWidth()][levelImage.getHeight()]; for (int y = 0; y &lt; h; y++) { for (int x = 0; x &lt; w; x++) { Color c = new Color(levelImage.getRGB(x, y)); String h = String.format("%02x%02x%02x", c.getRed(),c.getGreen(),c.getBlue()); switch(h){ case "00ff00"://GRASS Tile - 1 tiles[x][y] = 1; break; case "808080"://Stone -2 tiles[x][y] = 2; break; case "894627"://Dirt -3 tiles[x][y] = 3; break; case "404040"://Rock on Grass -4 tiles[x][y] = 4; break; case "00b700"://Tree -5 tiles[x][y] = 5; break; case"000000"://Wall -6 tiles[x][y] = 6; break; case "cccccc"://Rock on stone -7 tiles[x][y] = 7; break; default: tiles[x][y] = 1; System.out.println(h); break; } } } } And the player class is as follows: public class Player { private int x,y; public int locx,locy; private Rectangle playerR; private ImageManager im; public boolean up =false,dn = false,lt=false,rt=false,moving = false,canMove = true; private final int SPEED =2; public Player(int x, int y, ImageManager im){ this.x = x; this.y = y; this.im = im; locx = x; locy = y; playerR = new Rectangle(x,y,16,16); } public void tick(){ if (up) { if(canMove){ y -= SPEED; locx = x; locy = y; playerR.setLocation(locx, locy); moving = true; } else{ y += 1; canMove=true; } } if (dn) { y +=SPEED; locx = x; locy = y; moving = true; } } if (lt) { x -= SPEED; locx = x; locy = y; moving = true; } if (rt) { x+=SPEED; locx = x; locy = y; moving = true; } } if(moving){ System.out.println("PLAYER\tX:"+locx+" Y:"+locy); moving = false; } } public void render(Graphics g){ g.drawImage(im.player, x, y, Game.TILESIZE*Game.SCALE, Game.T…
accepted answer: http://stackoverflow.com/a/22951756
has comment: http://stackoverflow.com/comment/35040749

http://stackoverflow.com/a/22868540
accepted answer of: http://stackoverflow.com/q/22868431
type: Answer
downvote count: 0
has body: I don't know anything about ForkJoin, but this looks suspicious just on general principles: if(lastElem - firstElem == 2){ if(array[firstElem] &gt; array[lastElem]) return array[firstElem]; else return array[lastElem]; } The rest of your code makes it appear that you're processing a subarray from firstElem (inclusive) to lastElem (exclusive), so shouldn't you be using lastElem-1 to index?
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22868431

http://stackoverflow.com/a/22857991
has comment: http://stackoverflow.com/comment/34871838
has body: Two pointers: The directory your conf file resides in should be on the classpath Try using MyApp.class.getClassLoader().getResource("/conf.xml"); Notice the "/" this tells java to locate it in the root of the classpath. I am assuming the file resides in the same directory from where you are running the program.
answers question: http://stackoverflow.com/q/22857822
score: 0
type: Answer

http://stackoverflow.com/a/22933902
downvote count: 0
has comment: http://stackoverflow.com/comment/35009593
has comment: http://stackoverflow.com/comment/35009164
type: Answer
accepted answer of: http://stackoverflow.com/q/22933786
answers question: http://stackoverflow.com/q/22933786
upvote count: 3
has comment: http://stackoverflow.com/comment/35009221
has body: I think the insert statement should be like this, Use single quotes around the values: "Insert into ZMAPERP_GIS_DB (GISUNIQKEY,OBJTYPE,OBJKEY,LATITUDE,LONGITUDE) values('"+gisuniqkey+"','"+objtype+"','"+objkey+"','"+lat+"','"+lng+"');"; Edit Try it yourself in a command. What will work: Option 1: INSERT INTO ZMAPERP_GIS_DB (GISUNIQKEY,OBJTYPE,OBJKEY,LATITUDE,LONGITUDE) VALUES(asdasd,asdasd,asdasd,asdasd); Option 2: INSERT INTO ZMAPERP_GIS_DB (GISUNIQKEY,OBJTYPE,OBJKEY,LATITUDE,LONGITUDE) VALUES('asdasd','asdasd','asdasd','asdasd'); I would think that option 2 will work Edit 2 But as mention in the comment. Using the prepare statement is recommended. Because this is open for sql injections Reference: SQL injection JDBC PreparedStatement Example – Insert A Record
score: 3
type: AcceptedAnswer

http://stackoverflow.com/q/22909623
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22909685
has title: Why is final needed inside a method but not inside a class
linked to: http://stackoverflow.com/q/4732544
type: Question
has comment: http://stackoverflow.com/comment/34965106
has answer: http://stackoverflow.com/a/22909685
has answer: http://stackoverflow.com/a/22909839
has answer: http://stackoverflow.com/a/22909709
upvote count: 1
has answer: http://stackoverflow.com/a/22909674
possible better answer: http://stackoverflow.com/a/22909709
favorite count: 0
has answer: http://stackoverflow.com/a/22909748
answer count: 5
type: AnsweredQuestion
downvote count: 0
has body: In Android if I'm updating a variable inside a listener, e.g. onDragListener, I either need to make the variable final if it's declared inside the method. private void myMethod() { final int[] something = {null}; mf.setOnDragListener(new TouchableWrapper.OnDragListener() { @Override public void onDrag(MotionEvent motionEvent) { map.setMyLocationEnabled(false); Log.d("Map", "Stopped location and remove drag listener"); if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) { //Stop restartLocation if it's running if (restart[0] != null) { restart[0].cancel = true; } restart[0] = new RestartLocation(); restart[0].start(); } } }); } Or if it's outside of the method it doesn't need to be final. private RestartThread restart; private void myMethod() { mf.setOnDragListener(new TouchableWrapper.OnDragListener() { @Override public void onDrag(MotionEvent motionEvent) { map.setMyLocationEnabled(false); Log.d("Map", "Stopped location and remove drag listener"); if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) { //Stop restartLocation if it's running if (restart != null) { restart.cancel = true; } restart = new RestartLocation(); restart.start(); } } }); } I'm curious as to why the final is needed inside the method, but not outside of the method. Can anyone shed some light on this?

http://stackoverflow.com/a/22911591
answers question: http://stackoverflow.com/q/22910826
type: Answer
has body: Why not use NULL istead of 0000-00-00 since you're only using 0000-00-00 for when a value is not set? You can then make adjustments to your components that are showing the value so they are showing what you want it to say when there are no value. It is hard to say anything more since your description of what you're trying to do is very vague.
score: 0
has comment: http://stackoverflow.com/comment/34970965

http://stackoverflow.com/q/22952244
score: 0
has comment: http://stackoverflow.com/comment/35042456
answer count: 1
tagged with: java
type: UnansweredQuestion
tagged with: formatting
has comment: http://stackoverflow.com/comment/35043367
has answer: http://stackoverflow.com/a/22952368
tagged with: printf
type: Question
has body: I have never properly understood how printf works and could really use some formatting help. I want my printed output to look like this: Student Correct Incorrect 1 3 7 2 4 6 3 8 2 So on and so forth. I just can't figure out the proper way to format my printf statement to achieve this. This is what I have as far as a statement: System.out.println ((studentAns.indexOf(ans) + 1) + "\t" + correct + "\t" + incorrect); And this is what I have for the headings: for (String heading : headings) { System.out.printf ("%8s\t", heading); } It maintains even spacing as far as the numbers go, but doesn't align with the headings. New programmer here - all your help is greatly appreciated. Thanks!
has title: Using printf to align numbers and headings in a table

http://stackoverflow.com/comment/34884985
has text: What does n represent? Never used the Arrays class tbh.
comment on: http://stackoverflow.com/a/22865382
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22866491
tagged with: java-8
upvote count: 16
has answer: http://stackoverflow.com/a/32243733
has answer: http://stackoverflow.com/a/22866602
tagged with: java
accepted answer: http://stackoverflow.com/a/22866602
downvote count: 0
has body: I tried digging on the web to get my question answered. I found some documents related to Project DaVinci. This is tagged to the JSR 292 which is related to including closures in the JVM. Did this project get realized and is it a part of Java 8?
score: 16
type: AnsweredQuestion
favorite count: 0
has title: Does Java 8 have tail call optimization?
type: Question
tagged with: tail-call-optimization
answer count: 2
possible better answer: http://stackoverflow.com/a/32243733

http://stackoverflow.com/comment/35018562
comment on: http://stackoverflow.com/a/22935975
type: AnswerComment
score: 0
type: Comment
has text: Yes, I want the values to change at runtime but only to change once. I want to initialise the value read from a file and some how inject the value into the annotation. Is this actually possible? Are there other approaches. The SOME_VARIABLE approach requires it be a a constant and I don't want to set it to constant at compile time.

http://stackoverflow.com/comment/35008681
type: AnswerComment
has text: I want exactly to print "value", but the problem is that it prints nothing(I mean that "value" is null. What do you think?
comment on: http://stackoverflow.com/a/22932988
type: Comment
score: 0

http://stackoverflow.com/comment/34941165
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22895518
has text: @ABoschman just noticed that, my mistake
type: Comment

http://stackoverflow.com/a/22933285
downvote count: 0
has body: You don't tell where this filename is used. The characters to encode will be different whether, for instance, it is in a URI query string or fragment part. You probably want to have a look at Guava's (15.0+) Escapers; and, in particular here, UnicodeEscaper implementations and its derived class PercentEscaper. Guava already provides a few of them usable in various parts of URLs. EDIT: here is how to do with Guava: public final class FilenameEscaper extends PercentEscaper { public PercentEscaper() { super(&quot;&quot;, false); } } Done! See here. Of course, you may want to declare that some more characters than the default ones are safe. Also have a look at RFC 5987 to make a better encoder.
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/35008185
answers question: http://stackoverflow.com/q/22932060
has comment: http://stackoverflow.com/comment/35008241
score: 3

http://stackoverflow.com/comment/34970110
comment on: http://stackoverflow.com/a/22907771
has text: Yes I did all that. The problem is that I don't want the js files to be loaded unless the browser is IE8. So I want to control the entire HTML template so I can add or modify anything in the "head" of the page.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22905244
score: 0
accepted answer: http://stackoverflow.com/a/22905416
tagged with: direction
answer count: 1
has comment: http://stackoverflow.com/comment/34957583
tagged with: android
type: AnsweredQuestion
has body: I am coding an accelerometer app for android through Eclipse. I am new to programming Java (this is my fourth app). I get the correct display for the direction "right" and "up" but it doesn't register any other direction. Thoughts? I know the images for a change in the z-axis are the same but even with commenting those out I get the same problems. Thanks!! Attached is my MainActivity.java, activity_main.xml, and my manifest. MainActivity.java package com.example.accelerometer; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.ImageView; import android.widget.TextView; public class MainActivity extends Activity implements SensorEventListener{ float [] history = new float[3]; private int mIndex = 0; private int[] mImgs = new int[3]; public Bitmap mBitMap; public TextView mTextView; public ImageView mImage; private SensorManager senSensorManager; private Sensor senAccelerometer; private long lastUpdate = 0; private float last_x, last_y, last_z; private static final int SHAKE_THRESHOLD = 600; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mImgs[0] = R.drawable.left; mImgs[1] = R.drawable.right; mImgs[2] = R.drawable.up; mImgs[3] = R.drawable.down; mImage = (ImageView) findViewById(R.id.imageView1); // mTextView = (TextView) findViewById(R.id.textView1); mBitMap = BitmapFactory.decodeResource(getResources(), mImgs[mIndex]); mImage.setImageResource(mImgs[mIndex]); // Easiest way to show a image senSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); senAccelerometer = senSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); sen…
tagged with: java
has answer: http://stackoverflow.com/a/22905416
has title: Android Accelerometer App detects only two directions
type: Question
tagged with: accelerometer
tagged with: eclipse

http://stackoverflow.com/comment/104532866
has text: I had the padding : `-----BEGIN EC PARAMETERS-----`. Had to strip off the EC Params and then read it using PEMParser. Then got the KeyPair object correctly. Otherwise PEMParser reads it as a ASN1Object if there are EC Params present in the key. I hope I am not losing the objective by stripping off the EC Parameters ?
comment on: http://stackoverflow.com/a/41947163
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22932646
has comment: http://stackoverflow.com/comment/35007339
has comment: http://stackoverflow.com/comment/35012327
answers question: http://stackoverflow.com/q/22932537
score: 0
has body: I think you should either set value of @Id column explicitly or map it with some auto-generation strategy.
type: Answer

http://stackoverflow.com/comment/34832256
type: Comment
comment on: http://stackoverflow.com/a/22836177
score: 0
type: AnswerComment
has text: It's my old code. I refactored some lines and haven't tested it.

http://stackoverflow.com/q/22912406
has body: The idea is: I have a main class, inside this class I want to create a thread. That thread must return data each 10 minutes (I know that it is not possible with a normal thread implementation). I saw some implementation about Callable or ScheduledExecuter, but I can't adapt it. I need it, because during the program execution my database are updating. So I want a thread that each 10 minute executes a query and return me the result. Thanks.
has answer: http://stackoverflow.com/a/22912589
has title: How I can implement a infinite thread returing data?
has comment: http://stackoverflow.com/comment/34970238
has answer: http://stackoverflow.com/a/22912715
type: Question
possible better answer: http://stackoverflow.com/a/22912715
score: 0
tagged with: multithreading
answer count: 3
accepted answer: http://stackoverflow.com/a/22912589
has comment: http://stackoverflow.com/comment/34970086
has answer: http://stackoverflow.com/a/22912632
tagged with: java
tagged with: callable
has comment: http://stackoverflow.com/comment/34969908
has comment: http://stackoverflow.com/comment/34970157
type: AnsweredQuestion
tagged with: runnable

http://stackoverflow.com/comment/34924337
score: 0
has text: well i cant python code works but i cant seem figure out how to get the data to be saved in java and the code seem to run but never stos
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22884220

http://stackoverflow.com/q/22941146
has body: just a simple question, with a hard (for me) to find answer :D. Here is my code (im going to try to translate the spanish part): File carpetanueva = new File("C:"+File.separator+"sistema" + File.separator + fechasal+File.separator+doc); carpetanueva.mkdirs(); carpetanueva.setWritable(true); rutadestino = ("c:"+File.separator+"sistema" + File.separator + fechasal+File.separator + doc+File.separator+"imagen.jpg"); //realizo la copia de la imagen desde el jfilechooser a su destino: Path desde = Paths.get(rutaorigen); Path hacia = Paths.get(rutadestino); try { Files.copy(desde, hacia); JOptionPane.showMessageDialog(null, "Se adjunto la planilla de ambulancia correctamente"); } catch (IOException e) { JOptionPane.showMessageDialog(null, "error: "+e.getLocalizedMessage()); } I get "rutaorigen" (frompath) from a JFileChooser. And I create "rutadestino" (topath) by using some variables so this way i can give an order. The problem is.. .if directories and the file "imagen.jpg" already exists, it gives an error.. (exception).. How can i make to check if image already exists, and if it does, rename the new image to , for example, imagen2? I cant figure out code, because im a newbie, I did a research and couldnt find something like this! Thanks in advance :)
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22943149
tagged with: path
has answer: http://stackoverflow.com/a/22941363
tagged with: exists
upvote count: 1
answer count: 4
has comment: http://stackoverflow.com/comment/35022675
has comment: http://stackoverflow.com/comment/35022585
score: 1
has answer: http://stackoverflow.com/a/61887481
tagged with: java
tagged with: file-copying
type: Question
has comment: http://stackoverflow.com/comment/35022910
linked to: http://stackoverflow.com/q/1816673
has comment: http://stackoverflow.com/comment/35022390
has answer: http://stackoverflow.com/a/47747572
downvote count: 0
has comment: http://stackoverflow.com/comment/35022799
has title: Java Path Files.copy rename if exists
favorite count: 0

http://stackoverflow.com/comment/34929617
type: Comment
comment on: http://stackoverflow.com/a/22889627
has text: Well I did that, now I'm getting a new error code: "The method add(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MainActivity.PlaceholderFragment)"
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35013260
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22932761
score: 0
has text: Are we seeing the whole picture here? or is it cropped? what's the screen size? You know that the pixels will have a different size on each screen so keeping the image pixel size will not give you a correct "meter size"?

http://stackoverflow.com/a/51787806
has comment: http://stackoverflow.com/comment/90761873
type: Answer
has comment: http://stackoverflow.com/comment/90723597
downvote count: 0
answers question: http://stackoverflow.com/q/22916815
score: 2
upvote count: 2
has body: This should help . Worked for me AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard() .withRegion("your region").build(); DynamoDB dynamoDB = new DynamoDB(client); TableDescription tableDescription = dynamoDB.getTable("table name").describe(); tableDescription.getItemCount();

http://stackoverflow.com/a/22920561
type: Answer
upvote count: 1
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/22920510
has body: It depends on what you are expecting it to be, to be safe use LONG but if it will always be a "small" table you can use int. Btw its a lot easier to try this out yourself or google than that asking here.

http://stackoverflow.com/comment/34815361
type: Comment
comment on: http://stackoverflow.com/a/22826282
type: AnswerComment
score: 0
has text: Yes I understand that. That is exactly what I have. Only I have two BufferedImage variables. I use one to read in the image values, and then I use the other one to write the values back using the arrays. This works OK. But when I try to change the values in the array before writing them back to disk, it remains unchanged ? (And of course I then read the altered image)

http://stackoverflow.com/comment/35018694
comment on: http://stackoverflow.com/q/22917486
score: 0
type: Comment
type: QuestionComment
has text: Sorry for the delay... Never used pipes in windows(and java) yet. Could you be a bit more specific on its usage, please?

http://stackoverflow.com/comment/35041579
score: 1
has text: It creates 100 nulls.
comment on: http://stackoverflow.com/q/22951727
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22955034
has body: This is what I got to make it work on Windows, OS X and Ubuntu: http://sourceforge.net/p/jalgo/code-0/HEAD/tree/trunk/src/org/aso/algo/messaging/bus/zmq/ZMQLoader.java#l17 The bus package also contains pub/sub establishment so feel free to refer to it.
has comment: http://stackoverflow.com/comment/35051354
answers question: http://stackoverflow.com/q/22954916
score: 0
has comment: http://stackoverflow.com/comment/35062414
has comment: http://stackoverflow.com/comment/35049328
has comment: http://stackoverflow.com/comment/35047909
type: Answer
has comment: http://stackoverflow.com/comment/35049888

http://stackoverflow.com/a/22859173
accepted answer of: http://stackoverflow.com/q/22859098
answers question: http://stackoverflow.com/q/22859098
has body: The simplest way I can think of is the following: final List&lt;String&gt; blackList = Arrays.asList("element1", "element2", "element3"); As you can see, that's... really minimalist, and still works :)
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34873870
type: Answer

http://stackoverflow.com/comment/34887003
score: 0
comment on: http://stackoverflow.com/a/22866318
type: Comment
has text: that's what i want to use my problem is converting this in java code. being completely honest i suck at math so this is what i need help in.
type: AnswerComment

http://stackoverflow.com/comment/34803444
has text: While I basically agree that sleep is preferred, do you have an explanation as to why wait would not perform the expected task?
score: 0
comment on: http://stackoverflow.com/a/22819770
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34944773
score: 0
comment on: http://stackoverflow.com/q/22897901
type: Comment
type: QuestionComment
has text: I originally had it in there, but removed it because it was giving me fits with another method addToStart(). I am still a relative newbie, so I am trying to wrap my head around a lot of the rules, particularly regarding interfaces/generics/etc. Binding has eliminated that error! Thank you.

http://stackoverflow.com/q/22942301
has body: I'm trying to make a form for a java application. It contains a Combobox with a list of users. Let's say I got a class Professor, with 3 attributes. Id being the 'unique', which is required for the database. public class Professor private String id; private String lastName; private String firstName; I figured the most user friendly option would be to fill the combobox with the last name and first name of the 'Professor' class, which is what I did. But now I can't figure out how to get the Professor object back. Like I said, I filled the combobox with the lastName, a space and the firstName, but once the user has choosen a professor, I can't figure out how to select the professor that the user choose. Is there some way to put an Index and a value in a Combobox? as in first option would be John Smith, second one would be Jane Adams... I've tried the use a Map collection, a List of 'id' attributes, but I can't seem to figure out how to link the 2. Any help would be much appreciated. edit: found the answer. The easiest solution is to fill the Combobox with custom classes, here 'Professor' objects. I thought that wasn't possible, but apparently it is. Add a toString() method to your class, with what you want it to be. In my case lastName + firstName. Add a @Override annotation to it and it'll show it in the Combobox, while still giving you easy access to any attributes.
upvote count: 2
has answer: http://stackoverflow.com/a/22942668
type: Question
tagged with: java
tagged with: javafx
linked to: http://stackoverflow.com/q/16437872
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22963761
tagged with: dictionary
tagged with: combobox
has title: how to use a list/map with a combobox
score: 2
type: AnsweredQuestion
tagged with: list
possible better answer: http://stackoverflow.com/a/22942668
accepted answer: http://stackoverflow.com/a/22963761

http://stackoverflow.com/comment/35008344
has text: @learner Post it somewhere else (e.g. on [Pastebin](http://www.pastebin.com) ) and share the link.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22933353
type: Comment

http://stackoverflow.com/comment/34937262
has text: You can get a substring from index 0 until the lastIndexOf("\\"), see http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#lastIndexOf%28int%29
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22893184

http://stackoverflow.com/a/22898142
answers question: http://stackoverflow.com/q/22897953
has body: I would first find the min latitude and longitude and the max latitude and longitude using a distance formula (see http://www.movable-type.co.uk/scripts/latlong.html ). Then use the answers from Android - How to get estimated drive time from one place to another? to find those which match in terms of driving distance (which will be less than or equal to the min/max). By finding the min/max lat/long, you reduce the overall number of calculations you will need to do.
score: 0
type: Answer

http://stackoverflow.com/a/23090513
type: Answer
answers question: http://stackoverflow.com/q/22951289
score: 0
has body: You keep resetting c[a] back to 1. That should come out of the b loop. Change for (a=0;a&lt;f;a++) { for(b=0;b&lt;=a;b++) { if (b==0){ System.out.format("%"+(80-a)+"s", ""); } c[a]=1; c[a]=c[a]*triangulo[a][b]; System.out.print(triangulo[a][b]+" "); } System.out.print(" ="+c[a]); System.out.println(); } to for (a=0;a&lt;f;a++) { c[a]=1; for(b=0;b&lt;=a;b++) { if (b==0){ System.out.format("%"+(80-a)+"s", ""); } c[a]=c[a]*triangulo[a][b]; System.out.print(triangulo[a][b]+" "); } System.out.print(" ="+c[a]); System.out.println(); }

instantiation
type: Tag
tags question: http://stackoverflow.com/q/22824845
tags question: http://stackoverflow.com/q/22868287
tags question: http://stackoverflow.com/q/22962415
tag name: instantiation

http://stackoverflow.com/a/22838336
has comment: http://stackoverflow.com/comment/34836247
upvote count: 8
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22837736
accepted answer of: http://stackoverflow.com/q/22837736
type: Answer
has comment: http://stackoverflow.com/comment/34842365
has body: Matrix4#setToRotation will remove any other transformation (like rotation) previously set (hence the name "setTo"). To add a rotation transformation to an already rotated matrix, use the rotate method instead. This will post-multiply the transformation. modelInstance.transform.setToRotation(Vector3.Z, phoneAccel.y*9); modelInstance.transform.rotate(Vector3.X, phoneAccel.z*9); However this will not produce your desired result, since you want the rotations to independent from each other (the rotation around the Z axis should not influence the rotation around the X axis for example). For this you can use euler angles: modelInstance.transform.setFromEulerAngles(yaw, pitch, roll);
has comment: http://stackoverflow.com/comment/34839531
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/34841830

http://stackoverflow.com/comment/35024780
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22942294
has text: sorry, need to ask you another question. The application problem was that: if i move from Main Activity to 'New Book Activity', then I click on 'save' button, it comes back to Main. But if I press 'back' hardware button from here, it comes back to 'New Book Activity'. How can I fix this?

http://stackoverflow.com/q/22861735
has answer: http://stackoverflow.com/a/22861799
has answer: http://stackoverflow.com/a/22861787
tagged with: string
possible better answer: http://stackoverflow.com/a/22861783
favorite count: 0
has answer: http://stackoverflow.com/a/22861783
duplicate of: http://stackoverflow.com/q/3387622
answer count: 5
type: AnsweredQuestion
has title: java String split, empty Array
accepted answer: http://stackoverflow.com/a/22861787
has comment: http://stackoverflow.com/comment/34878593
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/34878709
upvote count: 1
linked to: http://stackoverflow.com/q/3387622
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/34878413
has comment: http://stackoverflow.com/comment/34878314
score: -1
has answer: http://stackoverflow.com/a/22861789
has body: I try to split the String "1.1" to 2 new Strings: String[] array = "1.1".split("."); System.out.println(array[0]); but I get a java.lang.ArrayIndexOutOfBoundsException. Why?
has answer: http://stackoverflow.com/a/22861790

http://stackoverflow.com/comment/35031228
score: 3
has text: I'm not sure what answer you expect other than "Java isn't smart enough to figure out that only one of the overloads is applicable here."
type: QuestionComment
comment on: http://stackoverflow.com/q/22945870
type: Comment

http://stackoverflow.com/comment/34958862
type: Comment
has text: @JonSkeet i would really appreciate if you can help me understand more---- My scenerio is that worldwide users will login and as soon as they login the map values will get store according to his/her access/or groups he belonged to. so, is this a multiple thread scenerio ?? I wanted to tell you surely that i have not done any custom threading coding in my app. Please help me explain this..Does my scenerio look like multiple threading ?
score: 0
comment on: http://stackoverflow.com/a/22904610
type: AnswerComment

http://stackoverflow.com/comment/35046664
type: AnswerComment
score: 0
has text: I updated the code up top - Android version is 4.0.4
type: Comment
comment on: http://stackoverflow.com/a/22954737

http://stackoverflow.com/q/22956085
type: AnsweredQuestion
has body: I have maven project. Maven build complete SUCCESS. But i can't make this project. [INFO] BUILD SUCCESS Project contains one module. Idea can't see dependencies. Error:(3, 38) java: D:\Dropbox\Programming\java\spring\springBook\src\main\java\ch14\validator\ContactTestValidator.java:3: package org.springframework.stereotype does not exist POM: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 springBook springBook 1.0-SNAPSHOT <org.springframework.version>3.2.3.RELEASE</org.springframework.version> junit junit 3.8.1 test org.slf4j slf4j-log4j12 1.5.6 joda-time joda-time 2.0 javax.validation validation-api 1.0.0.GA org.hibernate hibernate-validator 4.0.2.GA org.hibernate hibernate-annotations 3.5.6-Final cglib cglib 2.2.2 org.aspectj aspectjtools 1.6.2 org.springframework spring-core ${org.springframework.version} org.springframework spring-beans ${org.springframework.version} org.springframework spring-context ${org.springframework.version} org.springframework spring-aop ${org.springframework.version} springBook Could you help me? Unfortunately, I can't add screenshots.. There are screenshots: http://screencast.com/t/iNaWO9gy http://screencast.com/t/iBGTyMpgH Project settings - Libraries - empty; reimport didn't help;
tagged with: java
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/48814335
has answer: http://stackoverflow.com/a/35937390
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/35049446
possible better answer: http://stackoverflow.com/a/22956344
has answer: http://stackoverflow.com/a/22956506
has answer: http://stackoverflow.com/a/43211234
has answer: http://stackoverflow.com/a/22956344
has comment: http://stackoverflow.com/comment/35049277
has answer: http://stackoverflow.com/a/36295399
has answer: http://stackoverflow.com/a/39893610
downvote count: 1
has title: idea intellij maven project can't make
has comment: http://stackoverflow.com/comment/39340706
tagged with: maven-3
accepted answer: http://stackoverflow.com/a/22956610
linked to: http://stackoverflow.com/q/25488194
favorite count: 0
upvote count: 12
has comment: http://stackoverflow.com/comment/35049337
tagged with: maven
score: 11
tagged with: spring
has answer: http://stackoverflow.com/a/22956610

http://stackoverflow.com/comment/82580543
has text: Collations are supported by aggregate so I would say yes
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22931211
score: 0

http://stackoverflow.com/q/22892380
answer count: 1
tagged with: tomcat
has body: I have a very simple java web application which works fine. I have this servlet mapping: carpicker /carpicker When I remove the "/" in the and try deploying my application I get the following exception: What is going on here? Why is Tomcat trying to do and why is it failing? SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/student-db]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1740) 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.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565) 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.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBean…
accepted answer: http://stackoverflow.com/a/22892412
tagged with: web.xml
type: Question
type: AnsweredQuestion
has title: Why do I get an exception when I try a servlet mapping without the "/" in the beginning
tagged with: java
tagged with: servlets
score: 0
has answer: http://stackoverflow.com/a/22892412

http://stackoverflow.com/comment/34955875
has text: for AES or Triple DES (DESede), is i just have to replace DES With AES/DESede in this line? no other alteration needed? `SecretKeyFactory factory = SecretKeyFactory.getInstance("DES");`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22859612

http://stackoverflow.com/a/22940924
score: 1
answers question: http://stackoverflow.com/q/22921865
upvote count: 1
downvote count: 0
has body: Here's an attempt at it... Step 1: I clicked on "known" world points in the camera image that you'd basically already found. I ran ginput in MATLAB and clicked on 14 point intersections that should be derivable from your Hough lines. Here are those points, in units of pixels (you can draw them overtop of the original image to see where they are): x = [ 161 118 193 119 382 116 412 116 181 149 288 147 393 146 134 268 287 266 440 266 36 358 98 358 473 352 535 353 ]'; Step 2: I calculated the corresponding world points, treating the top left of the court as origin (0,0,0) and increasing down and to the right. Every point has a Z-coordinate equal to 0 since the court is a plane. Here are those points, in units of feet: y = [ 0 0 0 4.5 0 0 31.5 0 0 36 0 0 4.5 18 0 18 18 0 31.5 18 0 4.5 60 0 18 60 0 31.5 60 0 0 78 0 4.5 78 0 31.5 78 0 36 78 0 ]'; Step 3: We now have a bunch of correspondences between camera points and world points. I used the camera calibration toolbox to derive the extrinsic and intrinsic parameters of the camera. Note that since we have so few correspondences, I skipped the calculation of the distortion parameters and aspect ratio (which should be very close to 1.0 anyway). The resulting image here shows the original world points mapped to the image given only the calibration information. We can see that the calibration was effective, in that all world points are mapped very closely to their correct locations in the image. Here's the final code: clc; clear all; img = imread('HSY1A.jpg'); nx = size(img,2); ny = size(img,1); % imshow(img,[]); x = [ 161 118 193 119 382 116 412 116 181 149 288 147 393 146 134 268 287 266 440 266 36 358 98 358 473 352 535 353 ]'; y = [ 0 0 0 4.5 0 0 31.5 0 0 36 0 0 4.5 18 0 18 18 0 31.5 18 0 4.5 60 0 18 60 0 31.5 60 0 0 78 0 4.5 78 0 31.5 78 0 36 78 0 ]'; num_pts = size(y,2); % Required by camera calibration toolbox x_1 = x; X_1 = y; % Setting up calibration parameters n_ima = 1; est_aspect_ratio = 0; est_dist = zeros(5,1); %…
has comment: http://stackoverflow.com/comment/100039630
has comment: http://stackoverflow.com/comment/99972610
has comment: http://stackoverflow.com/comment/99981347
type: Answer

http://stackoverflow.com/comment/34910392
score: 0
type: AnswerComment
has text: Thank you! If you have time, can you look at http://stackoverflow.com/questions/22878449/bootstrap-weld-osgi-version-2-in-se-app-or-bean-manager-not-found ? I need just a direction...
comment on: http://stackoverflow.com/a/22875212
type: Comment

http://stackoverflow.com/a/72812042
answers question: http://stackoverflow.com/q/22905622
score: 0
has body: I had this same problem, I think any of the below will help you Try clean and build all the projects Try refreshing each projects manually Try clean and build each projects manually If all those steps are useless, this might helps you Delete all projects in eclipse(while deleting, make sure you unchecked "Delete project content on the Disk") and import your projects from scratch, you maven built already. My problem got solved by following these steps.
type: Answer

http://stackoverflow.com/q/22922864
tagged with: hadoop
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22923919
has answer: http://stackoverflow.com/a/22924111
has comment: http://stackoverflow.com/comment/34991053
has title: Exception in Reducer in Hadoop when run on Cluster
type: Question
has body: I have a map reduce program that runs perfectly when run in stand-alone mode but when I run it on Hadoop Cluster at my school, an exception is happening in the Reducer. I have no clue what exception it is. I came to know this as when I keep a try/catch in reducer, the job passes but empty output. When I don't keep the try/catch, job fails. Since it is a school cluster, I do not have access to any of the job trackers or other files. All I can find is through programatically only. Is there a way I can find what exception happened on hadoop during run time ? Following are snippets of my code public static class RowMPreMap extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, Text&gt; { private Text keyText = new Text(); private Text valText = new Text(); public void map(LongWritable key, Text value, OutputCollector&lt;Text, Text&gt; output, Reporter reporter) throws IOException { // Input: (lineNo, lineContent) // Split each line using seperator based on the dataset. String line[] = null; line = value.toString().split(Settings.INPUT_SEPERATOR); keyText.set(line[0]); valText.set(line[1] + "," + line[2]); // Output: (userid, "movieid,rating") output.collect(keyText, valText); } } public static class RowMPreReduce extends MapReduceBase implements Reducer&lt;Text, Text, Text, Text&gt; { private Text valText = new Text(); public void reduce(Text key, Iterator&lt;Text&gt; values, OutputCollector&lt;Text, Text&gt; output, Reporter reporter) throws IOException { // Input: (userid, List&lt;movieid, rating&gt;) float sum = 0.0F; int totalRatingCount = 0; ArrayList&lt;String&gt; movieID = new ArrayList&lt;String&gt;(); ArrayList&lt;Float&gt; rating = new ArrayList&lt;Float&gt;(); while (values.hasNext()) { String[] movieRatingPair = values.next().toString().split(","); movieID.add(movieRatingPair[0]); Float parseRating = Float.parseFloat(movieRatingPair[1]); rating.add(parseRating); sum += parseRating; totalRatingCount++; } float average = ((float) sum) / totalRati…
answer count: 2
has comment: http://stackoverflow.com/comment/34992050
score: 0
tagged with: java

http://stackoverflow.com/q/22858115
has comment: http://stackoverflow.com/comment/34872223
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/22858313
has comment: http://stackoverflow.com/comment/34872162
answer count: 1
has comment: http://stackoverflow.com/comment/34872137
has answer: http://stackoverflow.com/a/22858313
has title: Eclipse shows error on package but inside this package Eclipse doesn't show errors
favorite count: 0
score: 2
has body: Often I have same problem that Eclipse shows error on package but inside this package doesn't show errors. Demonstartion: According the picture in package aren't classes with problems. P.S. it is package explorer view. I made clean for project and refresh. But it wasn't helpful. How can I fix it?
downvote count: 0
has comment: http://stackoverflow.com/comment/34872258
type: AnsweredQuestion
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/22847505
has comment: http://stackoverflow.com/comment/34853387
has comment: http://stackoverflow.com/comment/34891736
has comment: http://stackoverflow.com/comment/34891430
has comment: http://stackoverflow.com/comment/34853219
has comment: http://stackoverflow.com/comment/34853280
upvote count: 1
answers question: http://stackoverflow.com/q/22847052
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34891506
has body: Just create a new Collection where you add the desired element first, then add the rest of the elements the way you want/need. For example, you say you have a TreeSet&lt;String&gt; which has all your data sorted, then you can use, for example, a List and store all the data how you want/need. Here's a kickoff example: TreeSet&lt;String&gt; myTreeSet = ... //... //fill the data in treeSet... //... List&lt;String&gt; realData = new ArrayList&lt;String&gt;(); realData.add("partnumber"); realData.addAll(myTreeSet); In case you go with the Comparator&lt;String&gt; implementation (or the class you use), just make sure that "partnumber" always is the lesser value, otherwise do the real comparison: class MyPartNumberStringComparator implements Comparator&lt;String&gt;() { static final String PART_NUMBER = "partNumber"; @Override public int compare(String s1, String s2) { if (PART_NUMBER.equals(s1) &amp;&amp; s1.equals(s2)) { return 0; } return (PART_NUMBER.equals(s1)) ? -1 : (PART_NUMBER.equals(s2)) ? 1 : s1.compareTo(s2); } }
has comment: http://stackoverflow.com/comment/34891925
has comment: http://stackoverflow.com/comment/34892496

http://stackoverflow.com/a/22939742
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22935897
upvote count: 1
has body: As a workaround, you can explicitly instanciate the JDK factory (or Xerces's or Saxon's). import org.apache.xpath.jaxp.XPathFactoryImpl // import com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl // import net.sf.saxon.xpath.XPathFactoryImpl ... XPathFactory factory = new XPathFactoryImpl(); If possible, prefer the real Xerces implementation to the one found in the JDK. It is more reliable.
score: 1

http://stackoverflow.com/q/22925743
has title: The type of the expression must be an array type but it resolved to double
tagged with: java
tagged with: bukkit
type: Question
has answer: http://stackoverflow.com/a/22937045
tagged with: minecraft
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34998971
has comment: http://stackoverflow.com/comment/34995478
type: UnansweredQuestion
has body: When I use this code: switch (1.$SwitchMap$org$bukkit$Material[block.getType().ordinal()]) I get an error: The type of the expression must be an array type but it resolved to double I am coding a Minecraft Bukkit plugin Here is my entire code: package me.TheTrain2000.Smelter; import java.util.Iterator; import java.util.List; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin implements Listener { private static byte MAGIC_BYTE = 15; public void onEnable() { getServer().getPluginManager().registerEvents(this, this); } @EventHandler(priority=EventPriority.LOW, ignoreCancelled=true) public void onEntityExplode(EntityExplodeEvent event) { if (event.blockList().isEmpty()) { return; } for (Iterator&lt;Block&gt; i = event.blockList().iterator(); i.hasNext();) { Block block = (Block)i.next(); if ((block.getData() == MAGIC_BYTE) &amp;&amp; (shouldBreak(block))) { simulateBreak(block); i.remove(); } } } @EventHandler(priority=EventPriority.LOWEST, ignoreCancelled=true) public void onBlockBreak(BlockBreakEvent event) { Block block = event.getBlock(); if ((block.getData() == MAGIC_BYTE) &amp;&amp; (shouldBreak(block))) { simulateBreak(block); event.setCancelled(true); } } @EventHandler(ignoreCancelled=true) public void onBlockPhysics(BlockPhysicsEvent event) { Block block = event.getBlock(); Block block1 = block.getRelative(BlockFace.DOWN); Block block2 = block1.getRelative(BlockFace.DOWN); boolean aboveLava = (block1.getType() == Material.LAVA) || (block1.getType() == Material…

http://stackoverflow.com/comment/34990685
has text: Processing a single line is not likely to take very long. You might want to perform the time check every hundred lines or so, just to cut down on the system calls.
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/22923137

http://stackoverflow.com/comment/34891903
comment on: http://stackoverflow.com/a/22868781
has text: Then I really don't know what you're asking. That's what azurefrog's answer shows how to do but you said it doesn't work? Are you trying to retrieve the object found at the old key, then store it in position with the new key, and keep the old map entry along with the new map entry?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34977722
type: Comment
type: QuestionComment
has text: Thank you all for your feedback, most of you are saying I should use asynctask. im very new to this could anyone show me a example to use asynctask with the code above as im finding the online tutorials a bit confusing
comment on: http://stackoverflow.com/q/22912206
score: 0

http://stackoverflow.com/q/22947786
tagged with: logstash
downvote count: 0
has title: Unable to get Log4J SocketAppender Working
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/27584461
upvote count: 2
has body: My Java project uses Log4J2. Currently, it is successfully writing logs to a file. Now, I'm trying to push the logs to LogStash via a Socket Appender. Unfortunately, I am not having any success with these efforts. At this time, I'm looking at two pieces: my log4j2.xml file and my logstash config file. I've provided both here in hopes that someone can help me identify my problem. log4j2.xml <SerializedLayout/> <RollingRandomAccessFile name="RollingFile" fileName="/logs/server.log" filePattern="/logs/$${date:yyyy-MM}/server-%d{yyyy-MM-dd-HH}-%i.log.gz"> <TimeBasedTriggeringPolicy interval="6" modulate="true"/> <SizeBasedTriggeringPolicy size="100 MB"/> </RollingRandomAccessFile> <AppenderRef ref="RollingFile"/> <AppenderRef ref="AsyncFile"/> <AppenderRef ref="AsyncFile"/> That was my log4j2 configuration. Here is my logstash configuration: logstash.conf input { log4j { mode => "server" type => "log4j" host => "0.0.0.0" port => "4560" } } output { stdout { codec => "json" } } I start logstash from the command-line using logstash-1.4.0/bin/logstash --config /etc/logstash/logstash.conf --debug. I do not see any errors. At the same time, I do not see any logs written to the console window. I know that logs should appear because they are appearing in my rolling server.log file that was configured as the second appender in log4j. What am I doing wrong? I've been tinkering with this for 3 days.
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/39478313
tagged with: java
has comment: http://stackoverflow.com/comment/35057211
type: Question
has answer: http://stackoverflow.com/a/25143834
answer count: 2

http://stackoverflow.com/comment/34837139
type: QuestionComment
comment on: http://stackoverflow.com/q/22838951
has text: Have you looked at Spring's exception-translation infrastructure?
score: 0
type: Comment

http://stackoverflow.com/comment/34942706
score: 1
type: AnswerComment
has text: I don't know how the POS tagger works, but I'd guess it also needs to use a dictionary to find out what kind of word it is and identify its role in the sentence. So if you do only the dictionary part it would be quicker. But granted, this is a time-consuming task.
type: Comment
comment on: http://stackoverflow.com/a/22897008

http://stackoverflow.com/comment/34942249
score: 0
type: Comment
type: QuestionComment
has text: ensure that user previously have key in a value
comment on: http://stackoverflow.com/q/22896662

http://stackoverflow.com/a/22973014
answers question: http://stackoverflow.com/q/22967941
type: Answer
score: 1
has body: Have you considered: AttributeList list = new AttributeList(); list.read(file); String patientName=Attribute.getDelimitedStringValuesOrEmptyString(list,TagFromName.PatientName);
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22967941

http://stackoverflow.com/comment/34935767
type: QuestionComment
type: Comment
has text: @tmarwen yes, jooq-3.3.1.jar is in dependency folder
comment on: http://stackoverflow.com/q/22892926
score: 0

http://stackoverflow.com/q/22918671
has title: Custom ListView in Viewpager
favorite count: 0
has comment: http://stackoverflow.com/comment/34981821
answer count: 0
upvote count: 2
type: UnansweredQuestion
downvote count: 1
tagged with: android-fragments
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34981881
has body: This is my page: package[...] import [...] public class Home extends FragmentActivity { ViewPager mViewPager; ListView list; row_video_Adapter adapter; public Home CustomListView = null; public ArrayList&lt;ModelloLista&gt; CustomListViewValuesArr = new ArrayList&lt;ModelloLista&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); // Create the adapter that will return a fragment for each of the three // primary sections of the app. mSectionsPagerAdapter = new SectionsPagerAdapter( getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // ListView CustomListView = this; /******** Take some data in Arraylist ( CustomListViewValuesArr ) ***********/ setListData(); Resources res =getResources(); list= (ListView)findViewById(R.id.section_label); // List defined in XML ( See Below ) /**************** Create Custom Adapter *********/ adapter=new row_video_Adapter(CustomListView, CustomListViewValuesArr,res); list.setAdapter(adapter); } /****** Function to set data in ArrayList *************/ public void setListData(){ final ModelloLista sched = new ModelloLista(); sched.setTitolo("Video 1"); sched.setImmagine("video_preview"); sched.setUrl("http:\\www.com"); CustomListViewValuesArr.add(sched); } /***************** This function used by adapter ****************/ public void onItemClick(int mPosition){ ModelloLista tempValues = ( ModelloLista ) CustomListViewValuesArr.get(mPosition); // SHOW ALERT } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.home, menu); return true; } public class SectionsPagerAdapter extends FragmentPagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { Fragment fragment = new DummySectionFragment(); Bundle args = new Bundle…
tagged with: custom-adapter
tagged with: android

http://stackoverflow.com/comment/34886233
score: 0
type: Comment
has text: As it seems there is no clean way to get that properties. I'll have to live with that :) Anyway thanks to you all for your effort.
type: AnswerComment
comment on: http://stackoverflow.com/a/22864996

http://stackoverflow.com/comment/34943657
type: Comment
has text: @darknight These are booleans. It doesn't make too much sense to talk about "bitwise" operations on booleans.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22897582

http://stackoverflow.com/q/22879841
tagged with: apache-poi
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I'm trying to store dome data to an .xlsx excel file. The problem is that I can't write blank cells, even if I'm using row.createcell(). I get Null Pointer Excpetion errors, maybe it's because rows aren't initialized. Is there any way to initialize rows? Thanks Here's the method I've written private static void sendOrderSingle(String account, String symbol, String securityID, String securityExchange, double price, String side, double orderQty, String ordType) throws SessionNotFound, IOException { quickfix.fix42.NewOrderSingle order = new quickfix.fix42.NewOrderSingle(); SessionID sessionId = (SessionID) initiator.getSessions().get(0); order.set(new TransactTime(new Date(0))); order.set(new HandlInst('1')); order.set(new Account(account)); order.set(new Symbol(symbol)); order.set(new SecurityID(securityID)); order.set(new SecurityExchange(securityExchange)); order.set(new Price(price)); order.set(new OrdType(OrdType.LIMIT)); if (side.equals("BUY")) { order.set(new Side(Side.BUY)); } else { order.set(new Side(Side.SELL)); } order.set(new OrderQty(orderQty)); order.set(new OrdType(OrdType.LIMIT)); FileInputStream file = new FileInputStream(new File("Excel/Data.xlsx")); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet sheet = workbook.getSheetAt(0); XSSFCell cellClOrdIds = null; cellClOrdIds = sheet.getRow(1).getCell(18); Row row = sheet.getRow((int) cellClOrdIds.getNumericCellValue()); Cell cell0 = row.getCell(0); if (cell0 == null) { cell0 = row.createCell(0); } cell0.setCellType(Cell.CELL_TYPE_STRING); cell0.setCellValue(account); sheet.getRow(1).getCell(18) .setCellValue(Double.parseDouble(cellClOrdIds.toString()) + 1); FileOutputStream fos = new FileOutputStream("Excel/Data.xlsx"); workbook.write(fos); fos.close(); order.set(new ClOrdID(Integer.parseInt(cellClOrdIds.toString())+"")); Session.sendToTarget(order, sessionId); }
has comment: http://stackoverflow.com/comment/34911866
tagged with: excel
type: Question
has comment: http://stackoverflow.com/comment/34911905
score: 0
has comment: http://stackoverflow.com/comment/52032395
has title: Excel blank cells with XSSF POI
tagged with: xssf

http://stackoverflow.com/comment/35060069
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22947124
type: Comment
has text: The former, though on a separate machine would be best if resources allow it.

http://stackoverflow.com/a/22897305
has body: Try this Iterator iter=getMapProducto().keySet().iterator(); while(iter.hasNext()) { this.cboNomProducto.addItem(getMapProducto().get(iter.next()).getNomProducto()); } Details: getMapProducto().get(iter.next()) will return Producto object which can't be directly set to the combobox, you have to get Product Name from that object and add into the combobox. Edit Producto stockProducto=new Producto(); stockProducto.setNomProducto("Steel Bike"); stockProducto.setCodeProducto("BIC001"); stockProducto.setPrice(190000); getMapProducto().put(1, stockProducto); stockProducto = new Producto(); // You forgot this stockProducto.setNomProducto("Aluminium Bike"); stockProducto.setCodeProducto("BIC002"); stockProducto.setPrice(290000); getMapProducto().put(1, stockProducto); If you don't create new Producto then the same object is referenced twice in HashMap instead of 2 different Producto
has comment: http://stackoverflow.com/comment/34943866
type: Answer
accepted answer of: http://stackoverflow.com/q/22897201
answers question: http://stackoverflow.com/q/22897201
has comment: http://stackoverflow.com/comment/34946501
has comment: http://stackoverflow.com/comment/34958451
has comment: http://stackoverflow.com/comment/34943791
has comment: http://stackoverflow.com/comment/34943840
has comment: http://stackoverflow.com/comment/34943631
score: 0
upvote count: 1
type: AcceptedAnswer
downvote count: 1

http://stackoverflow.com/comment/34952469
score: 0
type: Comment
type: QuestionComment
has text: See: https://ideone.com/whiUhA
comment on: http://stackoverflow.com/q/22902314

http://stackoverflow.com/q/22836448
answer count: 2
has body: We are developing restful web services for banking operations. The problem is returning decimal numbers. Banking accounts' balance are decimal number and the client of the web service must show this balance in client's localization. So what is the best practice for this problem. Seperation of integer and fractional part is a solution. For example : balanceInt: 1500, balanceFrac:85 rather than sending balance:1500.85. Any idea?
has title: Decimal number respresentation in Restful Web Services
tagged with: rest
score: 0
has answer: http://stackoverflow.com/a/22836606
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/22836700
type: Question
tagged with: decimal

http://stackoverflow.com/q/22937461
has comment: http://stackoverflow.com/comment/35016299
tagged with: string
tagged with: hex
has comment: http://stackoverflow.com/comment/35015493
has answer: http://stackoverflow.com/a/22937556
accepted answer: http://stackoverflow.com/a/22937556
linked to: http://stackoverflow.com/q/5886619
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35015557
has title: Smartly Decoding Hex Input (e.g 0x32, 0x3, 32 etc...)
score: 0
has body: I seem to be going around in circles with this one... There are many methods to achieve this and I could use a few if statements like I've done int he example below, but I want a smarter method. Problem The user is asked to input a value in hex, the program grabs this string and will now want to convert it into an integer, bearing in mind this is a hex value. The input could be for example: 0x00 0xf ff 2 My Attempt String hexString = response.getResult(); //grabs the user input int hexInt = Integer.decode(hexString); //Doesn't work if the user doesn't add "0x" at the start String regex = "\\s*\\b0x\\b\\s*"; String hexInt = hexString.replaceAll(regex, ""); //Doesn't like 0x for some reason Int hexInt = Integer.valueOf(hexString,16); //Doesn't like 0x Any ideas on how to do this smartly?
answer count: 1

http://stackoverflow.com/comment/124250167
type: Comment
comment on: http://stackoverflow.com/a/22862267
has text: But does [DisallowConcurrentExecution] stop the job and start a new one or does it wait for the last to finish, then start a new one?
type: AnswerComment
score: 0

http://stackoverflow.com/q/22822199
has comment: http://stackoverflow.com/comment/34807945
answer count: 1
downvote count: 0
tagged with: shell
favorite count: 0
has body: I have an application that has a directory on the SD card. The application saves notes in a new subdirectory. I want to delete the whole subdirectory using shell command "rm -r" but the application throws an exception: 04-02 23:14:23.410: W/System.err(14891): java.io.IOException: Error running exec(). Command: [cd, /mnt/sdcard/mynote, &amp;&amp;, rm, -r, aaa] Working Directory: null Environment: null Can anyone help me?
has answer: http://stackoverflow.com/a/22822426
tagged with: rmdir
tagged with: android
has comment: http://stackoverflow.com/comment/34808163
accepted answer: http://stackoverflow.com/a/22822426
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Android can't exec rm -r
linked to: http://stackoverflow.com/q/5701586

http://stackoverflow.com/comment/34892705
comment on: http://stackoverflow.com/q/22861931
score: 0
type: Comment
type: QuestionComment
has text: What version of the library are you using?

http://stackoverflow.com/a/22991003
type: Answer
upvote count: 1
has body: the way you can handle such complex mesh really depends on the scope of your project. Unfortunately there is no much we can say based on the provided inputs and the activity itself is not an easy task. Usually when the mesh is very complex a typical approach to make the rendering process fast is to adopt dynamic Level Of Details (in programming terminology LOD). The idea is to render "distant" meshes with a very low LOD (and therefore having a much lower number of vertices to be rendered) and there replace the mesh with an higher resolution every time the camera approaches the mesh's details. This is a technique very used in computer games, for instance when a terrain needs to be rendered. When the player is in a particular sector of the MAP, the mesh of that sector is in High level of detail, the others are in low detail. As soon as the player moves, the different sectors become in "high resolution" (allow me the term). It is not an easy way to do it but it works in many many situations. In this gamasutra article, there are plenty of information on how this technique works: http://www.gamasutra.com/view/feature/131596/realtime_dynamic_level_of_detail_.php?print=1 The idea, in your case, would be to take the mesh provided by the web service and handle it as the HD version of the mesh. Then (particularly if the mesh is composed by different objects), apply a triangular mesh simplification algorithm to create LD meshes of the same objects. An example on the way you could proceed is well described here: http://herakles.zcu.cz/~skala/PUBL/PUBL_2002/2002_Mesh-Simplification-ICCS2002.pdf I hope to have helped in some way. Cheers Maurizio
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22924174

http://stackoverflow.com/a/22958099
answers question: http://stackoverflow.com/q/22957039
downvote count: 1
has body: Have you tracked the HTTP request using tools and does the request reaches your handler before throwing the error?
score: -1
upvote count: 0
type: Answer

http://stackoverflow.com/comment/35183037
type: Comment
has text: Cheers i was wondering it works fine what is it that failed to notice
comment on: http://stackoverflow.com/a/22958401
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34949840
type: AnswerComment
comment on: http://stackoverflow.com/a/22900725
has text: Glad it worked. Please consider accepting the answer which helped you.
score: 0
type: Comment

http://stackoverflow.com/comment/34792618
type: QuestionComment
comment on: http://stackoverflow.com/q/22813743
score: 0
type: Comment
has text: i updated my question can any one give me ans according to them please

http://stackoverflow.com/a/44374136
type: Answer
has body: Step 1. Go to Eclipse Market Place Step 2. Search key word by "Data Tools" Step 3. Install "Eclipse DTP"
has comment: http://stackoverflow.com/comment/126319412
answers question: http://stackoverflow.com/q/22822264
score: 0

http://stackoverflow.com/q/22963793
score: 0
has comment: http://stackoverflow.com/comment/35063003
answer count: 1
has title: Coverage with Emma in Android project
has body: I have a android project in which I create a folder for tests. My test pass with success xith JUnit but when I want see the coverage with Emma I found a error. I have install Emma pluging with help> Install New Software and the green icon is appear. I structure my project like this : MyApp src com.example.orga LoginActivity.java res tests com.example.orga.test R.java BuildConfif.java AndroidTestTest.src.com.example.orga.test LoginActivityTest.java See my LoginActivityTest.java public class LoginActivityTest extends ActivityInstrumentationTestCase2&lt;LoginActivity&gt; { private LoginActivity mActivity; private EditText ed_username; public LoginActivityTest() { super(LoginActivity.class); // TODO Auto-generated constructor stub } @Override protected void setUp() throws Exception { super.setUp(); setActivityInitialTouchMode(false); mActivity = getActivity(); ed_username =(EditText) mActivity.findViewById(com.example.organisateur.R.id.editTextMail); } // end of setUp() method definition public void testFillUsername(){ // set text getActivity().runOnUiThread(new Runnable() { @Override public void run() { ed_username.setText("paul"); } }); getInstrumentation().waitForIdleSync(); assertEquals("Text incorrect", "paul", ed_username.getText().toString()); } } In the AndroidManifest.XML File &lt;instrumentation android:targetPackage="com.example.organisateur" android:name="android.test.InstrumentationTestRunner" /&gt; ... &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;uses-library android:name="android.test.runner" /&gt; The error: java.lang.NoClassDefFoundError: android/test/ActivityInstrumentationTestCase2 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) .... Caused by: java.lang.ClassNotFoundException: android.test.ActivityInstrumentationTestCase2 at…
type: UnansweredQuestion
tagged with: android
tagged with: code-coverage
has comment: http://stackoverflow.com/comment/35093348
tagged with: java
tagged with: emma
has comment: http://stackoverflow.com/comment/35093424
type: Question
has comment: http://stackoverflow.com/comment/35062674
has answer: http://stackoverflow.com/a/22980940

http://stackoverflow.com/comment/34988748
comment on: http://stackoverflow.com/q/22922200
type: Comment
type: QuestionComment
has text: Please can you share client code also.
score: 0

http://stackoverflow.com/q/22832700
possible better answer: http://stackoverflow.com/a/22833680
has title: Java socket server, PHP socket client; communication works, however PHP 'echoes' data only after the socket connection is closed
tagged with: sockets
has comment: http://stackoverflow.com/comment/34826506
tagged with: php
has comment: http://stackoverflow.com/comment/34826920
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34827008
downvote count: 0
score: 1
tagged with: java
has body: I am trying to create a simple socket based server/client communication between a Java-based socket server and PHP-based socket client. I am getting all the responses as expected but not immediately. Here is what I am trying to do. PHP client sends a command to the Java server, it responds back with an answer. This answer should be displayed on PHP page immediately. Then a second command is sent and again, the server sends a response which should be displayed immediately. However in my case, the responses are 'echoed' only after entire socket based communication is terminated. That is after I close the socket connection from PHP client. Following is my Java Socket Server code: public class MultiThreadServer implements Runnable { Socket csocket; MultiThreadServer(final Socket csocket) { this.csocket = csocket; } private static void download(final String url) { try { final URL downloadURL = new URL(url); URLConnection conn = null; try { conn = downloadURL.openConnection(); final InputStream inputStream = conn.getInputStream(); final long filesize = conn.getContentLength(); System.out.println("Size of file : " + (filesize / 1024) + " (kb)"); final FileOutputStream outputStream = new FileOutputStream( System.getProperty("user.dir") + "/test.exe"); final long startTime = System.currentTimeMillis(); final byte[] buffer = new byte[1024]; int bytesRead = -1; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } final long endTime = System.currentTimeMillis(); System.out.println("File downloaded"); System.out.println("Download time in sec. is : " + ((endTime - startTime) / 1000)); outputStream.close(); inputStream.close(); } catch (final IOException e) { e.printStackTrace(); } } catch (final MalformedURLException e) { e.printStackTrace(); } } public static void main(final String args[]) throws Exception { final ServerSocket ssock = new ServerSocket(3333); System.out.println("Listening on " + ssock.toString()); while (true) { final…
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22833937
accepted answer: http://stackoverflow.com/a/22833937
upvote count: 1
tagged with: communication
has comment: http://stackoverflow.com/comment/34827162
has answer: http://stackoverflow.com/a/22833680
has comment: http://stackoverflow.com/comment/34826539
favorite count: 0

http://stackoverflow.com/a/22914179
type: Answer
answers question: http://stackoverflow.com/q/22913668
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22913668
downvote count: 0
score: 4
type: AcceptedAnswer
has body: Your layout on the viewer: GridData gridData = new GridData(); gridData.verticalAlignment = GridData.FILL; gridData.horizontalSpan = 2; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalAlignment = GridData.FILL; viewer.getControl().setLayoutData(gridData); says that you want the viewer to use all the available horizontal space, so the viewer has had to resize the last column to make this happen. Use gridData.grabExcessHorizontalSpace = false; gridData.horizontalAlignment = GridData.BEGINNING; to not grab the extra space. Alternatively to fill the space available leave the GridData alone and use TableLayout and ColumnWeightData, something like: TableLayout tableLayout = new TableLayout(); table.setLayout(tableLayout); ... ... don't call column.setWidth replace with: tableLayout.addColumnData(new ColumnWeightData(nnn)); nnn is a number you choose for each column and is the 'weight' used to calculate the width of the column.
has comment: http://stackoverflow.com/comment/34973479
has comment: http://stackoverflow.com/comment/34973860

http://stackoverflow.com/comment/34888375
type: Comment
comment on: http://stackoverflow.com/a/22863041
score: 0
type: AnswerComment
has text: As far as your image question. 1) It because I use `GridBadLayout`, That layout will center components you add to it (to an extent). 2) In this case, there _is_ no difference. I don't need a reference to it, so I can just instantiate it without a reference.

http://stackoverflow.com/comment/34915271
comment on: http://stackoverflow.com/a/22881513
type: AnswerComment
score: 0
type: Comment
has text: You can call `comboBox.getParent()` to get its parent and that is `onderdelenGebruikt` in your case.

http://stackoverflow.com/comment/34950248
has text: @David Wallace, his method for raising a "matrix" to a power is actually just raising an int to a power. And that is what I have provided an answer for.
type: AnswerComment
comment on: http://stackoverflow.com/a/22900957
type: Comment
score: 1

http://stackoverflow.com/comment/34979837
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22874436
type: AnswerComment
has text: Is fooConfig imported before BarConfig?

http://stackoverflow.com/comment/35060645
comment on: http://stackoverflow.com/q/22962484
score: 0
type: Comment
has text: On my side compiles fine too, please add more details about compiler and compiler settings
type: QuestionComment

http://stackoverflow.com/q/22827025
score: 1
tagged with: java
upvote count: 1
has body: So I'm following the book Open GL ES 2 for Android by Kevin Brothaler and I'm trying out the first chapter's project, which is basically coloring the screen red. I set up by Samsung Galaxy Note 3 so I can debug my app on there, and also set up an emulator that uses the host GPU for rendering. Also, I forced GPU rendering on my phone. I copied the code he had exactly into my eclipse project. Here's the code for reference: package com.firstopenglproject.android; import android.app.Activity; import android.app.ActivityManager; import android.content.Context; import android.content.pm.ConfigurationInfo; import android.opengl.GLSurfaceView; //import android.os.Build; import android.os.Bundle; import android.util.Log; import android.widget.Toast; public class FirstOpenGLProjectActivity extends Activity { private static final String TAG = FirstOpenGLProjectActivity.class.getSimpleName(); private GLSurfaceView glSurfaceView; private boolean rendererSet = false; @Override protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "Before calling super.onCreate()"); super.onCreate(savedInstanceState); Log.d(TAG, "Before creating a new GLSurfaceView"); glSurfaceView = new GLSurfaceView(this); Log.d(TAG, "Creating activity manager"); final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); Log.d(TAG, "Creating configuration info"); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); Log.d(TAG, "Getting supportsEs2 boolean"); final boolean supportsEs2 = configurationInfo.reqGlEsVersion &gt;= 0x20000; // || (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 // &amp;&amp; (Build.FINGERPRINT.startsWith("generic") // || Build.FINGERPRINT.startsWith("unknown") // || Build.MODEL.contains("google_sdk") // || Build.MODEL.contains("Emulator") // || Build.MODEL.contains("Android SDK built for x86"))); Log.d(TAG, "supportsEs2 = " + supportsEs2); if (supportsEs2) { // Request an Open…
type: Question
has comment: http://stackoverflow.com/comment/34853764
downvote count: 0
has comment: http://stackoverflow.com/comment/34856084
has answer: http://stackoverflow.com/a/22851495
answer count: 1
has comment: http://stackoverflow.com/comment/34860590
tagged with: opengl-es
has comment: http://stackoverflow.com/comment/34860579
favorite count: 0
has title: Simple OpenGL ES 2.0 app on Android displaying blank screen: why?
tagged with: android
accepted answer: http://stackoverflow.com/a/22851495
type: AnsweredQuestion

http://stackoverflow.com/q/22889520
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34929670
has body: My JMS consumer produces any number(Say n) of messages on JMS queue during the day. First I am evaluating the synchronous processing of message Say at 23.0 clock, now I want to consume all messages. Here is main method Here's how to do it sequentially(not concurrently) :- Do I need to call consumer.receive() method n times (till returns consumer.receive() return null )on single consumer? ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost"); // Create a Connection Connection connection = connectionFactory.createConnection(); connection.start(); // Create a Session Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // Create the destination (Topic or Queue) Destination destination = session.createQueue("TEST.FOO"); // Create a MessageConsumer from the Session to the Topic or Queue MessageConsumer consumer = session.createConsumer(destination); // Wait for a message Message message = consumer.receive(); How to do it concurrently :- I want to process the 20 messages concurrently Do I need to create 20 thread where each thread creates its own consumer and the receive the message?
has answer: http://stackoverflow.com/a/22889786
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/22890086
has comment: http://stackoverflow.com/comment/34929636
tagged with: jms
favorite count: 0
accepted answer: http://stackoverflow.com/a/22889786
type: AnsweredQuestion
tagged with: activemq-classic
score: 1
has title: Process the jms messages sequentially/concurrently?
tagged with: java

http://stackoverflow.com/comment/34952900
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22902502
type: AnswerComment
has text: Thanks Bohemian, real helpful.

http://stackoverflow.com/a/22884656
score: 1
answers question: http://stackoverflow.com/q/22883794
upvote count: 1
type: Answer
has body: Remember that you need to call Timer's start() method after instantiation. Also, you're adding a new JPanel every time your Timer fires. You may want to rewrite your code so that you simply paint new Particles instead.
downvote count: 0

http://stackoverflow.com/comment/73655345
comment on: http://stackoverflow.com/a/23110999
has text: I like this solution (as it doesn't require bulky OpenNLP while giving the almost identical results for the purpose of splitting to sentences) but it needs some clarification. Actually, you don't need ICU4J library but do need a couple okapi libs located in http://okapiframework.org in order your imports work (okapi-lib-0.32.jar, slf4j-api-1.7.13.jar, slf4j-jdk14-1.7.13.jar, that's all). And one can get srx files there, too (download okapi-lib_all-platforms_0.32.zip, they are in 'config' folder).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34959641
comment on: http://stackoverflow.com/q/22906443
score: 0
type: Comment
type: QuestionComment
has text: You mean to say you did this programatically with SVN?

http://stackoverflow.com/comment/34946068
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22893152
has text: This is something that could be achieved with a macro (code-generating code). Java doesn't support macros. Seeing both your username and your question, I am wondering whether you are coming from a functional programming background?

http://stackoverflow.com/comment/35012553
type: Comment
type: QuestionComment
has text: `public void paintComponent(Graphics g) { //achtergrond afbeelding zetten achtergrond = Toolkit.getDefaultToolkit().getImage("hout.jpg");..` 1) The 1st line should be `super.paintComponent(g);` 2) `achtergrond afbeelding zetten` Comments that aren't in English are noise on SO. 3) Don't load the image in the `paintXxx(..)` methods! Instead load it at start-up and store it as a class attribute.
comment on: http://stackoverflow.com/q/22933507
score: 0

http://stackoverflow.com/q/22809331
downvote count: 0
has answer: http://stackoverflow.com/a/22813141
tagged with: tcl
has comment: http://stackoverflow.com/comment/34786737
answer count: 1
favorite count: 0
has body: I am having problems importing the TCL-DLTK project into my IDE (Eclipse). I did clone the git repo, but I get warnings and errors on imported projects : On org.eclipse.dltk.tcl.activeStateDebugger Project, I get the warning Discouraged access: The type CheckedListDialogField is not accessible due to restriction on required library ...\plugins\org.eclipse.dltk.ui_4.0.0.201206120848.jar " on some import instructions. I also get this error The constructor TclSpawnpointPreferenceBlock(new IShellProvider(){}, TclActiveStateDebuggerBlock) is undefined" in TclActiveStateDebuggerBlock Class. An other example is in the org.eclipse.dltk.tcl.core project where I get this error The import org.eclipse.dltk.compiler.SourceElementRequestorMode cannot be resolved" on the org.eclipse.dltk.tcl.internal.structure/TclSourceElementParser2 Class. To sum up, almost every project contains errors. I am working with Eclipse Juno with DLTK and EMF plugin Installed. I appreciate any help you could provide.
has comment: http://stackoverflow.com/comment/34787196
has comment: http://stackoverflow.com/comment/34790691
accepted answer: http://stackoverflow.com/a/22813141
upvote count: 1
tagged with: dltk
has comment: http://stackoverflow.com/comment/34790958
tagged with: emf
type: AnsweredQuestion
score: 1
has title: DLTK TCL Project importing problems
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/34784383
has comment: http://stackoverflow.com/comment/34786392

http://stackoverflow.com/comment/34814321
type: QuestionComment
comment on: http://stackoverflow.com/q/22815199
has text: to Mysterion: command is "package com.kevin.corejava;"
score: 0
type: Comment

http://stackoverflow.com/q/22931657
has answer: http://stackoverflow.com/a/22931683
has answer: http://stackoverflow.com/a/22931826
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22931694
tagged with: java
has body: I doing some multitasking logic. i want to know that when a new thread is create by java ? I thinks its just by invoking thread.start() or something else ? Actual place of generation new thread into memory by JVM(Java) or DVM(Android) Java's creators have graciously designed two ways of creating threads: implementing an interface and extending a class. Extending a class is the way Java inherits methods and variables from a parent class. In this case, one can only extend or inherit from a single parent class. This limitation within Java can be overcome by implementing interfaces, which is the most common way to create threads. (Note that the act of inheriting merely allows the class to be run as a thread. It is up to the class to start() execution, etc.) That's mean whenever thread.start() will invoke a new thread is generated in memory .
type: Question
has answer: http://stackoverflow.com/a/22931712
score: 0
accepted answer: http://stackoverflow.com/a/22931712
tagged with: android
has title: Java when a new thread start?
answer count: 4
possible better answer: http://stackoverflow.com/a/22931683
tagged with: multithreading

http://stackoverflow.com/q/22859532
has answer: http://stackoverflow.com/a/22859847
type: Question
downvote count: 0
tagged with: spring-aop
answer count: 1
accepted answer: http://stackoverflow.com/a/22859847
favorite count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has body: HI I am using the following annotation based config ,to wire up my aspect which looks on the spring controllers for logging and other cross cutting method calls.But it seems the code I am using is not getting invoked . @Configuration @EnableWebMvc @EnableAspectJAutoProxy @ComponentScan({"com.pumpkinsafari.api"}) public class WebConfig extends WebMvcConfigurerAdapter { /** The Constant DD_MM_YYYY. */ private static final String DD_MM_YYYY = "yyyy-MM-dd"; /** The Constant DATE_FORMAT. */ private static final DateFormat DATE_FORMAT = new SimpleDateFormat(DD_MM_YYYY); /** * Instantiates a new web config. */ public WebConfig() { super(); } @Bean public RestControllerAspect controllerAspect(){ return new RestControllerAspect(); } // beans /** * Xstream marshaller. * * @return the x stream marshaller */ public XStreamMarshaller xstreamMarshaller() { final XStreamMarshaller xStreamMarshaller = new XStreamMarshaller(); xStreamMarshaller.setAutodetectAnnotations(true); xStreamMarshaller.setAnnotatedClasses(new Class[] { Principal.class, Customer.class, Role.class, Privilege.class, SocialUser.class, SearchRequest.class }); xStreamMarshaller.getXStream().addDefaultImplementation(java.sql.Timestamp.class, java.util.Date.class); return xStreamMarshaller; } /** * Marshalling http message converter. * * @return the marshalling http message converter */ public MarshallingHttpMessageConverter marshallingHttpMessageConverter() { final MarshallingHttpMessageConverter marshallingHttpMessageConverter = new MarshallingHttpMessageConverter(); final XStreamMarshaller xstreamMarshaller = xstreamMarshaller(); marshallingHttpMessageConverter.setMarshaller(xstreamMarshaller); marshallingHttpMessageConverter.setUnmarshaller(xstreamMarshaller); return marshallingHttpMessageConverter; } // template /* * (non-Javadoc) * * @see * org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter * #configureMessageConverters(java.util.List) */ @Override public void configureMessageConverters(…
score: 1
tagged with: java
upvote count: 1
has title: Spring AOP with SPring MVC controllers not working

http://stackoverflow.com/q/22916319
downvote count: 0
tagged with: lucene
favorite count: 0
has body: I have to delete a stopWord from a string. I wrote a program, but it throws an exception. The error: AWT-EventQueue-0" java.lang.IllegalStateException: TokenStream contract violation: reset()/close() call missing, reset() called multiple times, or subclass does not call super.reset(). Please see Javadocs of TokenStream class for more information about the correct consuming workflow. I don't understand what is wrong. The code is: public String StopWordString(String incoming) throws IOException{ tokenizer = new StandardTokenizer(Version.LUCENE_47,new StringReader(incoming)); standardFilter = new StandardFilter(Version.LUCENE_47, tokenizer); stopFilter = new StopFilter(Version.LUCENE_47, standardFilter, StopAnalyzer.ENGLISH_STOP_WORDS_SET); charTermAttribute = tokenizer.addAttribute(CharTermAttribute.class); stopFilter.reset(); while(stopFilter.incrementToken()) { &lt;--the error is in this line by the neatbeans final String token = charTermAttribute.toString().toString(); list.add(token); } stopFilter.end(); stopFilter.close(); for(i=0; i&lt;list.size(); i++){ str += list.get(i)+" "; } return str; }
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34980922
score: 1
has title: Remove stopWords with luxene 4.7
tagged with: java

http://stackoverflow.com/a/22898762
type: Answer
has body: You can use a dynamic vector for this import java.io.File; import java.io.IOException; import java.util.*; class St{ public static void main(String args[]){ File inFile=new File("H:\\Documents\\JavaEclipseWorkPlace\\ReadTextFile\\src\\txt.txt"); Scanner in=null; Vector&lt;Integer&gt; arr=new Vector&lt;Integer&gt;(5,2); //5 is initial size of vector, 2 is increment in size if new elements are to be added try { in=new Scanner(inFile); while(in.hasNextInt()){ arr.addElement(in.nextInt()); } arr.trimToSize(); // This will make the vector of exact size System.out.println(arr.toString()); } catch(IOException e){ e.printStackTrace(); } finally{ in.close(); } } }
answers question: http://stackoverflow.com/q/22898437
score: 0

http://stackoverflow.com/comment/34835572
has text: Your methods as they are posted in the text are absolutely fine because they have **different** parameter types. `int` is **not** the same as `byte`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22838019

http://stackoverflow.com/comment/34888495
type: AnswerComment
type: Comment
has text: @GermannArlington ha im writing straight from my head
comment on: http://stackoverflow.com/a/22867170
score: 0

http://stackoverflow.com/q/22903218
tagged with: b-tree
has comment: http://stackoverflow.com/comment/35013875
has comment: http://stackoverflow.com/comment/34996781
has body: My project is trying to write a B-Tree. I am having trouble persisting nodes of the tree to a random access file. I am constantly encountering EOFexceptions and StreamCorruptionExceptions. some resources that I am currently using are: Converting any object to a byte array in java https://inaved-momin.blogspot.com/2012/08/understanding-javaiostreamcorruptedexce.html current Problem: reading a link position from a node and then trying to read it from the random access file is causing a StreamCorruptionExceptions. Goal: to be able to access all node in the random access file,modify and write them back to the random access file. Test.java import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.RandomAccessFile; import java.util.ArrayList; public class Test { public static void main(String[] args) throws IOException, ClassNotFoundException { //JsoupTestStringManipulating(); //testAdd(); //testFindPredecessor(); //testDelete(); //testPrefexFind(); //testSave(); testSave2(); } public static void JsoupTestStringManipulating(){ JsoupParser pars = new JsoupParser(); String word = "Spike Spegal"; String URL = "http://en.wikipedia.org/wiki/Zombie"; for(String s: pars.urlTrimming(URL)){ System.out.println("words: "+s); } System.out.println(pars.getPadding(word.length())); } public static void testAdd() throws IOException, ClassNotFoundException{ BTree tree = new BTree(); String padding,fixedString; ArrayList&lt;String&gt; testWords = new ArrayList&lt;String&gt;(); testWords.add("apple"); testWords.add("sand"); testWords.add("math"); testWords.add("tree"); testWords.add("north"); testWords.add("onion"); testWords.add("pan"); testWords.add("pink"); testWords.add("pool"); testWords.add("net"); testWords.add("never"); for(String k : testWords){ padding = getPadding(k.length()); fixedString = k + padding; tree.insert(fixedString); } Node temp1,temp2,temp3…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22974926
possible better answer: http://stackoverflow.com/a/22906591
score: 1
has comment: http://stackoverflow.com/comment/34953994
tagged with: java
linked to: http://stackoverflow.com/q/5837698
tagged with: bytearrayinputstream
has answer: http://stackoverflow.com/a/22906591
upvote count: 1
has title: Persisting B-Tree nodes to RandomAccessFile
tagged with: objectinputstream
type: Question
has comment: http://stackoverflow.com/comment/34997051
has comment: http://stackoverflow.com/comment/35082182
accepted answer: http://stackoverflow.com/a/22974926
answer count: 2
has comment: http://stackoverflow.com/comment/34954213
downvote count: 0
tagged with: randomaccessfile
favorite count: 0

http://stackoverflow.com/comment/34789404
type: Comment
type: QuestionComment
score: 2
has text: JPEG and PNG images *are* compressed.
comment on: http://stackoverflow.com/q/22812325

http://stackoverflow.com/q/22843880
answer count: 2
possible better answer: http://stackoverflow.com/a/22843933
has comment: http://stackoverflow.com/comment/34846288
has body: I have researched a lot for the answer to the current issue I have however, I'm not sure what is going wrong: import java.util.Map; import java.util.HashMap; public class Items { public static void main (String args[]) { HashMap&lt;String, Double&gt; Hallway = new HashMap&lt;String, Double&gt;(); HashMap&lt;String, Double&gt; Toilet = new HashMap&lt;String, Double&gt;(); HashMap&lt;String, Double&gt; ChemistryLab = new HashMap&lt;String, Double&gt;(); HashMap&lt;String, Double&gt; Outdoors = new HashMap&lt;String, Double&gt;(); HashMap&lt;String, Double&gt; Library = new HashMap&lt;String, Double&gt;(); HashMap&lt;String, Double&gt; Engineering = new HashMap&lt;String, Double&gt;(); HashMap&lt;String, Double&gt; Cafeteria = new HashMap&lt;String, Double&gt;(); HashMap&lt;String, Double&gt; ComputerLab = new HashMap&lt;String, Double&gt;(); HashMap&lt;String, Double&gt; LectureTheater = new HashMap&lt;String, Double&gt;(); HashMap&lt;String, Double&gt; MedicalCentre = new HashMap&lt;String, Double&gt;(); } public HashMap&lt;String, Double&gt; getHallwayItems() { return Hallway; } public HashMap&lt;String, Double&gt; getToiletItems() { return Toilet; } public HashMap&lt;String, Double&gt; getChemistryLabItems() { return ChemistryLab; } public HashMap&lt;String, Double&gt; getOutdoorItems() { return Outdoors; } public HashMap&lt;String, Double&gt; getLibraryItems() { return Library; } public HashMap&lt;String, Double&gt; getEngineeringItems() { return Engineering; } public HashMap&lt;String, Double&gt; getCafeteriaItems() { return Cafeteria; } public HashMap&lt;String, Double&gt; getComputerLabItems() { return ComputerLab; } public HashMap&lt;String, Double&gt; getLectureTheaterItems() { return LectureTheater; } public HashMap&lt;String, Double&gt; getMedicalCentreItems() { return MedicalCentre; } } It says that it cannot find the variable Hallway when I attempt compiling however, I don't see how this can be resolved. Thank you for any assistance provided.
accepted answer: http://stackoverflow.com/a/22844124
has title: Java - Issue with making HashMap available from Other Classes
has answer: http://stackoverflow.com/a/22843933
has answer: http://stackoverflow.com/a/22844124
type: AnsweredQuestion
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34846411
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/34862006
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22837064
has text: It would be most useful to look at some sample code where we can try this out. Could you please extract a simple working java class to demonstrate the issue?

http://stackoverflow.com/comment/35031181
has text: @jhadesdev After reading the following blog article http://www.andersen-gott.com/2011/11/spring-batch-and-hibernate.html , I changed the job to use only HibernateItemWriter without a reader.
type: QuestionComment
comment on: http://stackoverflow.com/q/22913477
score: 0
type: Comment

http://stackoverflow.com/comment/34947312
type: Comment
has text: It looks like there is a bug, and an exception is thrown, but the session is created time after the headers are sent, so the session cannot be created and another exception is thrown. One option is create a phase listener and before render response phase call force session creation, to see the other underlying exception.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22898944

http://stackoverflow.com/comment/34966942
comment on: http://stackoverflow.com/q/22909734
has text: The `build` one. I edited my post.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22840170
has answer: http://stackoverflow.com/a/22840483
has title: Using streams, how can I map the values in a HashMap?
downvote count: 0
has body: Given a Map&lt;String, Person&gt; where Person has a String getName() (etc) method on it, how can I turn the Map&lt;String, Person&gt; into a Map&lt;String, String&gt; where the String is obtained from calling Person::getName()? Pre-Java 8 I'd use Map&lt;String, String&gt; byNameMap = new HashMap&lt;&gt;(); for (Map.Entry&lt;String, Person&gt; person : people.entrySet()) { byNameMap.put(person.getKey(), person.getValue().getName()); } but I'd like to do it using streams and lambdas. I can't see how to do this in a functional style: Map/HashMap don't implement Stream. people.entrySet() returns a Set&lt;Entry&lt;String, Person&gt;&gt; which I can stream over, but how can I add a new Entry&lt;String, String&gt; to the destination map?
favorite count: 0
possible better answer: http://stackoverflow.com/a/22840397
has answer: http://stackoverflow.com/a/22840397
has answer: http://stackoverflow.com/a/50740570
tagged with: java-8
answer count: 4
accepted answer: http://stackoverflow.com/a/22840483
type: AnsweredQuestion
tagged with: java-stream
score: 49
tagged with: java
upvote count: 49
has answer: http://stackoverflow.com/a/73582358
type: Question

http://stackoverflow.com/comment/34851065
type: QuestionComment
has text: are you stuffing base64-encoded data into the url?
score: 0
comment on: http://stackoverflow.com/q/22846406
type: Comment

http://stackoverflow.com/comment/53930998
type: Comment
comment on: http://stackoverflow.com/a/33051101
has text: @amdixon: You need to be more thoughtful in applying the link-only answer deletion rule. It doesn't make sense to "include the essential parts" of a download link.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22877569
has comment: http://stackoverflow.com/comment/34908426
accepted answer of: http://stackoverflow.com/q/22877318
answers question: http://stackoverflow.com/q/22877318
has body: Let's look at a section from your example: obj.id = new Integer(4);. Here you're not changing the internal representation of id - you're assigning new instance to the id reference. Both Integer and String are immutable so it's hard to feel the difference of shallow vs deep copy with them. Try to add e.g. an ArrayList attribute and in order to modify it you can e.g. add a new element obj.myList.add(13);
type: Answer
has comment: http://stackoverflow.com/comment/34907792
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/34996591
type: AnswerComment
comment on: http://stackoverflow.com/a/22926486
has text: @JerryCampbell That's the thing. You aren't passing a `Froggo` object to the `Frogs.moveTheFrog()` method. In this case, you're passing a lambda proxy that has some implementation.
type: Comment
score: 0

http://stackoverflow.com/a/30534621
type: Answer
score: 2
has body: In response to Nathan's comment about lack of support for this feature, I can confirm that it is working well in version 3.3.2. When he commented liquibase was at version 3.1.1. Maybe support was improved somewhere between 3.1.1 and 3.3.2, but from a quick browse through the change log I don't see which version this would have been.
answers question: http://stackoverflow.com/q/22941373
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/24791519
has body: You need to deal with binary data, I was just doing this today and answered another post: Couchdb Upload Image via Httpclient
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22936821
score: 1
downvote count: 0

http://stackoverflow.com/q/22823177
has title: Getting log4j warning but not called anywhere
type: Question
possible better answer: http://stackoverflow.com/a/22839423
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22823360
accepted answer: http://stackoverflow.com/a/22823360
has body: I am getting the following warnings in my console when I run my testng suites: log4j:WARN No appenders could be found for logger (org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager) log4j:WARN Please initialize the log4j system properly. We were using log4j previously but have since moved to a new logger. The project has had all references to log4j removed, but we are still getting these errors. We are using Selenium Web Driver, and it seems like we are getting these warnings on this line here: driver = new FirefoxDriver(); The only thing I can think of is that FirefoxDriver is asking for a log4j object or something and it is not receiving it, but the source code doesn't call for a log4j. Does anyone have any idea why we are getting these warnings? I am not too familiar with log4j and have just recently been brought on to the team. I have read things about log4j properties files, but we don't have any of those so I don't think it has anything to do with those.
has answer: http://stackoverflow.com/a/22839423
tagged with: logging
tagged with: testng
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/34899727
comment on: http://stackoverflow.com/q/22872627
has text: Move `curr` to inside the while loop.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22888085
type: Answer
has body: 1 - Constructors are used to instantiate classes, and here you are doing it wrong. It should be new AnotherNewClass("Hello World!!"); Take a look at this question for a good explanation. 2 - In Java, there we say methods and not functions.
score: 0
answers question: http://stackoverflow.com/q/22888042

http://stackoverflow.com/q/22908582
has body: I working on a Google Chart. The API uses the DecimalFormat (ICU4J 53.1). I am aiming this format: ### ### meters But I can't find it inside the documentation. Is there a work around for it?
has title: How can I use white space as a grouping separator in DecimalFormat?
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34963259
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34963334
has comment: http://stackoverflow.com/comment/34978194
tagged with: decimalformat
has answer: http://stackoverflow.com/a/22908701
tagged with: java
upvote count: 1
answer count: 1
tagged with: google-visualization
type: UnansweredQuestion

http://stackoverflow.com/a/55165057
has comment: http://stackoverflow.com/comment/109778458
score: 26
has comment: http://stackoverflow.com/comment/139523184
answers question: http://stackoverflow.com/q/22853321
upvote count: 26
type: Answer
downvote count: 0
has body: I've solved the problem by creating an interceptor which stores a cookie and puts it in next requests. public class StatefulRestTemplateInterceptor implements ClientHttpRequestInterceptor { private String cookie; @Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { if (cookie != null) { request.getHeaders().add(HttpHeaders.COOKIE, cookie); } ClientHttpResponse response = execution.execute(request, body); if (cookie == null) { cookie = response.getHeaders().getFirst(HttpHeaders.SET_COOKIE); } return response; } } Set the interceptor for your RestTemplate: @Bean public RestTemplate restTemplate(RestTemplateBuilder templateBuilder) { return templateBuilder .requestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())) .interceptors(new StatefulRestTemplateInterceptor()) .build(); }

http://stackoverflow.com/q/22878501
has comment: http://stackoverflow.com/comment/34909532
has answer: http://stackoverflow.com/a/22878774
has body: Please have a look at the following code //Devide the has into set of 3 pieces private void devideHash(String str) { int lastIndex = 0; for(int i=0;i&lt;=str.length();i=i+3) { lastIndex = i; try { String stringPiece = str.substring(i, i+3); // pw.println(stringPiece); hashSet.add(stringPiece); } catch(Exception arr) { String stringPiece = str.substring(lastIndex, str.length()); // pw.println(stringPiece); hashSet.add(stringPiece); } } } The above method receives String like abcdefgjijklmnop as the parameter. Inside the method, its job is to divide this sets of 3 letters. So when the operation is completed, the hashset will have pieces like abc def ghi jkl mno p But the problem is that if the input String is big, then this loop takes noticeable amount of time to complete. Is there any way I can use to speed this process?
has comment: http://stackoverflow.com/comment/34909434
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/22878756
has comment: http://stackoverflow.com/comment/34909367
type: Question
tagged with: performance
score: 1
linked to: http://stackoverflow.com/q/16123446
tagged with: java
has comment: http://stackoverflow.com/comment/34909454
has comment: http://stackoverflow.com/comment/34911088
has comment: http://stackoverflow.com/comment/34909500
has comment: http://stackoverflow.com/comment/34909453
tagged with: substring
has comment: http://stackoverflow.com/comment/34909461
has comment: http://stackoverflow.com/comment/34910076
has comment: http://stackoverflow.com/comment/34910083
answer count: 2
tagged with: for-loop
has comment: http://stackoverflow.com/comment/34910302
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/34909578
favorite count: 0
has title: For Loop is performing slow

http://stackoverflow.com/comment/34999295
type: AnswerComment
has text: @Ɍ.Ɉ, He removed the accept after I edited, so I guess he didn't want it :P
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22927931

http://stackoverflow.com/q/22809855
has comment: http://stackoverflow.com/comment/34785733
has answer: http://stackoverflow.com/a/22810063
tagged with: object
tagged with: java
has title: generating objects randomly
linked to: http://stackoverflow.com/q/1972392
has answer: http://stackoverflow.com/a/22810093
type: Question
has comment: http://stackoverflow.com/comment/34785783
tagged with: random
has body: I have to prepare some work until tomorrow, but I'm stuck. (Also all the names in the code are German, don't be confused :) ) This is my constructor class for an object called "Karte" (card) private Farbe f; private Wert w; public enum Farbe { PIK, KREUZ, KARO, HERZ } public enum Wert { SIEBEN, ACHT, NEUN, ZEHN, BUBE, DAME, KOENIG, ASS } Karte(Farbe f, Wert w) { this.f = f; this.w = w; } public Farbe getFarbe() { return f; } public Wert getWert() { return w; } public String toString() { return f + " " + w; } And now there's another class that should generate an object, made out of multiple cards. The normal syntax would be Karte name = new Karte(); // (random stuff here); But how can I get the class to generate multiple objects with random names? If I tried to just use this kind of code in a for each loop it would just overwrite the previous one. How do I give them random names or even chosen from a String[]?
score: 0
has answer: http://stackoverflow.com/a/22809975
has answer: http://stackoverflow.com/a/22810151
answer count: 4
type: UnansweredQuestion

http://stackoverflow.com/a/22910704
score: 8
answers question: http://stackoverflow.com/q/22910661
has comment: http://stackoverflow.com/comment/34967293
has body: Use .setScale(): return num.setScale(2); Note that it will NOT truncate numbers; if a number has more than 2 decimals, it will throw an ArithmeticException. (except if all decimals after the second one are 0)
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34967111
downvote count: 0
has comment: http://stackoverflow.com/comment/34967071
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/22910661
has comment: http://stackoverflow.com/comment/34967321

http://stackoverflow.com/comment/34931639
score: 0
type: Comment
type: QuestionComment
has text: The constructor was given to us by the instructor. It cannot be modified...
comment on: http://stackoverflow.com/q/22890400

http://stackoverflow.com/comment/35043422
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22952885
has text: No, it will not be a `never ending loop`. As soon as the user enters `y`, the `flag` will be assigned a value `false` and during the consequent iteration, the `while(flag)` will be `false` and would not be executed.
score: 0

http://stackoverflow.com/comment/34912931
comment on: http://stackoverflow.com/q/22880458
score: 0
has text: I guess it would depend exactly on what you intend to do with `clashesMatrix`, but ArrayLists kind of feel like arrays, which is what you need. Another alternative would be to have a class that wraps `ArrayList<Student>` and use a 2D array of that class. Both feel a little like a workaround to the fact that there's no such thing as `ArrayList<Student>[][]`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34798931
has text: @superEB I change a few things. Now it seems to work. Will you have a look? Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22816523
type: Comment

http://stackoverflow.com/comment/61391575
has text: don't forget to add the soapui repository soapui http://www.soapui.org/repository/maven2
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/33745291
type: Comment

http://stackoverflow.com/comment/35000673
comment on: http://stackoverflow.com/q/22928450
type: Comment
type: QuestionComment
has text: @user3509528 his answer is right just inflate the layout and then use the view object to initialize button `view.findViewById`. This `getActivity().findViewById(R.id.button1)` is wrong
score: 0

http://stackoverflow.com/q/22881645
has comment: http://stackoverflow.com/comment/34915297
linked to: http://stackoverflow.com/q/5801229
has answer: http://stackoverflow.com/a/22881691
has answer: http://stackoverflow.com/a/22881646
has comment: http://stackoverflow.com/comment/34915023
tagged with: inheritance
tagged with: fact
favorite count: 0
has answer: http://stackoverflow.com/a/22883971
has title: “every class in java extends the MetaClass Object” does it imply that every subclass causes a Diamond issue
upvote count: 2
type: UnansweredQuestion
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/39882019
tagged with: java
type: Question
answer count: 3
has body: These two facts in java Fact 1 “Every class in java by default extends the java meta class Object” and Fact 2 “Multiple inheritance is not allowed in java” read more about diamond proble here Java inheritance are quiet confusing Suppose ClassB extends ClassA then according to fact1 ClassB extends Object Does that mean ClassB is extending both ClassA and Object? Is it a case of multiple inheritance? If it’s not multiple inheritance then how aren't the two statements contradictory?

http://stackoverflow.com/comment/34794961
has text: I did not use @ResultPath and the error is listed in my previous comment. I didn't give it any other welcome file location such as where my jsps are i simply removed it to see what would happen.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22814580

http://stackoverflow.com/q/22826605
has title: Saving data in Java
tagged with: java
type: Question
tagged with: nested-class
has body: When you save objects in Java using java.io.Serializable, if the object you're saving has objects of different classes within it, do those nested classes also have to implement serializable?
tagged with: serializable
score: 0
has comment: http://stackoverflow.com/comment/34815597
answer count: 1
has answer: http://stackoverflow.com/a/22826681
accepted answer: http://stackoverflow.com/a/22826681
has comment: http://stackoverflow.com/comment/34815695
type: AnsweredQuestion

http://stackoverflow.com/comment/34904746
comment on: http://stackoverflow.com/q/22875743
has text: Moreso, why not just use a stack?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22857478
has title: How do I compile and run Intelij IDEA java project without IDE?
linked to: http://stackoverflow.com/q/22810359
has answer: http://stackoverflow.com/a/22863746
has answer: http://stackoverflow.com/a/22857661
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: Recently I was trying to run 2048 bot. I'm not a java programmer and installing IDE just for running one program would be overkill. So I tried compiling and running it from command line, but that was not a simple task for me, mainly because of the dependencies. Then I was told, that maven might come in handy. So I wonder if one can easily compile and run a program using maven or whatever tool they have without installing IDE?
tagged with: maven
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/112873134
score: 1
tagged with: java
answer count: 2
tagged with: compilation

http://stackoverflow.com/comment/34903871
score: 0
has text: `at javar.swing.XJPanel.getRoot(XJPanel.java:61` => At line 61 of getRoot() of XJPanel.java in the package javar.swing.XJPanel , you have a error
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22874937

http://stackoverflow.com/comment/34895874
type: AnswerComment
has text: I think this is what I'm looking for... but can you explain a little more?
type: Comment
comment on: http://stackoverflow.com/a/22871130
score: 0

http://stackoverflow.com/comment/63211802
type: Comment
comment on: http://stackoverflow.com/a/23370818
has text: could you please elaborate on that answer ? Do we install 32-bit or 64-bit jdk ?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35026430
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22943135
has text: @C.B. I haven't written anything yet - I want to avoid having to do something which someone else has already solved.
score: 0

http://stackoverflow.com/comment/101554086
score: 0
type: AnswerComment
has text: @FabioMaffioletti Saviour:)
type: Comment
comment on: http://stackoverflow.com/a/22843186

http://stackoverflow.com/a/68720735
has body: If Springboot with Undertow Websocket engine is used, try below way to get IP. @OnOpen public void onOpen(Session session) { UndertowSession us = (UndertowSession) session; String ip = us.getWebSocketChannel().getSourceAddress().getHostString();
type: Answer
answers question: http://stackoverflow.com/q/22880055
score: 0

http://stackoverflow.com/q/22932761
upvote count: 2
type: UnansweredQuestion
tagged with: android
tagged with: android-imageview
has comment: http://stackoverflow.com/comment/35054140
tagged with: java
has comment: http://stackoverflow.com/comment/35007978
has comment: http://stackoverflow.com/comment/35011965
type: Question
has title: Display Image in Original Resolution Android
has comment: http://stackoverflow.com/comment/35007582
has comment: http://stackoverflow.com/comment/35008416
has body: I have an Image of size 129px × 1579px and i want it to be displayed without being scaled! (as it is). I tried displaying using ImageView placing the image in drawable folder, drawable-nodpi folder but it is always scaled! I even tried displaying it using a WebView yet the rendered HTML page is scaled depending upon different screen sizes! None seems to work. <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ruler" /> Question : "is these a way i can display the image that i have 'as it is'? Update : The image is a Ruler so it has to be rendered correctly (as it is) Thanks
score: 2
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22933137
favorite count: 0
has comment: http://stackoverflow.com/comment/35007340
has comment: http://stackoverflow.com/comment/35007114
has comment: http://stackoverflow.com/comment/35013260

http://stackoverflow.com/q/22895771
tagged with: listener
has title: How can I know when an instance variable raise a event in java?
accepted answer: http://stackoverflow.com/a/22895926
type: AnsweredQuestion
has body: i have created a class to create the UserInterface of my program, my program has an instance of that UserInterface. The UserIterface class has some listeners, my problem now is that i need to know from my program main class when my instance variable used to create the user interface raises events as for example tree valueChanged. This is my userInterface class: import java.awt.EventQueue; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JToolBar; import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JTree; import javax.swing.JSplitPane; import javax.swing.JPanel; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeSelectionModel; import org.eclipse.swt.widgets.Tree; import java.awt.Dimension; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.io.FileNotFoundException; import java.io.IOException; public class UserInterfaceWindow implements TreeSelectionListener{ public JFrame frame; public JTree tree; public JPanel panel; public JFileChooser fileChooser; public IffFile iffFile; public CustomRanAccFile inputRandAccFile; /** * Create the application. */ public UserInterfaceWindow() { initialize(); frame.setVisible(true); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 758, 549); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JToolBar toolBar = new JToolBar(); frame.getContentPane().add(toolBar, BorderLayout.NORTH); JButton btnOpenFile = new JButton("Open File"); btnOpenFile.addActionListener(new OpenButtonClick()); toolBar.add(btnOpenFile); JButton button = new JButton("New button"); toolBar.add(button); JSplitPane splitPane = new J…
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22895926
score: 0
answer count: 1
tagged with: events

http://stackoverflow.com/a/22927492
has comment: http://stackoverflow.com/comment/34998233
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34998214
has comment: http://stackoverflow.com/comment/34998574
answers question: http://stackoverflow.com/q/22927392
downvote count: 0
has comment: http://stackoverflow.com/comment/34998603
has comment: http://stackoverflow.com/comment/34998317
type: Answer
has body: For the second ArrayOutOfBounds exception that you mentioned, In your lengthen method you have this loop: samples = new double[t.length*2]; for(int i = 0; i &lt; samples.length;i++){ samples[(2*i)] = t[i]; samples[(2*i)+1] = t[i]; } The loop should be: samples = new double[t.length*2]; for(int i = 0; i &lt; samples.length;i++){ samples[i] = t[i/2]; } You've already doubled the length of samples but your loop goes by the length of samples. Doubling it there will make i almost twice the length of samples near the end of your loop. For your other ArrayIndexOutOfBounds exception, in your shorten method you have: else{ for(int i = 0; i &lt;samples.length+1;i++){ // remove +1 samples[i] = t[(2*i)+1]; // remove +1 } } In this case, you've halved the size of your samples array and you're filling it with elements from your t array, taking only every second element. You can remove the +1 because these are causing the code to try to do things that are beyond the length of the array. else{ for(int i = 0; i &lt;samples.length;i++){ samples[i] = t[2*i]; } } Actually, your whole shorten method can be shortened: public void shorten(){ double[]t = new double[samples.length]; for(int i = 0; i &lt; samples.length;i++){ t[i] = samples[i]; } samples = new double[t.length/2]; for(int i = 0; i &lt;samples.length;i++){ samples[i] = t[2*i]; } }

http://stackoverflow.com/q/22893750
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34936890
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34968214
accepted answer: http://stackoverflow.com/a/22894058
tagged with: jxl
favorite count: 0
has comment: http://stackoverflow.com/comment/34937156
has title: how to recompile the 3rd party jars using lower version
has body: I am stuck with an issue because of lower version of java. I am using eclipse, I set the compiler level to 1.5 version and using jars like ojdbc.jar jxl.jar But its throwing the following error. So I am suspecting that the jars were compiled with higher version so may be thats the reason for this error. java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Exception in thread "main" Please someone let me know how to recompile 3rd party jars with lower version. Or any other solution or my issue.
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/34937689
has answer: http://stackoverflow.com/a/22894058
type: Question
tagged with: java

http://stackoverflow.com/comment/34922107
type: Comment
has text: Yeah, that's the reason. Use provided scope for javaee-api and rebuild your war.
comment on: http://stackoverflow.com/a/22885426
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35073813
has text: I'm attempting to answer my own question, which is encouraged. ( http://meta.stackexchange.com/questions/17845/etiquette-for-answering-your-own-question ) Any corrections and improvements are welcome. I searched for this but couldn't find the info summarized in one place, which I think is useful to have.
score: 1
comment on: http://stackoverflow.com/q/22968085
type: QuestionComment
type: Comment

while-loop
tags question: http://stackoverflow.com/q/22823395
tags question: http://stackoverflow.com/q/22911435
type: Tag
tags question: http://stackoverflow.com/q/22887958
tags question: http://stackoverflow.com/q/22951695
tags question: http://stackoverflow.com/q/22914238
tags question: http://stackoverflow.com/q/22917457
tags question: http://stackoverflow.com/q/22831890
tags question: http://stackoverflow.com/q/22874439
tags question: http://stackoverflow.com/q/22826338
tags question: http://stackoverflow.com/q/22945650
tags question: http://stackoverflow.com/q/22952939
tags question: http://stackoverflow.com/q/22923798
tag name: while-loop
tags question: http://stackoverflow.com/q/22952826
tags question: http://stackoverflow.com/q/22824071

http://stackoverflow.com/comment/34958192
score: 0
type: Comment
type: QuestionComment
has text: @vikeng21 I dont knw about that but it is a java file having string type of variables and for that all getters and setters are there.
comment on: http://stackoverflow.com/q/22905422

http://stackoverflow.com/q/22926348
score: 0
has comment: http://stackoverflow.com/comment/35106841
has title: Android NDK: Set Field from C
has comment: http://stackoverflow.com/comment/35053166
answer count: 0
type: UnansweredQuestion
has body: I have a native opensl audio callback. I want to extract the dB of each buffer and set the GLRenderer scalematrix in order to create a simple vumeter in java. I'm trying to get a static setter method id, a static field id, also tried with non-static: jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNIEnv* env; if ((*vm)-&gt;GetEnv(vm, (void**) &amp;env, JNI_VERSION_1_6) != JNI_OK) return -1; globalMyNativeActivityClass = (*env)-&gt;NewGlobalRef(env, (*env)-&gt;FindClass(env,"com/tremolofx/vumeterGLRenderer")); __android_log_print(ANDROID_LOG_ERROR, "JNI_OnLoad", "FindClass-&gt; %p", globalMyNativeActivityClass); setAmp = (*env)-&gt;GetStaticMethodID(env, globalMyNativeActivityClass, "setAmp", "(F)V"); __android_log_print(ANDROID_LOG_ERROR, "JNI_OnLoad", "GetMethodID -&gt; %p", setAmp); // (*env)-&gt;CallStaticVoidMethod(env, obj, setAmp, 20.0); fid = (*env)-&gt;GetStaticFieldID(env,globalMyNativeActivityClass,"amp","F"); __android_log_print(ANDROID_LOG_ERROR, "JNI_OnLoad", "GetStaticFieldID -&gt; %p", fid); return JNI_VERSION_1_6; } So this code is getting not null class, method and field. Now I want to set the field via the setter or changing its value directly, cause my glrenderer is rendering constinously.Something like that: void setVumeter( jfloat dB){ __android_log_print(ANDROID_LOG_INFO, "opensl_stream", "1"); (*env)-&gt;CallVoidStaticMethod(...notclearstuff.. ,setAmp, dB); } and call to this at the end of my native audio callback. I tried all on the internet, but the app crashes always in the call or the set and I'm going crazy. Fatal signal 11 (SIGSEV) at 0xdeadd00d (code=1), thread 7154
tagged with: java
tagged with: set
tagged with: android-ndk
type: Question
tagged with: http://stackoverflow.com/tag/c
tagged with: get

http://stackoverflow.com/comment/87693607
comment on: http://stackoverflow.com/a/23399850
score: 10
type: AnswerComment
type: Comment
has text: Do you know where to find rt.jar or an equivalent with JDK 10? It doesn't seem to come with the JDK anymore

http://stackoverflow.com/q/22905622
has answer: http://stackoverflow.com/a/72812042
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/62891572
tagged with: build
has answer: http://stackoverflow.com/a/24447176
has answer: http://stackoverflow.com/a/66924329
tagged with: java
has body: The project cannot be built until its prerequisite PokerGameEngine is built. Cleaning and building all projects is recommended PokerExtension Unknown Java Problem in eclipse it shows red cross mark on project. i have done build automatically and clean all in eclipse for all projects but it shows red cross
tagged with: eclipse
type: Question
tagged with: debugging
score: 5
upvote count: 6
has answer: http://stackoverflow.com/a/22905767
has comment: http://stackoverflow.com/comment/34958231
has answer: http://stackoverflow.com/a/54288881
has title: The project cannot be built until its prerequisite PokerGameEngine is built. Cleaning and building all projects is recommended
downvote count: 1
answer count: 7
has comment: http://stackoverflow.com/comment/34958300
has comment: http://stackoverflow.com/comment/97711362
favorite count: 0
has answer: http://stackoverflow.com/a/61800110

http://stackoverflow.com/a/22814669
has body: setItems requires a list of the exact type (ObservableList instead of ObservableList), whereas your list is of an implementation of the interface. Define listItems as a ListView.
type: Answer
has comment: http://stackoverflow.com/comment/34837075
score: 0
has comment: http://stackoverflow.com/comment/34795343
answers question: http://stackoverflow.com/q/22814504

http://stackoverflow.com/q/22851851
answer count: 1
linked to: http://stackoverflow.com/q/14596599
favorite count: 0
has answer: http://stackoverflow.com/a/22851917
type: UnansweredQuestion
has title: setuid() equivalent in Java on Windows
tagged with: runas
upvote count: 2
score: 1
tagged with: java
has body: This question is not as simple as telling me to use runas; Please read the question before answering. When I use C on UNIX/Linux and want to write a program to run with elevated privilege, I use this flow: program starts. process lowers privilege using setuid(). process does unprivileged work. process raises privilege using setuid(). process does privileged work such as opening a restricted file. process lowers privilege using setuid(). The critical part of the flow is that the process lowers its privilege immediately after starting and only raises its privilege long enough to do the corresponding work. How can I do a similar thing on Windows using Java? My specific use case is that I want to read and write protected files such that the only way for the user of the program to access the files is thru my Java program. I do not want to run the entire process with Administrator privilege just to protect a couple of files.
downvote count: 1
has comment: http://stackoverflow.com/comment/34861382
type: Question

http://stackoverflow.com/q/22928247
has comment: http://stackoverflow.com/comment/34999527
linked to: http://stackoverflow.com/q/21242110
has body: How to convert java util date into java.time LocalDate type.java.time is int the JDK 1.8 version.
tagged with: java-8
accepted answer: http://stackoverflow.com/a/22928347
type: AnsweredQuestion
has title: Convert java.util.date into java.time.localdate type?
duplicate of: http://stackoverflow.com/q/21242110
has comment: http://stackoverflow.com/comment/34999463
tagged with: java
linked to: http://stackoverflow.com/q/2009795
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/5597671
type: Question
has answer: http://stackoverflow.com/a/22928347
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34999782
favorite count: 0

http://stackoverflow.com/comment/34928797
has text: @Christian you mean in the first case, do you get both abc and adksjfhak?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22889298

http://stackoverflow.com/comment/35042558
type: QuestionComment
comment on: http://stackoverflow.com/q/22951752
has text: Do you have field annotated with @Id? If not you have to annotate a particular field with Id
score: 0
type: Comment

http://stackoverflow.com/comment/34887327
type: Comment
has text: Those Ids are in fragment_main and even I change the contentView to fragment I get new error and I posted the LogCat for that error in the bottom of the question just few seconds ago .
comment on: http://stackoverflow.com/a/22866612
score: 0
type: AnswerComment

http://stackoverflow.com/q/22916770
has body: Does anyone know how to implement or where can I find an implementation of Gilmore-Lawler lower bound for Quadratic Assignment Problem? I've read several mathematics papers and the idea is to convert the QAP into a LAP combining the two matrices of the original problem. But how can I implement it? The only hint that my teacher gave me is "Gilmore-Lawler" and anything else. I need it for a group project and I'm totally lost. Thanks.
type: Question
downvote count: 0
favorite count: 0
tagged with: graph-algorithm
tagged with: c++
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: algorithm
has title: Gilmore-Lawler lower bound
score: 1
tagged with: java

http://stackoverflow.com/q/22910673
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22910841
tagged with: interface
has title: Error: Bound mismatch, Collections.sort, interface, compareTo Method
has body: I want to compare a new class called CalendarDate. I made an interface Comparable, and I make the public class CalendarDate implementing Comparable. I also wrote a compareTo(CalendarDate Other) method in the class. However, when I try Collections.sort(birthday), it says Bound mismatch. (It has details: Bound mismatch: The generic method sort(List) of type Collections is not applicable for the arguments (ArrayList). The inferred type CalendarDate is not a valid substitute for the bounded parameter >) what is wrong with my code? Thanks. P.S. There is a RED line under the word sort in CalendarDateTest.java. Comparable.java package Chapter10; public interface Comparable&lt;T&gt; { public int compareTo(T other); } CalendarDate.java package Chapter10; public class CalendarDate implements Comparable&lt;CalendarDate&gt; { private int month; private int day; public CalendarDate(int month, int day) { this.month = month; this.day = day; } public int compareTo(CalendarDate other) { if (month != other.month) { return month - other.month; } else { return day - other.day; } } public String toString() { return month + "/" + day; } } CalendarDateTest.java package Chapter10; import java.util.*; public class CalendarDateTest { public static void main (String[] args) { ArrayList&lt;CalendarDate&gt; birthday = new ArrayList&lt;CalendarDate&gt;(); birthday.add(new CalendarDate(1, 23)); birthday.add(new CalendarDate(5, 18)); birthday.add(new CalendarDate(12, 17)); birthday.add(new CalendarDate(2, 29)); birthday.add(new CalendarDate(8, 6)); System.out.println("birthdays = " + birthday); Collections.sort(birthday); System.out.println("birthdays = " + birthday); } }
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22911194
has answer: http://stackoverflow.com/a/22910841
has answer: http://stackoverflow.com/a/22911194
tagged with: arraylist

http://stackoverflow.com/a/22888543
type: Answer
has body: Try this one (This is a code segment of a Servlet) protected void doGet(HttpServletRequest request, HttpServletResponse servletResponse) throws ServletException, IOException { BufferedWriter bufferWriter = new BufferedWriter(servletResponse.getWriter()); bufferWriter.write("any string"); } In Servlet you have HttpServletResponse. Use PrintWriter pw = servletResponse.getWriter(); to write on the client (browser) stream.
score: 0
answers question: http://stackoverflow.com/q/22888513

http://stackoverflow.com/comment/35003754
has text: I double checked it. No luck
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22929521

http://stackoverflow.com/a/22960355
has body: In pseudo-code: V value=first value P position=1 L length=0 Scan the values from position Q=2 Compare current value C to V If C is less than V if this sequence Q-P is longer than L save length as L save P as location R update V and P to current value If C is greater than V update V and P to current value I don't have a compiler for pseudo-code so it might not be exactly right, but it should be a start.
answers question: http://stackoverflow.com/q/22837139
score: 0
type: Answer

akka
type: Tag
tag name: akka
tags question: http://stackoverflow.com/q/22918923
tags question: http://stackoverflow.com/q/22890918

http://stackoverflow.com/a/22867545
has body: finally is executed after try block either the execption is generated or not.Here is the link for your reference from Java documentation.
type: Answer
answers question: http://stackoverflow.com/q/22867443
score: 0

http://stackoverflow.com/a/22884149
downvote count: 0
has body: Try it like this: List&lt;Map&lt;Integer,Integer&gt;&gt; DB_entry = new ArrayList&lt;Map&lt;Integer, Integer&gt;&gt;(); for (int i = 0; i &lt; 6; i++) { Map&lt;Integer, Integer&gt; row = new HashMap&lt;Integer, Integer&gt;(); // Populate the map here. DB_entry.add(row); } Hashtable is a JDK 1.0 data structure; HashMap is preferred. What is 6? Magic numbers like this are a very bad idea.
score: 3
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22884116
answers question: http://stackoverflow.com/q/22884116
type: AcceptedAnswer

http://stackoverflow.com/comment/35013928
has text: I've thought about that. But then you need to rotate every rectangle, and this, as i understand, may be cumbersome (you need to rotate graphics or image, right?). Is there a better, sort of, "usual" approach?
comment on: http://stackoverflow.com/q/22936229
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22966062
score: 1
upvote count: 1
has body: Here is a simple example that shows how it breaks - the first queue prints numbers in order as expected but the second doesn't because one of the numbers has been mutated after having been added to the queue. public static void main(String[] args) throws Exception { PriorityQueue&lt;Integer&gt; ok = new PriorityQueue&lt;&gt;(Arrays.asList(1, 2, 3)); Integer i = null; while ((i = ok.poll()) != null) System.out.println(i); //1,2,3 PriorityQueue&lt;AtomicInteger&gt; notOk = new PriorityQueue&lt;&gt;(Comparator.comparing(AtomicInteger::intValue)); AtomicInteger one = new AtomicInteger(1); notOk.add(one); notOk.add(new AtomicInteger(2)); notOk.add(new AtomicInteger(3)); one.set(7); AtomicInteger ai = null; while ((ai = notOk.poll()) != null) System.out.println(ai); //7,2,3 }
answers question: http://stackoverflow.com/q/22965652
downvote count: 0
type: Answer

http://stackoverflow.com/q/22952145
tagged with: android
has body: I would like to create a tabbed view which has item description on top and a tabbed view at the bottom to populate its details. Something like the following image Any suggestions or links to tutorials to achieve this? Thanks, Noorul
answer count: 1
linked to: http://stackoverflow.com/q/23133881
favorite count: 0
accepted answer: http://stackoverflow.com/a/22952209
tagged with: tabs
tagged with: view
type: AnsweredQuestion
has title: Adding tabs within activity in android
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22952209
upvote count: 0
tagged with: layout
score: -1

http://stackoverflow.com/q/22810072
has comment: http://stackoverflow.com/comment/34785593
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/34785520
has title: Reading HTML content into java program
has answer: http://stackoverflow.com/a/22810994
tagged with: java
has answer: http://stackoverflow.com/a/22810713
type: Question
answer count: 2
has body: I am trying to get recharge plan information of service provider into my java program, the website contains dynamic data, and when i am fetching the URL using URLConnection i am only getting the static content,I want to automate the recharge plans of different website into my program. package com.fs.store.test; import java.net.*; import java.io.*; public class MyURLConnection { private static final String baseTataUrl = "https://www.tatadocomo/pre-paypacks";`enter code here` public MyURLConnection() { } public void getMeData() { URLConnection urlConnection = null; BufferedReader in = null; try { URL url = new URL(baseTataUrl); urlConnection = url.openConnection(); HttpURLConnection connection = null; connection = (HttpURLConnection) urlConnection; in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()/*,"UTF-8"*/)); String currentLine = null; StringBuilder line = new StringBuilder(); while((currentLine = in.readLine()) != null) { System.out.println(currentLine); line = line.append(currentLine.trim()); } }catch(IOException e) { e.printStackTrace(); } finally{ try{ in.close(); } catch(Exception e){ e.printStackTrace(); } } } public static void main (String args[]) { MyURLConnection test = new MyURLConnection(); System.out.println("About to call getMeData()"); test.getMeData(); } }
tagged with: url

http://stackoverflow.com/comment/34918284
has text: @jwz: "what is the upper limit of notifications the draw can show" -- that is up to the OS and device/ROM manufacturer. There is no documented limit, and the implemented limits will vary by device model, based upon the OS version and manufacturer changes. "and have my reasons for not wishing to stack them" -- bear in mind that your users will therefore have their reasons for giving you low ratings on the Play Store, if they disagree with your decision. You are not more important than your users. At minimum, give them configuration options to control this unexpected behavior.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22879857
score: 1

stanford-nlp
tags question: http://stackoverflow.com/q/22818956
tags question: http://stackoverflow.com/q/22896923
tags question: http://stackoverflow.com/q/22880577
tags question: http://stackoverflow.com/q/22950995
type: Tag
tags question: http://stackoverflow.com/q/22831474
tag name: stanford-nlp
tags question: http://stackoverflow.com/q/22905712

http://stackoverflow.com/comment/34991864
score: 0
type: AnswerComment
type: Comment
has text: You should not be negating `word.equalsIgnoreCase("quit");`
comment on: http://stackoverflow.com/a/22923851

http://stackoverflow.com/a/22905046
has comment: http://stackoverflow.com/comment/34957615
has comment: http://stackoverflow.com/comment/34957213
type: Answer
has comment: http://stackoverflow.com/comment/34957292
has comment: http://stackoverflow.com/comment/34957569
has comment: http://stackoverflow.com/comment/34958228
has comment: http://stackoverflow.com/comment/34957136
answers question: http://stackoverflow.com/q/22904987
has body: I think the problem is transfer is null, You can put a condition like this before convert: (the first question which you edit and change your topic) if(transfer ==null) transfer="0";
has comment: http://stackoverflow.com/comment/34957170
score: 0
has comment: http://stackoverflow.com/comment/34958112
has comment: http://stackoverflow.com/comment/34958267
has comment: http://stackoverflow.com/comment/34957918
has comment: http://stackoverflow.com/comment/34957449

http://stackoverflow.com/q/22878183
score: 7
tagged with: java
possible better answer: http://stackoverflow.com/a/22878229
has answer: http://stackoverflow.com/a/22879021
has answer: http://stackoverflow.com/a/22878213
type: Question
upvote count: 7
has answer: http://stackoverflow.com/a/22879002
tagged with: jvm
has body: I am educating myself in the theory of programming languages and I wonder, why exactly do we need a Java Virtual Machine or any virtual machine at all for that matter? What are the fundamental reasons? Is it solely for making it multi-platform? If so, why cannot we just have a platform independent language and different compilers for different platforms?
has answer: http://stackoverflow.com/a/22878229
has title: The reason for JVM existence
has answer: http://stackoverflow.com/a/22878887
accepted answer: http://stackoverflow.com/a/22878887
favorite count: 0
downvote count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/48656030
type: AnsweredQuestion

http://stackoverflow.com/q/22908303
has answer: http://stackoverflow.com/a/22909987
has title: Detecting Collisions 2D
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22908577
has answer: http://stackoverflow.com/a/22908396
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/6459035
has body: I'm doing a project in a simple 2D game, Arkanoid game. I work almost everything correctly, but I'm stuck in the collision of the ball with the bricks, ie, at the time of the crash, should act like a wall, reversing the direction of the ball. The problem arises to see if that collision occurs horizontally or vertically, for example if a collision with a brick is on the side, should invest only the X axis direction without altering the Y axis, and vice versa. I do not get to find the code that checks to me. public void detectCollisionWithBricks() { for (int i = 0; i &lt; brickGroup.length; i++) { for (int j = 0; j &lt; brickGroup[i].length; j++) { if (brickExists[i][j]) { if (getEllipse().intersects( brickGroup.brick[i][j] .getRectangle())) { incY*=-1; incX*=-1; brickExists[i][j] = false; } } } } } Code: -brickGroup: bidimensional array of bricks -brick: class painting a brick in the panel -brickExist: bidimensional array whit se same size as brickGroup, if false, doesn't paint the brick. -getEllipse(): returns an Ellipse2D.Double, with the coordinates of the ball. -getRectangle(): returns an Rectangle2D.Double, with the coordinates of the brick. -incX: increases the X position of the ball. -incY: increases the Y position of the ball. Ask if you do not understand some of the code. Sorry for my english :( Thanks in advance
type: UnansweredQuestion

http://stackoverflow.com/comment/34866221
score: 0
type: AnswerComment
has text: i have used n>>-1 since i have to pass half of the array each time to transform(s,n) fxn;and in the end i would like to have 2 list s1 and w1 where s1 is formed from first half of the list lList returned in each iteration with apppending of the content in s1 and not rewritting whereas w1 is the list made from second half of the list lList
type: Comment
comment on: http://stackoverflow.com/a/22854468

http://stackoverflow.com/comment/34938503
comment on: http://stackoverflow.com/a/22893421
type: AnswerComment
type: Comment
has text: Thanks for your example. Maybe you've got something similar to show exception/error after replacing Collections.synchronizedCollection() by collection constructor?
score: 0

http://stackoverflow.com/a/22923925
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35000944
type: AcceptedAnswer
downvote count: 0
has body: import javax.xml.bind.DatatypeConverter; byte[] data = DatatypeConverter.parseHexBinary(yourHexString); ASN1InputStream s = new ASN1InputStream(new ByteArrayInputStream(data)); ASN1String str = (ASN1String) s.readObject(); System.out.println(str.getString());
accepted answer of: http://stackoverflow.com/q/22912902
type: Answer
answers question: http://stackoverflow.com/q/22912902
has comment: http://stackoverflow.com/comment/35010124

http://stackoverflow.com/q/22955840
has title: Android - SwipeRefreshLayout importing issue
tagged with: java
tagged with: eclipse
tagged with: import
type: Question
has answer: http://stackoverflow.com/a/22956395
has body: I am trying to implement the official Google Swiping Layout in my app but i cannot import. I checked every possible question here. I did everything i was suppose to do: i changed my manifest (target 19) updated the Android SDK's support library (Android support 19.1) i created a new project an copy the jar from the new project into my old project. EDIT: i managed to import the library but now i am getting a crash when i start the activity that requires the SwipeRefreshLayout. Any opinions on that? Thanks a lot for your help!
duplicate of: http://stackoverflow.com/q/22736008
has comment: http://stackoverflow.com/comment/35175404
score: 0
linked to: http://stackoverflow.com/q/22736008
has comment: http://stackoverflow.com/comment/35131121
answer count: 1
has comment: http://stackoverflow.com/comment/35138307
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/34942865
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22897082
score: 0
has text: What exactly are you trying to click?

ignore-case
type: Tag
tag name: ignore-case
tags question: http://stackoverflow.com/q/22820220

http://stackoverflow.com/q/22927875
has body: I have arrayList ArrayList&lt;Product&gt; productList = new ArrayList&lt;Product&gt;(); productList = getProducts(); //Fetch the result from db This list is stored in an ArrayList. The problem is that when I print its data, I obtain : A, Arizona, 1980 B, Arizona, 1970 C, NewYork, 1980 D, NewYork, 1970 E, California, 1960 I want to convert to ArrayList to Map based on area: Map&lt;Integer, Map&lt;String, List&lt;Product&gt;&gt;&gt;//Integer here is year and String here is manufacturingArea The Product bean has the following structure : class Product{ private String name; private String manufacturingArea; private int year; /* Getters and setters*/ /* toString method */ } I'd like to convert to map like this : {1980= [Arizona,A], [NewYork,C]}, {1970= [NewYork,B],[NewYork,D]}, {1960= [California,E]} how can I group the data by converting arraylist to map?
tagged with: arraylist
score: 0
has title: Converting ArrayList to Map
answer count: 1
accepted answer: http://stackoverflow.com/a/22927931
has comment: http://stackoverflow.com/comment/34999512
has comment: http://stackoverflow.com/comment/34998887
has comment: http://stackoverflow.com/comment/34998892
tagged with: dictionary
type: AnsweredQuestion
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/22927931
type: Question

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/22895975
tags question: http://stackoverflow.com/q/22891329
type: Tag
tags question: http://stackoverflow.com/q/22829653
tags question: http://stackoverflow.com/q/22952023

http://stackoverflow.com/comment/35030362
comment on: http://stackoverflow.com/q/22937788
score: 0
has text: You won't get "Ivy Bridge" back no matter what. It's Intel's codename for the architecture, not a product identifier. Programmatically available CPU descriptions tend to be more along the lines of "Core 2 E3500".
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34998136
comment on: http://stackoverflow.com/q/22912670
type: Comment
has text: i tried in other pc and i didn't get 500 error .But why my machine is giving 500 error?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35044043
comment on: http://stackoverflow.com/a/22952136
has text: thank you...I'm able to resolve that now.. but now I'm getting an error like "simpleSchedule()" method is undefinrd for the type quartz... should I import any files for this?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22820006
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22819820
has body: JVM internally calls printStackTrace() method(Since you didn't override it so Throwable class implementation will be called). Accroding to Throwable#printStackTrace The first line of output contains the result of the toString() method for this object. Remaining lines represent data previously recorded by the method fillInStackTrace() If you don't want this representation then you can override printStackTrace() method in your custom exception class or else you can pass String message as constructor argument while creating its object.
upvote count: 1
type: Answer

http://stackoverflow.com/comment/34862774
score: 0
comment on: http://stackoverflow.com/a/22852680
type: AnswerComment
has text: seem my client didn't call SampleUploadServlet, do you know how to make client call SampleUploadServlet?
type: Comment

http://stackoverflow.com/q/22902586
tagged with: java
tagged with: switch-statement
has comment: http://stackoverflow.com/comment/34953025
type: Question
has comment: http://stackoverflow.com/comment/34952944
has answer: http://stackoverflow.com/a/22902633
linked to: http://stackoverflow.com/q/338206
has comment: http://stackoverflow.com/comment/34953024
score: 0
answer count: 1
has title: Default statement for my switch statement is not executing?
has comment: http://stackoverflow.com/comment/34953325
has body: import java.util.Random; //Needed for Random Class import java.util.Scanner; //Needed for Scanner Class public class Project3 { public static void main(String[] args) { //Declare Variables double num1; double num2; int addition; double division; int multiplication; int subtraction; int modulus; String mathOperation; //To get what type of problem user wants to do //Create Scanner Object for kb input Scanner kb = new Scanner(System.in); //Create Random Object Random randomNumbers = new Random(); //Get randomly generated numbers num1 = randomNumbers.nextInt(10); num2 = randomNumbers.nextInt(10); //display randomly generated numbers for user System.out.println("The numbers are " + num1 + " and " + num2); //ask user which operation they want to do System.out.println("Which arithmetic operation do you wish to use?" + " We can do addition, subtraction, multiplication, division, and modulus."); mathOperation = kb.nextLine(); double guess=0; System.out.println("What do you think the answer will be?"); guess = kb.nextDouble(); //Determine which arithmetic operation to be checked switch (mathOperation) { case "addition": System.out.println("The answer is: " + (num1 + num2)); if (guess == num1 + num2) System.out.println("You are correct!"); else System.out.println("You are wrong."); break; case "subtraction": System.out.println("The answer is: " + (num1 - num2)); if (guess == num1 - num2) System.out.println("You are correct!"); else System.out.println("You are wrong."); break; case "multiplication": System.out.println("The answer is: " + (num1*num2)); if (guess == num1 * num2) System.out.println("You are correct!"); else System.out.println("You are wrong."); break; //division - use WHILE selection statement case "division": while (num2 == 0) { System.out.println("Cannot determine answer since the divisor equals zero."); num2++; System.exit(1); } System.out.println( "The answer is: " + (num1/num2)); if (guess == num1 / num2) System.out.println("You are correct!"); else System.ou…
type: UnansweredQuestion

http://stackoverflow.com/comment/34992399
has text: Is the xml in /res/xml or /res/layout?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22924161
score: 0

http://stackoverflow.com/comment/39638730
type: Comment
comment on: http://stackoverflow.com/a/22833470
score: 11
has text: That did it for me too. What a shame that LibGDX has this issue right from the start-- it's a great system, but things like that are going to scare away devs with little patience.
type: AnswerComment

http://stackoverflow.com/comment/34839618
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22839592
has text: Hi @jgitter, this is more of a "is it possible" question. The errors I had were of very generic nature and I do understand the cause of them. I will clarify my question.
type: AnswerComment

http://stackoverflow.com/q/22965281
has body: I have stored in my android device (for example in directory Example) two jpeg file 1.jpg and 2.jpg of dimension 64x64. I want to merge (put one near the other) these two files and save in the same directory the resulting file 3.jpg of dimension 128x64. Which is the easiest way to do this? I tried to find some examples, but I have not find the solution. Thanks in advance!
type: AnsweredQuestion
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22968368
tagged with: java
has title: How to read, combine, save two jpeg files in android?
score: 0
answer count: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/22968368
linked to: http://stackoverflow.com/q/4863518

http://stackoverflow.com/comment/34861971
comment on: http://stackoverflow.com/q/22852187
score: 0
type: Comment
has text: Nope doesn't seem to work
type: QuestionComment

http://stackoverflow.com/a/22867786
downvote count: 0
has comment: http://stackoverflow.com/comment/34889375
has comment: http://stackoverflow.com/comment/34889440
type: Answer
has body: The default layout for top level containers is a BorderLayout. By default, if you don't specify a constraint the component is added to the CENTER. However only one component can be added to the CENTER so only the last one added is displayed. WorldView should be in the backround centred with Creature in the foreground Then add WorldView to the applet and add the Creature to the WorldView. You will need to use appropriate layout manager on the WorldView to get your desired layout.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22867454

http://stackoverflow.com/comment/35018021
has text: `Arrays.stream(stringsArray).sorted(Comparator.comparing(String::toLowerCase).reversed()).collect(Collectors.toList())` compiles with javac/netbeans on b132.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22938136
type: AnswerComment

http://stackoverflow.com/a/75224386
answers question: http://stackoverflow.com/q/22840322
type: Answer
downvote count: 1
has body: here is example for SHA256withRSA @Test fun signDigestAndMessageSHA256() { val message = "message" val digest = MessageDigest.getInstance("SHA-256").digest(payload.toByteArray()) val encodedDigest: ByteArray = DigestInfo(AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256, DERNull.INSTANCE), digest).encoded var signature = Signature.getInstance("NONEwithRSA") signature.initSign(privateKey) signature.update(encodedDigest) val signedDigest = signature.sign() signature = Signature.getInstance("SHA256withRSA") signature.initSign(privateKey) signature.update(payload.toByteArray()) val signedMessage = signature.sign() Assert.assertEquals(signedDigest.joinToString(), signedMessage.joinToString()) }
score: -1
upvote count: 0

http://stackoverflow.com/q/22901937
has body: I writing a program learning arraylists. Essentially what it does is pulls from an array of Strings (each a word) and find the duplicates using to parallel arraylists. There are two arraylists one for the words and one for the number of times each word appears. The word in 0th spot of the words list corresponds to the number in the 0th spot of counts list and so on. I am successfully finding duplicate words and counting their occurrences but for words that occur only once I am getting a count of 2 and I can't seem to find out why. Here is the code String[] wordList = fileContents.split("\\s"); ArrayList&lt;String&gt; words = new ArrayList&lt;String&gt;(); ArrayList&lt;Integer&gt; counts = new ArrayList&lt;Integer&gt;(); words.add(wordList[0]); counts.add(0); for (int i = 0; i &lt; wordList.length; i++) { String tempWord = wordList[i]; boolean foundEqual = false; int count = 0; for(int q = 0;q &lt; words.size();q++) { if (tempWord.equals(words.get(q))) { foundEqual = true; counts.add(q, counts.get(q) + 1); } } if(!foundEqual){ words.add(tempWord); counts.add(1); } } for (int i = 0; i &lt; words.size(); i++) { System.out.println(words.get(i) + ":" + counts.get(i)); } Here are the words this is a test this is also a test this is the last test And here it the output, as you can see the last three items should be 1 but are 2. this:3 is:3 a:2 test:3 also:2 the:2 last:2 Any help would be really appreciated!
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22902150
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/22902169
tagged with: histogram
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22902169
tagged with: java
type: Question
has title: Creating a Histogram from an Array using parallel Arraylists
has answer: http://stackoverflow.com/a/22902150
answer count: 2

http://stackoverflow.com/q/22926196
has title: counting numbers in a text file
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22926211
has body: I happened to modify the source code as seen in the topic,"Reading a text file then performing a character count and printing the relative frequency of each one". I changed it in such a way that the non-alphabetic characters would also be counted (see the source code below)... import java.io.*; public class letterfrequency { public static void main (String [] args) throws IOException { File file1 = new File ("letternumberfrequency.txt"); BufferedReader in = new BufferedReader (new FileReader (file1)); int nextChar; int other = 0; char ch; int [] count = new int [26]; while ((nextChar = in.read())!= -1) { ch = ((char)nextChar); ch = Character.toLowerCase (ch); if (ch &gt;= 'a' &amp;&amp; ch &lt;= 'z') count [ch- 'a']++; else other ++; } for (int i=0; i&lt;26; i++){ System.out.printf ("%c = %d \n", i+ 'A', count [i]); } System.out.println ("Non-alphabetic characters: " + other); in.close (); } } But, let's just say that now I have the following characters in the text file, "letternumberfrequency.txt": 71 geese - 83 cars - 58 cows- 64 mooses- 100 ants- 69 bangles- 90 molehills - 87 noses The numbers inside that text file would be considered as strings, am I right? But I want to extract the numbers so that I can also be able to count their frequency - not as individual digits but as whole numbers (that is how many "71", "83", "58", "64", etc. are there...). Would using "Double.parseDouble ()" help?
tagged with: frequency
type: UnansweredQuestion
tagged with: numbers
tagged with: java
linked to: http://stackoverflow.com/q/20080766
type: Question
tagged with: counter

http://stackoverflow.com/q/22860100
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34875969
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22860386
has title: json package not compatible with jdk 1.4
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34875862
has body: i use the package from http://mvnrepository.com/artifact/org.json/json/20140107. it compiles perfectly, but when i try to run my servlet, i get an 500 error, root cause is java.lang.UnsupportedClassVersionError: org/json/JSONException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at org.apache.catalina.loader.StandardClassLoader.findClass(StandardClassLoader.java:621) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:958) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:857) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:941) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:857) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1430) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1289) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:1618) at java.lang.Class.getConstructor0(Class.java:1930) at java.lang.Class.newInstance0(Class.java:278) at java.lang.Class.newInstance(Class.java:261) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:903) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalin…
type: Question
has comment: http://stackoverflow.com/comment/34875703
tagged with: jdk1.4
has comment: http://stackoverflow.com/comment/34875339

http://stackoverflow.com/comment/35182768
comment on: http://stackoverflow.com/q/22958063
score: 0
type: Comment
type: QuestionComment
has text: It *is* not a bug in iText. It *was* a bug in iText. You're using an obsolete version that was released in July 2009. The bug you're mentioning has been solved. Please do not report bugs that have been fixed! Please upgrade to the latest version of iText instead.

http://stackoverflow.com/comment/34914118
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22880332
type: Comment
has text: When i initialize myAudioRecorder outside the method, this is given: 04-05 15:16:54.630: E/AndroidRuntime(8569): FATAL EXCEPTION: main 04-05 15:16:54.630: E/AndroidRuntime(8569): java.lang.IllegalStateException 04-05 15:16:54.630: E/AndroidRuntime(8569): at android.media.MediaRecorder.stop(Native Method)

http://stackoverflow.com/a/23027511
accepted answer of: http://stackoverflow.com/q/22894761
has body: I suppose they have the answer for this in the GeoNames discussion baord already, thus do try the 'p' option with the fclass.
upvote count: 1
answers question: http://stackoverflow.com/q/22894761
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/34905990
has text: so from the bytecode way, astore_0, astore_1, store the reference, so load_0, then modified, then index 1 will see the modify result. is that right?
score: 0
comment on: http://stackoverflow.com/q/22876390
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22864017
has title: printf not working as it did in a video
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34883242
has comment: http://stackoverflow.com/comment/34883163
has comment: http://stackoverflow.com/comment/34882644
linked to: http://stackoverflow.com/q/7774428
has comment: http://stackoverflow.com/comment/34882572
tagged with: java
has body: My first class... import java.util.Scanner; class MethodsANDInstances16A { public static void main(String[] args) { Scanner input = new Scanner(System.in); MethodsANDInstances16B methObject = new MethodsANDInstances16B(); System.out.println("Enter name of first girlfriend or good friend here: "); String temp = input.nextLine(); methObject.setName(temp); methObject.saying(); } } My second class... public class MethodsANDInstances16B { private String girlName; public void setName(String name){ girlName = name; } public String getName(){ return girlName; } public void saying(){ System.out.printf("Your first girlfriend or good friend was %s", getName()); } } I just watched a Tutorial on YouTube with basically the exact same code... and yet the printf statement doesn't work for me... but it does in the video I watched. I heard I need to change Settings in Eclipse (IDE I'm using), but I'm not sure? This is the error I'm getting when I run it... "Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, String) at MethodsANDInstances16B.saying(MethodsANDInstances16B.java:11) at MethodsANDInstances16A.main(MethodsANDInstances16A.java:10)" Thank you.
type: Question
tagged with: printf
has comment: http://stackoverflow.com/comment/34882977
score: 0
has answer: http://stackoverflow.com/a/22864345
answer count: 1

http://stackoverflow.com/comment/34893610
comment on: http://stackoverflow.com/q/22870088
score: 1
has text: See http://stackoverflow.com/questions/10311754/date-time-library-for-gwt
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22923863
has body: If you care less about time complexity, you can just use a for loop to iterate the string passed in. make another string to hold what to return, say, call it toReturn. in the for loop, all you need to do is to determine if this character is a " ". Use .charAt(i) to do so. if it's not, just attach it to the toReturn. after the for loop, you will have what you want to return.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22923739

http://stackoverflow.com/comment/40242446
score: 0
type: Comment
type: QuestionComment
has text: Could you elaborate on what made you move away from JavaCV? I might be able to fix whatever was wrong with it. Thanks!
comment on: http://stackoverflow.com/q/22948553

http://stackoverflow.com/comment/34954944
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22903804
has text: if(a>b && b>c && c> d) this will work when all conditions are true, but in multiple if, if any condition is true it will work for that.

http://stackoverflow.com/a/22849459
upvote count: 0
has comment: http://stackoverflow.com/comment/34857585
has comment: http://stackoverflow.com/comment/34857586
has body: I think that if you configure the departament column in Employee to allow null and set cascades correctly it can solve the problem. And please, do not use flush
score: -1
answers question: http://stackoverflow.com/q/22849268
downvote count: 1
type: Answer

http://stackoverflow.com/comment/34918379
comment on: http://stackoverflow.com/a/22868354
has text: I think you didn't understand me. Every uncaught exception inside main thread kill while VM, or possible you don't know that services run in main thread as well.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34991023
type: Comment
comment on: http://stackoverflow.com/q/22923492
score: 0
type: QuestionComment
has text: The `processSomething` method is synchronized but your critical section is in `call`.

http://stackoverflow.com/a/48189328
downvote count: 0
answers question: http://stackoverflow.com/q/22954315
type: Answer
score: 14
upvote count: 14
has comment: http://stackoverflow.com/comment/137896820
has body: Here's how to Generate an Avro Schema from POJO definition ObjectMapper mapper = new ObjectMapper(new AvroFactory()); AvroSchemaGenerator gen = new AvroSchemaGenerator(); mapper.acceptJsonFormatVisitor(RootType.class, gen); AvroSchema schemaWrapper = gen.getGeneratedSchema(); org.apache.avro.Schema avroSchema = schemaWrapper.getAvroSchema(); String asJson = avroSchema.toString(true);

http://stackoverflow.com/a/22906426
has body: The whole point of having the @Transactional annotation is to have the container (in this case Spring) handle all the transaction related stuff automatically. What this means is that if all goes well and no exceptions are thrown the container will commit the transaction upon exit from the @Transactional code, or the transaction will be rolled back if an exception occurs. In case you where wondering, @Transaction in Spring is implemented using AOP, because it is a crosscutting concern. You can read the documentation for all the details
upvote count: 7
score: 7
downvote count: 0
answers question: http://stackoverflow.com/q/22906178
type: Answer

udp
tags question: http://stackoverflow.com/q/22878331
tags question: http://stackoverflow.com/q/22818593
tags question: http://stackoverflow.com/q/22927035
tags question: http://stackoverflow.com/q/22925500
tags question: http://stackoverflow.com/q/22846816
tag name: udp
type: Tag
tags question: http://stackoverflow.com/q/22894482
tags question: http://stackoverflow.com/q/22889264

http://stackoverflow.com/a/22907768
upvote count: 2
type: Answer
has body: Initialize your numbers array inside the onCreate() method as follows... String[] numbers; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); numbers = new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",getResources().getString(R.string.dialogc)}; }
answers question: http://stackoverflow.com/q/22907586
score: 2
downvote count: 0

http://stackoverflow.com/a/22899521
type: AcceptedAnswer
downvote count: 0
has body: Currently, no. The diff variable is a local variable and is therefore only accessible within the body of the method, after it's been declared (and initialized). AOP advice is meant to add additional behavior (by executing code) at a certain point in the execution of a program. It's a self contained component. It can know about the code it's intercepting, but not vice-versa. There are obviously work arounds if you need to do this, but I don't recommend it. You can use a static ThreadLocal in some class and set its value to whatever diff is. You can then access that ThreadLocal anywhere else.
type: Answer
has comment: http://stackoverflow.com/comment/34947381
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22899266
answers question: http://stackoverflow.com/q/22899266

http://stackoverflow.com/comment/34927823
type: QuestionComment
comment on: http://stackoverflow.com/q/22888739
has text: Probably this will help : http://stackoverflow.com/questions/12663440/source-folder-is-not-a-java-project-when-working-with-heroku-eclipse-plugin
score: 0
type: Comment

http://stackoverflow.com/comment/35012992
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22936099
has text: @Dev are your sure you added the `(` and `)` in the regex as shown above? This solution works!
type: AnswerComment

http://stackoverflow.com/comment/34816850
type: AnswerComment
has text: I need int and string some of them mixed, thanks though
type: Comment
comment on: http://stackoverflow.com/a/22827296
score: 0

http://stackoverflow.com/a/22945860
answers question: http://stackoverflow.com/q/22945712
score: -1
upvote count: 0
type: Answer
has body: Instead JFrame.dispose();, use frame.dispose() or JFrame.this.dispose();
downvote count: 1

http://stackoverflow.com/a/28177217
type: Answer
answers question: http://stackoverflow.com/q/22966019
score: 2
has body: The answer for your question is in this issue. Here is an example: $(document).ready(function() { $('#username').editable({ ajaxOptions: {contentType: 'application/json', dataType: 'json'}, params: function(params) { return JSON.stringify(params); }, }); }); This works for me.
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/22965160
answers question: http://stackoverflow.com/q/22868791
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22868791
type: Answer
has body: I m removing the context "ansi" and its work // Main element and namespace SOAPElement be = bd.addChildElement(env.createName("GetCitiesByCountry", "", "http://www.webserviceX.NET")); thank you all
score: 0

http://stackoverflow.com/q/22960046
has answer: http://stackoverflow.com/a/22964919
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2042813
has answer: http://stackoverflow.com/a/22960088
has comment: http://stackoverflow.com/comment/35055404
tagged with: static
type: Question
tagged with: android
possible better answer: http://stackoverflow.com/a/22960088
accepted answer: http://stackoverflow.com/a/22964919
has body: I have a class where some variables are initialized with static final. This variables have a defined initial value that is used in it's same class, and in another class. Now, I want the value of this variables to be dependant of a scale_factor: From this: class Ball { public static final float SPEED = 4.0f; //... To this: class Ball { public static final float SPEED = 4.0f * scale_factor; //... Sopposing that scale_factor is another float with value from 1.0 to 3.0. The problem is that if I do this, I get this error: The field SPEED cannot be declared static in a non-static inner type, unless initialized with a constant expression It suggest to remove the static modifier of SPEED. If I do it, then, I cannot use this variable in other classes cause it tells me to make it static to be able to use it. UPDATE-- public class SinglePlayerView extends View { //... public static float scale_factor; //... public SinglePlayerView(Context context) { super(context); scale_factor = setScreenScale(); } public float setScreenScale() { float scale = getResources().getDisplayMetrics().density; return scale; } class Ball { public float x, y, xp, yp, vx, vy; public float speed = SPEED; public static final double BOUND = Math.PI / 9; public static final float SPEED = 4.0f; public static final int RADIUS = 4; public static final double SALT = 4 * Math.PI / 9; public Ball() { } public Ball(Ball other) { x = other.x; y = other.y; xp = other.xp; yp = other.yp; vx = other.vx; vy = other.vy; speed = other.speed; mAngle = other.mAngle; } //... The parameters I would need to multiply the scale_factor are SPEED and RADIUS
has answer: http://stackoverflow.com/a/22960915
score: 0
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/35055431
has title: Set initial value to static fields

http://stackoverflow.com/comment/34862868
type: AnswerComment
comment on: http://stackoverflow.com/a/22851217
score: 0
type: Comment
has text: Hi Tanmay so nicely explained and hit the point what I really want to understand. I cannot stop thanking you.I know that my intention here is not clean design applying principles of cohesion / coupling / dep injection etc.. even though it looks like. Here my intent is how Bound mismatches, hiding of variables work, in the context of composition and inheritance. Once thing I got here, where we cannot get in books or online material is that use type parameter definition in interface generic types and more concrete while defining the concrete classes. Angelina Langer is really insightful.Thanks.

http://stackoverflow.com/comment/34868356
has text: Read the answer from @fge. Read the javadoc of the classes involved.
comment on: http://stackoverflow.com/q/22855155
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35098566
comment on: http://stackoverflow.com/a/22913317
score: 0
has text: my real rowkey is a byte array.(really it's long)
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/47126778
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22935781
has text: I don't know if this is going to be helpful to anybody, but I sometimes use something like verify(mock).method(any(MyClass.class)). It's useful when it doesn't really matter what you pass in it's nice to avoid this kind of error.
score: 18

http://stackoverflow.com/comment/35118402
type: QuestionComment
comment on: http://stackoverflow.com/q/22875437
score: 0
has text: Use `DisplayImageOptions.resetViewBeforeLoading(...)` or `.showImageOnLoading(...)`.
type: Comment

http://stackoverflow.com/a/22819825
upvote count: 1
has comment: http://stackoverflow.com/comment/34803727
downvote count: 0
has comment: http://stackoverflow.com/comment/34803886
answers question: http://stackoverflow.com/q/22815115
type: Answer
has body: For a true Decorator/Adapter, the Adapter should have the same interface so your wrapper methods get/setMyParam() should be get/setParam() and if possible you should implement the 3rd party interface if it exists. Code should not be able to tell the difference between your wrapper and the original from an API perspective. Now onto your questions: Primary question: In Fowler's Refactoring, each refactoring has a step-by-step process to ensure correctness. Is there one for this process? Yes, Joshua Kerievsky's Refactoring to Patterns calls this "Extract Adapter" and there is a step by step example. I can't find an exact code example online but the UML before/after is Here Does this sort of refactoring have a name? "Extract Decorator"? As stated before it's called Extract Adapter Does it even make sense to do this (vs. just making a test class from scratch) Maybe depends on your usecase. Is there an IDE that can do this? I'm currently using Eclipse 4.3.1 You can use Eclipse's refactoring tools to perform each step but I would hesitate to try to do a complicated refactoring like you are hinting that you have in a single button push, even if a tool existed that would let you.
score: 1

http://stackoverflow.com/q/22855820
has answer: http://stackoverflow.com/a/22856012
tagged with: java
score: 0
tagged with: comparator
answer count: 3
has title: How to sort FTPFile[] array object based on timestamp in java
type: UnansweredQuestion
has body: I am polling files from FTP server. I have an use case to sort the array FTPFile[] based on timestamp. I want to first modified file as first object and last modified file as last object in my FTPFile[] array object. Can some one please suggest me how to do in java. Thanks
tagged with: ftp
has answer: http://stackoverflow.com/a/22856009
type: Question
has answer: http://stackoverflow.com/a/22856033

http://stackoverflow.com/a/22960908
has comment: http://stackoverflow.com/comment/35057968
has body: From what you have wrote. The most probably cause is that d1 is null. When the RegVedKjøp is creating. Then the database d1 is null into the class. If I would be you. I would debug and check if the Database d1 is null or not. But since you haven't added your stacktrace, it is difficult to say exactly. There is some variable inside the method visKunde, that also could be null. Since they are created outside of the method.
type: Answer
answers question: http://stackoverflow.com/q/22960648
score: 0
has comment: http://stackoverflow.com/comment/35061121

http://stackoverflow.com/comment/35039465
type: Comment
type: QuestionComment
score: 0
has text: im not sure if I did this correctly and how can I get this to work perfectly boolean [][] matrix = new boolean[r][c]; Random rand = new Random(); for( int i = 0; i < 5; i++ ) for ( int j = 0; j < 5; j++ ) matrix[r][c] = rand.nextBoolean(); return matrix[][];
comment on: http://stackoverflow.com/q/22950515

http://stackoverflow.com/a/22853531
answers question: http://stackoverflow.com/q/22853520
type: Answer
has body: One dot refers to the current working directory.
score: 5
upvote count: 5
downvote count: 0

http://stackoverflow.com/comment/35034344
type: Comment
type: QuestionComment
has text: Should it be "valid" words, or just any combination?
comment on: http://stackoverflow.com/q/22947537
score: 0

http://stackoverflow.com/comment/34830817
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22835214
has text: possible duplicate of [Is Java "pass-by-reference"?](http://stackoverflow.com/questions/40480/is-java-pass-by-reference)

http://stackoverflow.com/a/22911107
answers question: http://stackoverflow.com/q/22827163
upvote count: 1
has body: This may help you. public void getRandomOptions(dropdownName) { Properties dropdown = new Properties(); InputStream input = null; String returnString=null; input = new FileInputStream("yourconfig.properties"); dropdown.load(input); String records = dropdown.getProperty(dropdownName); StringTokenizer breaker = new StringTokenizer(records, ","); int rLocation =(int) Math.random() * (breaker.countTokens()-1); for(int i=0;i&lt;rLocation ;i++) { if(breaker.hasMoreTokens()) returnString = breaker.nextToken(); } return returnString; }
score: 1
has comment: http://stackoverflow.com/comment/89759924
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34854790
comment on: http://stackoverflow.com/q/22848361
score: 0
has text: What is on this line of code: `MainActivity.java:187`?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34824129
comment on: http://stackoverflow.com/q/22831382
score: 0
type: Comment
type: QuestionComment
has text: @BackSlash might as well make that an answer

http://stackoverflow.com/comment/34928145
score: 1
type: AnswerComment
has text: Cool, if you this was helpful, consider accepting my answer for my time!
type: Comment
comment on: http://stackoverflow.com/a/22888685

http://stackoverflow.com/q/22888192
has answer: http://stackoverflow.com/a/22888207
has title: Andengine and box2d collision detection
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: andengine
type: Question
has body: I'm using AndEngine and Box2d in android application. What to I have to do so that when player and coin collide, the player goes through coin without hitting against it as if it is a wall? public class GameScene extends Scene { GameScene() { Body playerBody = PhysicsFactory.createBoxBody(world, playerSprite, BodyType.DynamicBody, fixtureDef); PhysicsConnector playerConnector = new PhysicsConnector(playerSprite, playerBody, true, false); world.registerPhysicsConnector(playerConnector); Body coinBody = PhysicsFactory.createBoxBody(world, coinSprite, BodyType.StaticBody, fixtureDef); PhysicsConnector coinConnector = new PhysicsConnector(coinSprite, coinBody, true, false); world.registerPhysicsConnector(coinConnector); } private ContactListener createContactListener(){ //if player and coin collide --&gt; destroy coin } }
answer count: 1

http://stackoverflow.com/comment/35015302
type: Comment
has text: I don't have much maven/surefire know-how, but it might be helpful to know that for every single test case JUnit actually creates an own object of the test class. If this objects are distributed Junit maybe calls the @*Class methods for every testcase-object
comment on: http://stackoverflow.com/q/22936404
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34932814
has text: Actually I disagree, the problem is not Joda-Time precision, is the way that you have used the wrong tool (a partial) for the job (measuring duration). `Instant.now().getMillis()` will better serve the bill. Also, your benchmark is flawed, there is not 100 ms of processing after warm up, even with the broken `LocalDateTime.getMillisOfDay()` approach.
type: AnswerComment
comment on: http://stackoverflow.com/a/22877126
type: Comment
score: 2

http://stackoverflow.com/a/22907408
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/34965622
accepted answer of: http://stackoverflow.com/q/22907294
answers question: http://stackoverflow.com/q/22907294
type: AcceptedAnswer
downvote count: 0
has body: This problem occurs in the server because the lib of Tomcat and you application both have their own copy of mail.jar (in WEB-INF/lib), so the classloaders can load two different Session.If you delete the mail.jarfrom your application, this problem will be solved.

http://stackoverflow.com/comment/34832188
has text: Yes, It is correct. Why ?
comment on: http://stackoverflow.com/q/22835674
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22856600
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22858829
favorite count: 0
upvote count: 1
possible better answer: http://stackoverflow.com/a/22857564
tagged with: spring
tagged with: collections
has answer: http://stackoverflow.com/a/22857564
tagged with: spring-mvc
tagged with: model-view-controller
has body: Have to beans: @Entity @Table(name="book") public class Book { @Id @Column(name="id_book") @GeneratedValue(generator="increment") @GenericGenerator(name="increment", strategy="increment") private int id; @Column @Size(min=1,max=100) private String title; @Column @Size(min=1,max=400) private String description; @Column private Integer year=0; @ManyToMany(cascade={CascadeType.ALL},fetch = FetchType.EAGER) @Fetch (FetchMode.SELECT) @JoinTable(name="book_author", joinColumns={@JoinColumn(name="book_id_book")}, inverseJoinColumns= {@JoinColumn(name="author_id_author")}) private List&lt;Author&gt; author=new ArrayList&lt;Author&gt;(); //getters/setters } and: @Entity @Table(name="author") public class Author { @Id @Column(name="id_author") @GeneratedValue private Integer id; @Column private String name; @Column private String surname; @ManyToMany(mappedBy="author") private Set&lt;Book&gt; book=new HashSet&lt;Book&gt;(); //getters/setters } In my jsp I'm have form for enter data about book, and multiple list for select author(s) from DB, problem only in select authors, therefore give only this code: &lt;sf:select multiple="true" path="author" items="${authors}" size="7" &gt; &lt;/sf:select&gt; Where ${authors} - List with objects Author from DB. Use POST request. In my controller for this page have this (I know it's not correct): @RequestMapping(value="/addbook", method=RequestMethod.POST) public String addBook(Book book){ hibarnateService.saveBook(book); return "redirect:/books"; } When I'm create book without select authors, but enter another information, all fine, book save in DB. When select some authors get this - The request sent by the client was syntactically incorrect.
type: AnsweredQuestion
score: 1
tagged with: java
has title: Binding objects from spring multiple <form:select>
has answer: http://stackoverflow.com/a/22858829
type: Question

http://stackoverflow.com/q/22923658
tagged with: arrays
has answer: http://stackoverflow.com/a/22923946
score: 0
tagged with: list
tagged with: addition
accepted answer: http://stackoverflow.com/a/22923946
has answer: http://stackoverflow.com/a/22923796
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34991436
possible better answer: http://stackoverflow.com/a/22923758
tagged with: java
has body: What I'm trying to accomplish is adding 1 to the all the numbers in shipX array list, question is, how? I want to do this when the method move() is called, but how would I make this happen, as I'm new with arrays class Ship { public void paint(Graphics g) { int shipX[] = {500,485,500,515,500}; int shipY[] = {500,485,455,485,500}; g.setColor(Color.cyan); g.fillPolygon(shipX, shipY, 5); } public void move() { } }
linked to: http://stackoverflow.com/q/2015795
has answer: http://stackoverflow.com/a/22923758
has title: How to add integer to integers in array
answer count: 3

http://stackoverflow.com/comment/34940962
score: 0
has text: Thanks for the 4.3 example. I've also found a solution using the RequestConfig method `setConnectionTimeout`, and assigning that config using the method `setConfig` on the httpget object :)
type: AnswerComment
comment on: http://stackoverflow.com/a/22864802
type: Comment

http://stackoverflow.com/comment/35009618
type: Comment
score: 1
has text: Thank you for the info. Creating an appender was pretty easy, that is not my problem. The problem is creating a logger and appender dynamically and then accessing that logger over slf4j.
comment on: http://stackoverflow.com/a/22924753
type: AnswerComment

http://stackoverflow.com/a/26961161
downvote count: 1
has comment: http://stackoverflow.com/comment/57904264
type: Answer
has comment: http://stackoverflow.com/comment/64824466
score: 67
has body: The shade:shade Mojo is quite well documented, here especially about the createDependencyReducedPom parameter, which will create that dependency-reduced-pom.xml file: maven-shade-plugin/shade-mojo.html#createDependencyReducedPom In short, this is quite useful if you intend to use that shaded JAR (instead of the normal JAR) as a dependency for another module. That dependency-reduced-pom.xml will not contain the JARs already present in the shaded one, avoiding useless duplication.
has comment: http://stackoverflow.com/comment/64820911
has comment: http://stackoverflow.com/comment/63250779
answers question: http://stackoverflow.com/q/22904573
has comment: http://stackoverflow.com/comment/66813938
upvote count: 68

http://stackoverflow.com/q/22905562
accepted answer: http://stackoverflow.com/a/22906680
has answer: http://stackoverflow.com/a/47260914
answer count: 5
has comment: http://stackoverflow.com/comment/34958158
has title: functional interfaces of java 8 in java 7
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34961597
tagged with: java
has body: are the functional interfaces of java 8 available somewhere (i.e. a jar) so I can use them in a Java 7 project? that way I could later on easier port the code to idiomatic java 8. if not, is that technically possible or do they make use of new features like default methods? yes, i meant the interfaces in java.util.function. since adding packages with the java prefix seems to be disallowed importing them from somewhere else is not an option.
has answer: http://stackoverflow.com/a/73753785
has answer: http://stackoverflow.com/a/25540353
type: Question
upvote count: 22
has answer: http://stackoverflow.com/a/22906680
tagged with: compatibility
tagged with: java-7
downvote count: 0
score: 22
has answer: http://stackoverflow.com/a/25042004
favorite count: 0
possible better answer: http://stackoverflow.com/a/25042004

http://stackoverflow.com/comment/34975142
type: Comment
has text: i do it but it give me to add cast to jarray.get(i) ?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22914912

http://stackoverflow.com/comment/35735488
type: Comment
type: QuestionComment
has text: @RAS I agree with you. Thanks
score: 0
comment on: http://stackoverflow.com/q/22896848

http://stackoverflow.com/q/22890719
has comment: http://stackoverflow.com/comment/34931590
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34931575
type: Question
tagged with: email
has body: I have following code import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; public class SendEmail { public static void main(String [] args) { // Recipient's email ID needs to be mentioned. String to = "*****@gmail.com"; // Sender's email ID needs to be mentioned String from = "test1@localhost"; // Assuming you are sending email from localhost String host = "localhost"; // Get system properties Properties properties = System.getProperties(); // Setup mail server properties.setProperty("mail.smtp.host", host); // Get the default Session object. Session session = Session.getDefaultInstance(properties); try{ // Create a default MimeMessage object. MimeMessage message = new MimeMessage(session); // Set From: header field of the header. message.setFrom(new InternetAddress(from)); // Set To: header field of the header. message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); // Set Subject: header field message.setSubject("This is the Subject Line!"); // Now set the actual message message.setText("This is actual message"); // Send message Transport.send(message); System.out.println("Sent message successfully...."); }catch (MessagingException mex) { mex.printStackTrace(); } } } Mercury Server Log T 20140406 114001 534133f8 Connection from 127.0.0.1 T 20140406 114001 534133f8 EHLO RAVI-PC T 20140406 114001 534133f8 MAIL FROM:&lt;test1@localhost&gt; T 20140406 114001 534133f8 RCPT TO:&lt;mygmailaccount@gmail.com&gt; T 20140406 114001 534133f8 DATA T 20140406 114001 534133f8 DATA - 9 lines, 274 bytes. T 20140406 114001 534133f8 QUIT T 20140406 114001 534133f8 Connection closed with 127.0.0.1, 0 sec. elapsed. Server Debug Output DEBUG: JavaMail version 1.5.0 DEBUG: successfully loaded resource: /META-INF/javamail.default.providers DEBUG: Tables of loaded providers DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], c…
has comment: http://stackoverflow.com/comment/34931548
tagged with: gmail
has comment: http://stackoverflow.com/comment/34932198
upvote count: 2
has comment: http://stackoverflow.com/comment/34931542
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22890867
tagged with: mercury-mta
has title: Send mail from local machine mail server to gmail or other mail server in java
has comment: http://stackoverflow.com/comment/34931595
tagged with: java
has comment: http://stackoverflow.com/comment/34931475
has comment: http://stackoverflow.com/comment/34931544
type: UnansweredQuestion
tagged with: jakarta-mail

http://stackoverflow.com/q/22857744
type: UnansweredQuestion
has title: how java inner class objects exists in the memory heap?
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22859887
answer count: 2
has answer: http://stackoverflow.com/a/22857814
has body: class Outer { int o = 10; class Inner { int i = 20; } } public class Demo { public static void main(String args[]) { Outer o = new Outer(); Outer.Inner oi = o.new Inner(); } } when we creating an inner class object through a outer class object how they both associate with each other in the heap ?
downvote count: 0
tagged with: jvm
favorite count: 0
tagged with: heap-memory
score: 2
tagged with: inner-classes
upvote count: 2

http://stackoverflow.com/comment/42657547
type: Comment
comment on: http://stackoverflow.com/a/22872161
type: AnswerComment
score: 0
has text: Where is this \@Bean defined? In the Config class? Do you still annotate your Advice with @Aspect and use \@EnableAspectJAutoProxy on Configuration class? I have tried this but it doesn't look like AspectJ compile-time weaving is kicking in. Here's my sample code: https://github.com/jigishpa/spring-samples/tree/master/aop/hello

http://stackoverflow.com/a/22965971
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22965818
has comment: http://stackoverflow.com/comment/35072443
answers question: http://stackoverflow.com/q/22965818
type: Answer
has comment: http://stackoverflow.com/comment/35066760
upvote count: 1
score: 1
has body: There is nothing more that you need to do in your code to call those methods. paintComponent is called by the parent of the JComponent. In your case, you're adding an instance of HelloComponent to a JFrame. The JFrame will call paintComponent when necessary. mouseDragged and mouseMoved are methods defined in the MouseMotionListener interface. By calling addMouseMotionListener(this), you register your class to receive those messages when the appropriate mouse actions happen.

oracle11g
tags question: http://stackoverflow.com/q/22819547
type: Tag
tag name: oracle11g
tags question: http://stackoverflow.com/q/22832217
tags question: http://stackoverflow.com/q/22823666
tags question: http://stackoverflow.com/q/22920434

http://stackoverflow.com/comment/34938146
comment on: http://stackoverflow.com/a/22894456
score: 0
type: AnswerComment
type: Comment
has text: I've updated my question, I actually need those `$`s.

http://stackoverflow.com/comment/34944442
type: Comment
type: QuestionComment
has text: What do you call your "current IP" anyway? It is a vague notion. `ip addr` will show all my IP addresses on my system.
score: 0
comment on: http://stackoverflow.com/q/22897992

http://stackoverflow.com/a/22900203
score: 1
has body: You didn't mention how efficient it needs to be so I assume a TreeSet is what you need Operations you mentioned are done in log(n)
type: Answer
answers question: http://stackoverflow.com/q/22900173
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22900173
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22876730
type: Question
possible better answer: http://stackoverflow.com/a/22876976
tagged with: autocomplete
has comment: http://stackoverflow.com/comment/34906425
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22876777
accepted answer: http://stackoverflow.com/a/22876777
tagged with: autocompletetextview
favorite count: 0
has answer: http://stackoverflow.com/a/22876976
has body: I am trying to learn AutoCompleteTextView in android. I made a small app with AutoCompleteTextView against a few names. The app has no syntax errors. But, when I upload it to the emulator for testing, it crashes down at the start screen itself. Please help. package com.mavenmaverick.autocomplete_test; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; public class MainActivity extends Activity { String[] presidents= { "John F. Kennedy", "Lyndon B. Johnson", "Richard Nixon", "Gerald Ford", "Jimmy Carter", "Ronald Reagan", "George H. W. Bush", "Bill Clinton", "George W. Bush", "Barack Obama" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, R.id.names,presidents); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1); textView.setThreshold(3); textView.setAdapter(adapter); } } &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;AutoCompleteTextView android:id="@+id/autoCompleteTextView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/names" android:layout_centerHorizontal="true" android:layout_marginTop="20dp" android:ems="10" &gt; &lt;requestFocus /&gt; &lt;/AutoCompleteTextView&gt; &lt;TextView android:id="@+id/names" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layou…
has answer: http://stackoverflow.com/a/22876745
tagged with: android
linked to: http://stackoverflow.com/q/22877325
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: Why is my application with AutoCompleteTextView crashing down

http://stackoverflow.com/a/22955787
has body: I think all you need to do is to set fallbackToSystemLocale property of ReloadableResourceBundleMessageSource to false.
answers question: http://stackoverflow.com/q/22955394
score: 0
has comment: http://stackoverflow.com/comment/35059018
type: Answer

http://stackoverflow.com/q/22909734
downvote count: 0
has answer: http://stackoverflow.com/a/22912022
accepted answer: http://stackoverflow.com/a/22912022
has body: I'm getting that exception when reading an InputStream with JDOM's SAXBuilder's build method: InputStream bais = p_sendXML.getXml().getInputStream(); File myFile = new File(System.getProperty("java.io.tmpdir"), PREFIX+p_sendXML.getSessionId()+".xml"); IOUtils.copy(bais, new FileOutputStream(myFile)); LOGGER.debug("File save in: "+myFile.getAbsolutePath()); SAXBuilder builder = new SAXBuilder(); Document xmlDoc = builder.build(bais); The File is correctly created and the XML inside is valid, so I shouldn't get this exception. There is a new line at the end of the XML file, if you are wondering.
has title: JDOMParseException: Error on line -1: Premature end of file
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34966942
tagged with: jdom
answer count: 1
score: 4
favorite count: 0
upvote count: 4
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/34965199

http://stackoverflow.com/comment/35047189
has text: Hi I tried to delete particular file .ear file with in zip but it gave runtime exception that can not able to rename file
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22937194
score: 0

http://stackoverflow.com/comment/34951676
type: Comment
comment on: http://stackoverflow.com/a/22901783
has text: forgot to include them in the code, thanks for catching that. Code updated. I still keep getting errors will update original post to show
score: 0
type: AnswerComment

http://stackoverflow.com/q/22926386
tagged with: file
has comment: http://stackoverflow.com/comment/34996555
has body: I have a few areas that could be the possible source to my issue, and I'm hoping the I am just being stupid and forgetting a small detail. But basically I'm making an app that reads from a data(txt) file and puts that into a hashmap, then it uses that hashmap to get a corresponding integer that goes along with a string. If you're confused it makes more sense in the code. So first when the app loads it calls as one of its first method in the MainActivity class the method firstTime() that returns a true or false: private boolean firstTime() { //checks if the needed folders are in place File storelist = new File(this.getFilesDir() + File.separator +"Stores"); File listnames = new File(this.getFilesDir() + File.separator +"Lists"); System.out.println("Store File: "+new File(storelist+File.separator + "Sample Fresh.txt").getAbsolutePath()); if(storelist.isDirectory() &amp;&amp; listnames.isDirectory() &amp;&amp; new File(storelist+File.separator + "Sample Fresh.txt").exists()){ return false; } else{ return true; } } Then if it returns true it calls an install activity, and that initializes some files, and yes I know the whole array input thing is a big no no but that it besides the point (I hope) I am trying, for the time being, to keep all of the files internal, soon I will move to a server set up but as a sample/beta I want to not have to do that. The following method generateSampleStore is in the InstallActivity class: private File generateSampleStore(String path) { File file = new File(path); FileOutputStream fos = null; try { fos = new FileOutputStream(file,true); } catch (FileNotFoundException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } String array[] = new String[56]; array[0] = "Store Fresh"; array[1] = "1234 Hickory Dr. Philadelphia Pa. 12345"; array[2] = "(123)-555-6789"; array[3] = "24 Hours"; array[4] = "Ketchup Aisle 1"; array[5] = "Salt Aisle 5"; array[6] = "Sugar Aisle 5"; array[7] = "Peanut Butter Aisle 5"; array[8] = "Vanilla Aisle 5…
tagged with: java
type: Question
score: 0
has title: File Empty and returns a null value all the time
has comment: http://stackoverflow.com/comment/34996888
has comment: http://stackoverflow.com/comment/34996705
tagged with: file-io
has comment: http://stackoverflow.com/comment/34996937
tagged with: android
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22896241
tagged with: android
has comment: http://stackoverflow.com/comment/34952786
has answer: http://stackoverflow.com/a/23153214
tagged with: tcp
linked to: http://stackoverflow.com/q/12771360
has comment: http://stackoverflow.com/comment/35001193
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35001600
has comment: http://stackoverflow.com/comment/35003424
tagged with: java
has comment: http://stackoverflow.com/comment/34952551
type: Question
score: 0
has comment: http://stackoverflow.com/comment/35003058
answer count: 1
has title: @Java/Android Socket failed to read message
has body: I have trouble with the Java Sockets. I need to connect a server and a client through the local network and as there can be more then two devices connected to the router the Client must find out the Address of the server. The only way I know to solve this problem is to get the three first numbers of the clients IP(v4)-address and loop every of the 254 other possible IPs. (I know that this way is very slow and may cause many problems. If you know an alternative, I will be glad). Actually the client is an android smartphone so I can get the DHCP-Info. The problem is, that the read command to check if a device is a server will last forever. If you need some code, here it is! code: onCreate: final WifiManager manager = (WifiManager) super.getSystemService(WIFI_SERVICE); final DhcpInfo dhcp = manager.getDhcpInfo(); final String address = intToIp(dhcp.ipAddress); String addresspart=address.substring(0, address.lastIndexOf('.')+1); ArrayList&lt;HashMap&lt;String, String&gt;&gt; l = null; Log.d("Keyboard","initiating search"); try { l = new checkConnections().execute(addresspart).get(); } catch (InterruptedException e1) { e1.printStackTrace(); } catch (ExecutionException e1) { e1.printStackTrace(); } checkConnections: ArrayList&lt;HashMap&lt;String,String&gt;&gt; l=new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); for(int i=1;i&lt;=255;i++){ try { worksocket=new Socket(addresspart[0]+i,61927); workout=new BufferedOutputStream(worksocket.getOutputStream()); workin=new BufferedInputStream(worksocket.getInputStream()); byte[] buffer=new byte[6]; workin.read(buffer);//at this point the app freezes until you stop the serverside program String answer=new String(buffer,"UTF-8"); Log.i("Keyboard","Welcome Message: "+answer); if(answer.equalsIgnoreCase("sdk on")){ HashMap&lt;String,String&gt; hm=new HashMap&lt;String,String&gt;(); hm.put("address",addresspart[0]+i); l.add(hm); workout.write(intToBytes(8)); workout.write("closing".getBytes("UTF-8")); worksocket.close(); continue; …
linked to: http://stackoverflow.com/q/12274551
accepted answer: http://stackoverflow.com/a/23153214
tagged with: sockets

http://stackoverflow.com/comment/35012485
comment on: http://stackoverflow.com/q/22935827
has text: it's not very clear what you want to accomplish, could you please add an example with two real dates and would should the output be?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34881423
has text: Values in tag are changing after few seconds. How do I get to know that?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22863450
type: AnswerComment

http://stackoverflow.com/comment/34797878
comment on: http://stackoverflow.com/q/22816770
type: QuestionComment
score: 0
has text: http://stackoverflow.com/questions/2540548/how-do-i-get-eclipse-to-use-a-different-compiler-version-for-java
type: Comment

http://stackoverflow.com/comment/34839414
score: 0
type: Comment
has text: @Nadun: I think you were missing the context of the question, unfortunately. But again, I don't think it's a good idea to recommend that folks make *all* methods public.
type: AnswerComment
comment on: http://stackoverflow.com/a/22829105

http://stackoverflow.com/comment/35008945
comment on: http://stackoverflow.com/q/22921264
type: Comment
has text: @rpax Indeed. Just create a socket factory that provides sockets whose stream methods return counting streams. A trivial exercise in multiple delegation.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/35003156
type: QuestionComment
has text: @user2357112: No this is not "an English confusion". He merely took a guess at what the phrase meant. That guess was wrong, but the question is what **does** "inherently thread-safe" mean. When you are writing documentation of API or protocols, it's important to be exact.
score: 1
comment on: http://stackoverflow.com/q/22908520
type: Comment

http://stackoverflow.com/q/22820869
tagged with: jpa
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22821204
has body: I used Spring Roo to reverse engineer a MySQL database, a db to which I only have read access. One of the entities called Transaction has a field called originalTransaction, in the DB this is set that it can be null, but that the default value is 0. @RooJavaBean @RooToString @SuppressWarnings("serial") @RooDbManaged(automaticallyDelete = true) @RooJpaActiveRecord(versionField = "", table = "TRANSACTIONS") public class Transaction implements Serializable { .... @Fetch(value = FetchMode.SELECT) @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name = "ORIG_TRANS_ID") private Transaction originalTransaction; .... } FetchMode.Select and FetchType.Lazy I added as workarounds for other problems. Now when I insert a transaction and I leave originalTransaction null, the DB changes it to 0. When I do an entity().find(12345678), I get the following error: Unable to find Transaction with id 0 javax.persistence.EntityNotFoundException: Unable to find Transaction with id 0 at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:157) at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:261) at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:175) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:285) So obviously (which wasn't so obvious initially), it's trying to find the originalTransaction and since the DB changes the null to 0, it's trying to find Transaction with id=0 which doesn't exist - this causes entity.find(12345678) to return null even though the transaction is in the database. Is there any workaround to stop Hibernate / JPA from bailing the search and returning null if the originalTransaction's id in the DB doesn't exist? I'd preferably force it to null if it doesn't exist.
accepted answer: http://stackoverflow.com/a/22821204
has comment: http://stackoverflow.com/comment/34805564
tagged with: spring-roo
has title: @ManyToOne of the same type as parent where child doesn't exist in DB
has comment: http://stackoverflow.com/comment/34818250
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
upvote count: 2

http://stackoverflow.com/comment/34960192
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22906389
has text: Now you are completely unclear as to what exactly steps you took. You replaced the contents of a file, then what? Have you also started over by deleting the previous Run configuration? How exactly do you create the Run configuration? Have you made it work from the command line first? All you give us is your frustration.

http://stackoverflow.com/comment/34940023
type: Comment
comment on: http://stackoverflow.com/a/22895377
has text: @tod Send me your eclipse screenshot and I will guide you how to do
score: 0
type: AnswerComment

http://stackoverflow.com/a/23084314
accepted answer of: http://stackoverflow.com/q/22840829
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22840829
has body: After some time, I decided I'm going to implement a different approach to this particular problem. Since I couldn't find any options on how to do this, I attempted to solve it on a JPA implementation level. Since I use Hibernate, I used Hibernate filters. For Eclipselink users: you can use Eclipselink's Multi tenancy feature. Unfortunately I haven't been able to find a solution on a higher level, so I still have to write a new implementation for this if I were to switch implementations. On the other hand, I probably won't switch to new implementations on a regular basis so that probably won't be an issue.
score: 0

http://stackoverflow.com/a/32273868
has body: I had the same problem and i tried so many thing to work, the only thing that works for me was check the Environment Variables, for this do: Right click on My Computer>Properties Advanced system settings Environment Variables In the field "Environment Variables" search for Path Search for %SystemRoot%; and %SystemRoot%\system32; if you don't see them there, add it on the final of the line (please don't delete the other things there!). That's it.
type: Answer
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22905514

http://stackoverflow.com/a/29161791
score: 13
downvote count: 0
type: Answer
has body: Jersey 1.19 is compatible with JDK 1.8.0. Refer to Jersey 1.19 Release summaryJDK8 support in Jersey 1.19Repackage ASM lib in Jersey 1.19 Please remove asm-3.1.jar since jersey-server-1.19.jar has asm 5.0 repacked in it.
upvote count: 13
answers question: http://stackoverflow.com/q/22917462

http://stackoverflow.com/comment/34974970
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22914929
has text: @Duncan, I just had a word-gasm, nice!

http://stackoverflow.com/comment/35031786
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22946138
has text: I didn't. I just tried it upon your suggestion and looks like you were spot on.. I got "Permission denied". Which is **very** strange to me. My phone **is** rooted *(I've used other root apps fine)*, the Superuser app logs show that it has **Allowed** every single request by my app..
score: 0

http://stackoverflow.com/a/22816764
type: Answer
answers question: http://stackoverflow.com/q/22816564
has comment: http://stackoverflow.com/comment/34817700
score: 1
has comment: http://stackoverflow.com/comment/34798125
upvote count: 1
has body: The target of @Override is METHOD. The second problem is that you don't override all the abstract methods of the superclass (SwingWorker). Verify that doInBackground has the signature same as in the superclass.
has comment: http://stackoverflow.com/comment/34797942
downvote count: 0

http://stackoverflow.com/a/22876868
has comment: http://stackoverflow.com/comment/34906647
has comment: http://stackoverflow.com/comment/34906826
has comment: http://stackoverflow.com/comment/34906908
score: 0
has body: Try This :it is working inside a Action Listener. JButton MM1 = new JButton("BallBoe"); MM1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("panel 2"); } }); or class MainJPanelOperation implements ActionListener You can use class MainJPanelOperation { static JButton MM1; //your code } MM1=new JButton("Button"); MM1.addActionListener(this); write a Method outside Main() public void ActionPerformed(ActionEvent e) { if(e.getSource()==MM1) { System.out.print(""); } if(e.getSource()==Buttonobject) { //your code for button Pressing Event } }
type: Answer
answers question: http://stackoverflow.com/q/22876768

http://stackoverflow.com/comment/34907607
comment on: http://stackoverflow.com/a/22877465
score: 2
has text: Thanks Koitoer for the help. One quick question, suppose if the call is coming from Load Balancer instead of specific machine then this will work as well? I guess not..
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22841383
possible better answer: http://stackoverflow.com/a/22841533
accepted answer: http://stackoverflow.com/a/22841432
has title: how do I convert text to integer in Java
has answer: http://stackoverflow.com/a/22841533
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/5585779
upvote count: 0
has comment: http://stackoverflow.com/comment/34841680
favorite count: 0
has answer: http://stackoverflow.com/a/22841432
score: -3
has body: I am trying to figure out how to convert text from text fields into intergers in Eclipse. here is what I have so far, and it's been a few days since I have worked on this program and I am also new to java coding. If I have the code I need in here already, I apologize in advance for asking this question. protected void do_enterButton_actionPerformed(ActionEvent arg0) { int scr1, scr2, scr3 = -1; TestScores score = (TestScores)studentList.getSelectedValue(); int score1 = Integer.parseInt(score1TextField.getText()); score.setScore1(score1); int score2 = Integer.parseInt(score2TextField.getText()); score.setScore2(score2); int score3 = Integer.parseInt(score3TextField.getText()); score.setScore3(score3); if (score1TextField != null) { // this is where I need to convert to text to integer }
type: AnsweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/34841623

http://stackoverflow.com/comment/34936214
type: AnswerComment
score: 0
type: Comment
has text: Furthermore, when I add a new list for each student then the list need another name than the previous one. Edit: This is not true, I defined it as List<List<String>> preferences = new ArrayList<List<String>>(); instead of preferences = new ArrayList<List<String>>(); Thanks a lot!
comment on: http://stackoverflow.com/a/22893466

http://stackoverflow.com/comment/34788014
has text: As I mentioned in my posting above, this package was added in Java8 (jdk 1.8.0). Maybe you have an older jdk (and jre) installed on your system?
score: 1
comment on: http://stackoverflow.com/a/22810189
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22910424
score: 0
type: Answer
has body: Try this: /** * validate your email address format. Ex-xyz@abc.com */ public boolean emailValidator(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matches(); }
answers question: http://stackoverflow.com/q/22910080

http://stackoverflow.com/comment/34883181
comment on: http://stackoverflow.com/q/22864164
has text: Thanks @Baz . I have done it in the past, but I don't find a way to get the `ui:Field` name in the `Widget`. Maybe I'm just getting blind.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34936124
score: 0
comment on: http://stackoverflow.com/a/22893421
type: Comment
has text: So when using of Collections.synchronizedCollection() is needed? I mean replacing it by ordinary collection constructor will cause bad behaviour/error.
type: AnswerComment

http://stackoverflow.com/comment/35005042
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22931148
has text: Nope. Atleast can i do it if there are no quotes inside quotes? I can ask API provider to wrap everything in single quote and text wont have single quote
type: Comment

http://stackoverflow.com/comment/34861639
score: 0
comment on: http://stackoverflow.com/q/22851999
type: Comment
type: QuestionComment
has text: ```Arrays.copyOf()``` does this for you.

http://stackoverflow.com/comment/34808804
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22822588
has text: You could do this with a JLaywredPane, but you could also do this by setting a Layout anager to the JLabel and adding the buttons to it instead

http://stackoverflow.com/comment/34842000
has text: It seems your example is bad. Your setA method does not reference the member variable a. you are synchronizing on a lock and doing math with the argument provided to the setA method.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22841368
type: QuestionComment

http://stackoverflow.com/comment/35043225
comment on: http://stackoverflow.com/q/22952714
type: QuestionComment
has text: Hi, thanks for the reply. It is amendment number
type: Comment
score: 1

http://stackoverflow.com/a/49344226
answers question: http://stackoverflow.com/q/22914927
has body: Simple solution would be create 'java' folder directly one the drive into src/main even before opening it in eclipse that way eclipse will not complain about the issue.
score: 0
type: Answer

http://stackoverflow.com/a/22850325
downvote count: 0
answers question: http://stackoverflow.com/q/22848204
score: 1
has body: "knowing that the source code is locked in the initComponent private function" You can edit the auto-generated source code, as see here in this answer. "that displays this jpanel form when i click on it. is it possible to perform this using the palette design" Sounds like you want to swap views. You can do that using CardLayout and yes, it can be done from the design view. You can see more at How to Use CardLayout with Netbeans GUI Builder
upvote count: 1
type: Answer

http://stackoverflow.com/comment/34930314
comment on: http://stackoverflow.com/q/22887624
score: 0
type: QuestionComment
type: Comment
has text: Hi Juneyong thank you for being interested!

http://stackoverflow.com/q/22830206
favorite count: 0
has comment: http://stackoverflow.com/comment/34822879
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22835331
tagged with: android
has body: I made a simple video recorder app in which the video starts recording on Button click. This is my code: package com.example.videocapture2; import java.io.IOException; import android.app.Activity; import android.content.pm.ActivityInfo; import android.media.CamcorderProfile; import android.media.MediaRecorder; import android.os.Bundle; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.Toast; public class MainActivity extends Activity implements SurfaceHolder.Callback,android.media.MediaRecorder.OnInfoListener{ MediaRecorder recorder; SurfaceHolder holder; Button Rec = null; boolean recording = false; int count =1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); recorder = new MediaRecorder(); initRecorder(); setContentView(R.layout.activity_main); SurfaceView cameraView = (SurfaceView) findViewById(R.id.videoview); holder = cameraView.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); recorder.start(); //This is the line pointed to by the IllegalStateException //cameraView.setClickable(true); // cameraView.setOnClickListener(this); Rec = (Button)findViewById(R.id.mybutton); Rec.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (recording) { recorder.stop(); recording = false; // Let's initRecorder so we can record again initRecorder(); prepareRecorder(); } else { recording = true; recorder.start(); } } }); } private void initRecorder() { recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); recorder.setVideoSou…
tagged with: java
has title: Unable to start the recorder in Oncreate
has comment: http://stackoverflow.com/comment/34825311
type: Question
tagged with: android-mediarecorder
linked to: http://stackoverflow.com/q/13596659
score: 0
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/34878499
type: AnswerComment
score: 0
has text: People don't usually use triangle_fan . It's not a bad approach, but it can be missleading at times. The most use method is from OGL2.0 and is drawprimitives with indexses. You can use triangle fan method, just make sure to know how the triangles are drawn (in what order, and what vertices they take).
type: Comment
comment on: http://stackoverflow.com/a/22840308

http://stackoverflow.com/a/22882770
has comment: http://stackoverflow.com/comment/34929847
has comment: http://stackoverflow.com/comment/34917185
has comment: http://stackoverflow.com/comment/34917773
downvote count: 0
has body: You drop the first read of data on the floor in this line: int receivedBytes = inStream.read(buffer, 0, buffer.length); Not really sure what that line of code is for (old debugging?). You basically just need to remove it. UPDATE: You seem to indicate that you are sending additional metadata at the beginning of the stream. My guess is that you are using some sort of BufferedInputStream/Reader when reading the initial metadata, and that is swallowing part of the subsequent file data. You can somewhat solve this problem by wrapping the DataInputStream around the BufferedInputStream you are using to read the metadata. You have to be careful, however, that whatever you are using to read the metadata doesn't read more data than it should. It's actually trickier to do this than you might think. You might want to look at using the DataInput/Output streams exclusively (use writeUTF/readUTF to handle the file name and writeLong/readLong to handle the file size).
type: AcceptedAnswer
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/22882430
upvote count: 3
has comment: http://stackoverflow.com/comment/34937015
answers question: http://stackoverflow.com/q/22882430

http://stackoverflow.com/q/22917228
score: 3
has title: Working with scoped beans when the scope is optional?
has comment: http://stackoverflow.com/comment/34979240
tagged with: configuration
has body: I have a scope which sometimes doesn't exist when I need some bean from it. That in itself isn't a problem; I could use defaults for these cases. My problem is with autowiring. The scenarios goes roughly like this: I have a scoped bean ICurrentLocale. It's scope is User and the scope depends on whether a user is currently logged in. Autowire bean foo contains a field @Autowired ICurrentLocale currentLocale; Call some methods on foo. A user logs in. Now, I have a scope User Call some methods on foo. My problem is that in point #5, the autowired ICurrentLocale bean is still the same despite the fact that a new bean has created in the user's scope. Is there a good/simple/understandable way to build a spring configuration that automatically rewires beans when a new scope is entered in the same thread? Or maybe I can ask Spring to "refresh" the proxy? EDIT Here is my current implementation of the scope: @Override public Object get( String name, final ObjectFactory&lt;?&gt; objectFactory ) { CurrentUserSession currentSession = userSessionFactory.getCurrentSession(); if( currentSession == null ) { if( isLocaleProvider( name ) ) { return createLocaleProvider(); } throw new BeanCreationException( "Could not create bean " + name + " the bean scope " + NAME + " can be used only after the user has signed in" ); } Object bean = currentSession.getBean(name, objectFactory); return bean; } As you can see, I create a dummy bean as long as no user is logged in. If I have a session, I look into the cache in the session. If the bean doesn't exist, yet, I use the objectFactory to create a new one.
tagged with: scope
has answer: http://stackoverflow.com/a/22957484
upvote count: 3
answer count: 2
favorite count: 0
tagged with: spring
possible better answer: http://stackoverflow.com/a/22957484
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35003883
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22947739
accepted answer: http://stackoverflow.com/a/22947739
type: Question

http://stackoverflow.com/q/22939467
type: AnsweredQuestion
has body: I have a Program as shown below in which i am checking the open value with different conditions (to how much extent the buyer price is greater than or less than open price ) Is there any better way to handle this package com; import java.sql.Time; import java.text.SimpleDateFormat; import java.util.Date; public class Test extends Thread { public static void main(String[] args) { double firstbuyer1 = 1.34; double firstbuyer2 = 2.34; double firstbuyer3 = 3.45; double firstbuyer4 = 2.45; double firstbuyer5 = 1.50; double open = 3.40; int positivevalue =0; int lessthan2 =0; // checking the positive conditions if(firstbuyer1==open||firstbuyer1-open&lt;0.50) { positivevalue = positivevalue+1; } if(firstbuyer2==open||firstbuyer1-open&lt;0.50) { positivevalue = positivevalue+1; } if(firstbuyer3==open||firstbuyer1-open&lt;0.50) { positivevalue = positivevalue+1; } if(firstbuyer4==open||firstbuyer1-open&lt;0.50) { positivevalue = positivevalue+1; } if(firstbuyer5==open||firstbuyer1-open&lt;0.50) { positivevalue = positivevalue+1; } // // checking the negative conditions if(firstbuyer1-open&lt;2) { lessthan2 = lessthan2; } if(firstbuyer2-open&lt;2) { lessthan2 = lessthan2+1; } if(firstbuyer3-open&lt;2) { lessthan2 = lessthan2+1; } if(firstbuyer4-open&lt;2) { lessthan2 = lessthan2+1; } if(firstbuyer5-open&lt;2) { lessthan2 = lessthan2+1; } // similarly i need to write for lessthan 3 , lessthan 4 , lessthan 5 } } Thanks in advance .
tagged with: java
has comment: http://stackoverflow.com/comment/35019270
type: Question
has comment: http://stackoverflow.com/comment/35019323
has answer: http://stackoverflow.com/a/22939921
has answer: http://stackoverflow.com/a/22939689
score: 0
has comment: http://stackoverflow.com/comment/35019352
has answer: http://stackoverflow.com/a/22940087
has comment: http://stackoverflow.com/comment/35019491
possible better answer: http://stackoverflow.com/a/22940122
has title: How can i eliminate the if conditions in this scenario
has answer: http://stackoverflow.com/a/22939530
has answer: http://stackoverflow.com/a/22940122
accepted answer: http://stackoverflow.com/a/22939689
answer count: 5

http://stackoverflow.com/comment/34792658
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22812744
has text: But you should strictly avoid nested forms

http://stackoverflow.com/comment/35060589
comment on: http://stackoverflow.com/a/22943571
has text: That works, thanks! I realized that if I set the solver explicitly to QF_LIA I get that error. I haven't given a thorough thought about why but I assume set variables don't work in LIA.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22870278
score: 1
favorite count: 0
type: UnansweredQuestion
answer count: 0
tagged with: cookies
tagged with: java
has body: I added 'secure' tag to my session-config in web.xml 30 true So it forces all cookies created by the server to be used ONLY in secure connection (HTTPS). Yet these cookies still work if I open my web app using HTTP protocol. While using HTTP Firebug shows that 'Secure' flag was set on cookies that were placed by the server (I'm not talking about the ones that were created by JavaScript). THE PROBLEM: In my understanding if I force all server cookies to be secure they should not be used on HTTP at all. So I shouldn't be able to log into my app or do anything that requires session. Yet application still works via HTTP with NO PROBLEM at all... Where am I wrong?
has comment: http://stackoverflow.com/comment/34897082
upvote count: 1
has comment: http://stackoverflow.com/comment/34897108
has title: Java / Web: I force 'Secure' flag on cookies however they still work when HTTP is used. Why?
tagged with: https
type: Question
has comment: http://stackoverflow.com/comment/34894082
tagged with: security
downvote count: 0

http://stackoverflow.com/comment/34831661
type: Comment
type: QuestionComment
score: 2
has text: Please look at the link http://stackoverflow.com/questions/1514910/when-comparing-two-integers-in-java-does-auto-unboxing-occur
comment on: http://stackoverflow.com/q/22835674

http://stackoverflow.com/a/22943547
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22943514
has body: Your method is not in a class. It should be like this: public class FibonacciWord{ public static void main(String[] args){ if (args.length &lt; 3) System.exit(1); int N=Integer.parseInt(args[2]); System.out.println(fibonacci(N,args[0],args[1])); } public String fibonacci(int N, String a, String b){ if (N==0) return a; return fibonacci(N-1,a+b,a); } }
upvote count: 1

http://stackoverflow.com/comment/34971905
has text: Yes I bet i should Balwinder Singh.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22913321

http://stackoverflow.com/comment/35355923
comment on: http://stackoverflow.com/q/22966155
has text: @jeroen_de_schutter i have mentioned the problem now
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22950016
tagged with: java
tagged with: servlets
type: Question
has title: Servlet doesn't execute response.sendRedirect(addressPath); , but does execute response.sendRedirect() without path
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22950035
tagged with: jsp
tagged with: tomcat
tagged with: web-applications
has answer: http://stackoverflow.com/a/22950035
possible better answer: http://stackoverflow.com/a/22950077
has body: Consider the following hierarchy : When I send redirect like this : response.sendRedirect("error404.jsp"); // no path here !!! I reach the page error404.jsp . But when I use a path : String addressPath = "/WEB-INF/results/admin/adminPage.jsp"; response.sendRedirect(addressPath); // with path !!! I get 404 : HTTP Status 404 - type Status report message description The requested resource is not available. Apache Tomcat/7.0.50 What am I doing wrong here ? Much appreciated !
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22950077

http://stackoverflow.com/q/22966069
type: Question
has title: Struts2 Date Tag TimeZone behavior
tagged with: date
tagged with: struts2
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22967666
favorite count: 0
tagged with: timezone
accepted answer: http://stackoverflow.com/a/22967666
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: utc
has body: I am using <s:date> tag of struts2. To convert a date stored 04/09/2014 11:40:17 in UTC time to IST time I used struts2 date tag as belows : <s:date name = "dateregistered" format = "MM/dd/yyyy HH:mm:ss a" timezone = "GMT+5.30" /> and it always give me the date: 04/09/2014 06:10:17 AM. The expected result should be: 04/09/2014 05:10:17 PM. I am not getting where I am wrong and doing mistake,I am using hibernate to fetch and java.util.date to store the value which is used above The process how data was stored and retrived: I stored value in mysql through hibernate: TimeZone.setDefault(TimeZone.getTimeZone("Etc/UTC")); user.setCreatedDateTime(new java.util.Date()); ... ... ... Now I am getting the value from DB as 04/09/2014 11:40:17 . When I performed this insertion the actual time was 04/09/2014 05:10:17 PM IST . So it clears that the time being stored in DB is UTC time. Now I am retriving time and setting in map in key value pair as map.put("dateregistered",c.getCreatedDateTime()); user.getCreatedDateTime() and retrieving value using struts 2 tag as mentioned above
upvote count: 1

http://stackoverflow.com/a/22918247
type: Answer
answers question: http://stackoverflow.com/q/22917631
has body: What you describe is not feasible in XSD 1.0. In XSD 1.1 you can use assertions on the type of the parent to require each child's id attribute to begin with the value of the parent's id attribute.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35246449
upvote count: 2
has comment: http://stackoverflow.com/comment/35335971
has comment: http://stackoverflow.com/comment/35332673

http://stackoverflow.com/comment/120208404
comment on: http://stackoverflow.com/a/65842502
type: AnswerComment
has text: Should we commit this file or ignore it? Thanks
score: 3
type: Comment

http://stackoverflow.com/comment/115142489
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22937436
type: Comment
has text: This is not a homework-writing service. You need to find the logic in this list and then duplicate it with code.

http://stackoverflow.com/comment/35014959
score: 0
type: QuestionComment
type: Comment
has text: sure about the filenames ?? I found "CA" before the names..??
comment on: http://stackoverflow.com/q/22923699

http://stackoverflow.com/comment/34815459
comment on: http://stackoverflow.com/q/22826449
has text: This is a pretty intense problem for a 12th grade CS class.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22952316
type: Question
has comment: http://stackoverflow.com/comment/35108478
tagged with: stomp
tagged with: spring-websocket
downvote count: 0
tagged with: websocket
has comment: http://stackoverflow.com/comment/35292140
has comment: http://stackoverflow.com/comment/35289947
has comment: http://stackoverflow.com/comment/35131371
answer count: 1
has body: I'm trying to send messages to my topic, but the problem is when I send the message nothing happens... I'm using apache tomcat 7.0.53 UPDATE: 04/15: Link to test: http://ec2-54-187-72-145.us-west-2.compute.amazonaws.com:8080/kupo Login: admin Password: admin LINK TO ACCESS TOMCAT LOG: http://ec2-54-187-72-145.us-west-2.compute.amazonaws.com:28778/ P.S: You need to checked the combobox on the sidebar to start watch the messages Github Link: https://github.com/tiarebalbi/kupo LOG: DEBUG - gWebSocketHandlerDecorator - Connection established, SockJS session id=_mqg8qer, uri=/kupo/application/807/_mqg8qer/websocket DEBUG - StompDecoder - Decoded [Payload byte[0]][Headers= {stompCommand=CONNECT, nativeHeaders={heart-beat=[10000,10000], accept-version=[1.1,1.0]}, simpMessageType=CONNECT, id=e79a615e-5522-a0f9-aecf-6ea5a54b3d9b, timestamp=1397013491497}] DEBUG - StompEncoder - Encoded STOMP command=CONNECTED headers={user-name=[balbi], heart-beat=[0,0], version=[1.1]} DEBUG - StompDecoder - Decoded [Payload byte[0]][Headers={stompCommand=SUBSCRIBE, nativeHeaders={id=[sub-0], destination=[/topic/greetings]}, simpMessageType=SUBSCRIBE, simpSubscriptionId=sub-0, simpDestination=/topic/greetings, id=42c2019d-96a0-95f0-29aa-2bcc62d6d721, timestamp=1397013491501}] CODE: @Service public class ExampleServiceImpl implements ApplicationListener<BrokerAvailabilityEvent> { private AtomicBoolean brokerAvailable = new AtomicBoolean(); @Autowired private MessageSendingOperations<String> messagingTemplate; @Override public void onApplicationEvent(BrokerAvailabilityEvent event) { this.brokerAvailable.set(event.isBrokerAvailable()); } @Scheduled(fixedDelay=3000) public void testing() { if (this.brokerAvailable.get()) { this.messagingTemplate.convertAndSend("/topic/greetings", "Testing...."); } } Javascript Connect: var socket = new SockJS('/kupo/application'); // <!-- My endpoint var stompClient = Stomp.over(socket); stompClient.connect({}, function(frame) { var username = frame.headers['use…
has answer: http://stackoverflow.com/a/23093452
has title: Error on Delivery Message on Spring WebSocket using StompClient
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35167519
tagged with: spring
has comment: http://stackoverflow.com/comment/35183246
has comment: http://stackoverflow.com/comment/35287614
score: 2
has comment: http://stackoverflow.com/comment/35289378
tagged with: java
has comment: http://stackoverflow.com/comment/35174069

performance
tags question: http://stackoverflow.com/q/22866345
tags question: http://stackoverflow.com/q/22876139
tags question: http://stackoverflow.com/q/22884863
tags question: http://stackoverflow.com/q/22940814
tags question: http://stackoverflow.com/q/22821711
tags question: http://stackoverflow.com/q/22891441
tags question: http://stackoverflow.com/q/22865822
tags question: http://stackoverflow.com/q/22867038
tags question: http://stackoverflow.com/q/22863844
tags question: http://stackoverflow.com/q/22873669
tags question: http://stackoverflow.com/q/22916636
tags question: http://stackoverflow.com/q/22868602
tags question: http://stackoverflow.com/q/22966029
tags question: http://stackoverflow.com/q/22879001
tags question: http://stackoverflow.com/q/22878501
tags question: http://stackoverflow.com/q/22951325
tags question: http://stackoverflow.com/q/22962829
tags question: http://stackoverflow.com/q/22923505
tags question: http://stackoverflow.com/q/22840189
tags question: http://stackoverflow.com/q/22874129
tags question: http://stackoverflow.com/q/22896275
tags question: http://stackoverflow.com/q/22905919
tag name: performance
tags question: http://stackoverflow.com/q/22923370
tags question: http://stackoverflow.com/q/22905620
tags question: http://stackoverflow.com/q/22913122
tags question: http://stackoverflow.com/q/22899339
tags question: http://stackoverflow.com/q/22960234
type: Tag
tags question: http://stackoverflow.com/q/22897738
tags question: http://stackoverflow.com/q/22905938
tags question: http://stackoverflow.com/q/22924174
tags question: http://stackoverflow.com/q/22903804
tags question: http://stackoverflow.com/q/22818433
tags question: http://stackoverflow.com/q/22828941

http://stackoverflow.com/a/22898870
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22898484
upvote count: 1
has body: You should move your code to work in a different thread (in this case Asynctask) AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers. AsyncTask is designed to be a helper class around Thread and Handler and does not constitute a generic threading framework. AsyncTasks should ideally be used for short operations (a few seconds at the most.) If you need to keep threads running for long periods of time, it is highly recommended you use the various APIs provided by the java.util.concurrent pacakge such as Executor, ThreadPoolExecutor and FutureTask. An asynchronous task is defined by a computation that runs on a background thread and whose result is published on the UI thread. An asynchronous task is defined by 3 generic types, called Params, Progress and Result, and 4 steps, called onPreExecute, doInBackground, onProgressUpdate and onPostExecute. It's how you could write it: private class AsyncRequest extends AsyncTask&lt;String, Void, String&gt; { // private because if someone calls this method without the syntax i said the exception will appear again private String yandex_translate(String yandex_lang,String yandex_text) throws IOException, ParseException { String yandex_key = "****"; String yandex_url = "https://translate.yandex.net/api/v1.5/tr.json/translate?key="+yandex_key+"&amp;lang="+yandex_lang+"&amp;text="+yandex_text; URL url = new URL(yandex_url); URLConnection httpUrlConnection = url.openConnection(); InputStream inputStream = httpUrlConnection.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); String line=bufferedReader.readLine(); JSONParser parser = new JSONParser(); JSONObject jsonObject = (JSONObject) parser.parse(line);; JSONArray msg = (JSONArray)jsonObject.get("text"); if(jsonObject.get("code").toString().equals("200")){ return msg.get(0).toString(); }e…

http://stackoverflow.com/a/22847546
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34853871
accepted answer of: http://stackoverflow.com/q/22847390
answers question: http://stackoverflow.com/q/22847390
upvote count: 1
type: AcceptedAnswer
has body: Subtract the frame's X and Y screen positions from the screen mouse coordinate to get the offset in the frame, or add a proper MouseListener to the frame itself, which will provide mouse position in window client coordinates. The listener approach is generally better anyways, as it means you can also, e.g., add other components to your window without affecting mouse code; it keeps everything self-contained in the game frame.

http://stackoverflow.com/q/22854666
favorite count: 0
tagged with: ejb-3.0
upvote count: 2
has title: Deploy EJB 3 as separate project and access through the servlet in Websphere 7
type: UnansweredQuestion
has body: I have created sample EJB 3 application with annotation in WebSphere 7. It is like this. The local interface @Local public interface ICalLocalBean{ public int add(int a, int b); } Implementation of EJB. @Stateless public class CalcEJBean implements ICalLocalBean { @Override public int add(int a, int b) { return a + b; } } Access the EJB inside the servlet. public class CalcServlet extends HttpServlet { private static final long serialVersionUID = 1L; @EJB private ICalLocalBean iCalLocalBean; ... } I have added the EJB module as a deployment assembly in my client project EAR. I can success fully call the add method in this way. But I want to deploy this EJB module as separate application in WebSphere server and call the add method. How can I do this. Please help me ...
score: 2
tagged with: java
type: Question
tagged with: jakarta-ee
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22865031

http://stackoverflow.com/comment/34929642
score: 5
has text: There's a lot of _want_. What have you actually done?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22889759

http://stackoverflow.com/comment/34883561
score: 2
comment on: http://stackoverflow.com/q/22847805
type: Comment
type: QuestionComment
has text: That sounds like you are running the CLI command wrong. Can you post the exact command you are running? Are you calling it on a real CLI or are you running it from another application (such as your IDE)?

http://stackoverflow.com/comment/35014102
score: 0
type: Comment
type: QuestionComment
has text: Create an abstract class defining all the methods you don't need?, Or, since both are the same, just affect your anonymous class to a `private static final MouseListener` and reuse that where needed
comment on: http://stackoverflow.com/q/22936774

http://stackoverflow.com/comment/34821636
has text: `${data.question}` outside the `for-each` loop will hold the value for the current iteration alone
comment on: http://stackoverflow.com/q/22829448
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22897779
upvote count: 2
answers question: http://stackoverflow.com/q/22897469
type: Answer
has body: If I were you I'd add put those JLabels inside of a JPanel with a boxlayout then align that with a border layout. Here is some code to help you out: JLabel outer = new JLabel(); outer.setLayout(new BorderLayout(0,0)); /** Add inner JLabels here. The other you add them is the order they will appear from to right**/ JPanel bookshelf = new JPanel(); bookshelf.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS)); //Add your jlabels to the bookshelf outer.add(bookshelf, BorderLayout.SOUTH); Here is a great tutorial on layout managers. Also here is a UI I designed which is similar to what I think you want. Hope this helps you out.
downvote count: 0
score: 2

http://stackoverflow.com/a/22847143
type: Answer
has comment: http://stackoverflow.com/comment/34852522
has comment: http://stackoverflow.com/comment/34889343
has comment: http://stackoverflow.com/comment/34890443
has comment: http://stackoverflow.com/comment/34889758
has body: You can either use a LinkedHashSet and insert each item in exactly the same order that you want them back, or you can provide a custom Comparator to your TreeSet to sort "normally" (whatever that means for your implementation) but to consider part number as occurring before anything else. If the objects you are putting into your TreeSet implement Comparable, then you can override the compareTo method to add the special handling for part number. To implement a Comparator, it would look something like this: import java.util.Comparator; public class MyComparator implements Comparator&lt;MyDomainClass&gt; { @Override public int compare(MyDomainClass o1, MyDomainClass o2) { // compare the objects here and return a negative integer, zero, // or a positive integer as the first argument is less than, equal // to, or greater than the second return 0; // stub } } And then when you create your TreeSet, you could pass the custom Comparator in as an argument to the contructor: TreeSet&lt;MyDomainClass&gt; ts = new TreeSet&lt;MyDomainClass&gt; (new MyComparator());
has comment: http://stackoverflow.com/comment/34852381
has comment: http://stackoverflow.com/comment/34855008
has comment: http://stackoverflow.com/comment/34855811
score: 0
upvote count: 1
answers question: http://stackoverflow.com/q/22847052
downvote count: 1
has comment: http://stackoverflow.com/comment/34852770
has comment: http://stackoverflow.com/comment/34889382

http://stackoverflow.com/comment/35033128
has text: That's what I thought. Also, the casting is present in the book, which is why I put it here, although it is probably more implementation detail that could have been left out.
type: Comment
comment on: http://stackoverflow.com/a/22946968
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34937015
score: 0
type: AnswerComment
type: Comment
has text: Works now! Just changed the readers and writers to DataInput- and OutputStreams and it works! Thank you!
comment on: http://stackoverflow.com/a/22882770

http://stackoverflow.com/a/22849604
score: 5
has body: Just as an add-on, in Java 8, one can do the sum of squares of first 10 natural numbers as follows: int sum = IntStream.rangeClosed(1, 10).map(n -&gt; n * n).sum();
answers question: http://stackoverflow.com/q/22849505
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/a/22942162
answers question: http://stackoverflow.com/q/22941998
upvote count: 1
has body: It won't cause a memory problem, because you are only creating a pointer not creating a new object.
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/22923422
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34991859
answers question: http://stackoverflow.com/q/22922368
has comment: http://stackoverflow.com/comment/34991513
has comment: http://stackoverflow.com/comment/34991492
type: Answer
has comment: http://stackoverflow.com/comment/34991259
has body: Given what you already have, the issues are that you haven't added the label, and you haven't set its bounds. For instance: this.add(label); label.setBounds(130, 10, 140, 80); I will second MadProgrammer's recommendations though -- use nested layout managers to achieve what you want, instead of precomputing the pixel values.
has comment: http://stackoverflow.com/comment/34991949
has comment: http://stackoverflow.com/comment/34991344
score: 0
accepted answer of: http://stackoverflow.com/q/22922368

http://stackoverflow.com/comment/35045988
comment on: http://stackoverflow.com/q/22953533
type: Comment
score: 0
has text: Look, you have to fix something. The errors you are reporting don't match the JSON or POJO you've posted. And you say `feedDateTime` is a `DateTime` when it appears as a `Date` in your code. What is right? What is wrong? Please clarify _everything_.
type: QuestionComment

http://stackoverflow.com/comment/34952953
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22902594
has text: yes i keep getting out of bounds exception
score: 0

http://stackoverflow.com/a/22956993
type: Answer
has body: This works for me : import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class SendMail { public static void sendEmail(String to) { final String username = "your_usename_goes_here"; final String password = "your_password_goes_here"; Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("fromSomeone@gmail.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to)); message.setSubject("A testing mail header !!!"); 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); System.out.println("Username or Password are incorrect ... exiting !"); } } public static void main(String[] args) { String to = "toSomeone@gmail.com"; sendEmail(to); } }
has comment: http://stackoverflow.com/comment/72947408
answers question: http://stackoverflow.com/q/22955142
has comment: http://stackoverflow.com/comment/40887342
upvote count: 9
score: 9
downvote count: 0

http://stackoverflow.com/comment/35066909
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22966195
has text: @Karna I explain it on picture below, The numbers in the picture is for instance.

http://stackoverflow.com/comment/34851849
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22846727
type: Comment
has text: If you mean the value you're getting from `getPhrase()`, you could add a `toUpperCase()` call after `getPhrase()`.

finalize
type: Tag
tags question: http://stackoverflow.com/q/22860268
tag name: finalize
tags question: http://stackoverflow.com/q/22922170

http://stackoverflow.com/comment/55057887
type: Comment
has text: i am a bit surprised the SDK does not provide such functionality
comment on: http://stackoverflow.com/a/28903980
type: AnswerComment
score: 0

http://stackoverflow.com/a/22936209
has comment: http://stackoverflow.com/comment/35060803
upvote count: 1
has body: Looking at your code in jsp, you need to make sure that your form and its properties are as below: public class Policydocumentsetform implements Serializable{ ... //I would rather go with List private ArrayList&lt;Document&gt; documentList; ... } where document is the bean containing: public class Document implements Serializable{ ... private String txtDisableCheckBox; private String ynChkBox; ... } Try this way: &lt;c:forEach var="document" items="${policydocumentsetform.documentList}" varStatus="documentStatus"&gt; &lt;c:if test="${document.txtDisableCheckBox=='N'}"&gt; &lt;form:checkbox path="document[${documentStatus.index}].ynChkBox" cssClass="genradio" value="-1" onclick="selectCheckBox(event.keyCode,this)"/&gt; &lt;/c:if&gt; &lt;/c:forEach&gt;
has comment: http://stackoverflow.com/comment/35046306
has comment: http://stackoverflow.com/comment/35065932
has comment: http://stackoverflow.com/comment/35015917
has comment: http://stackoverflow.com/comment/35061476
has comment: http://stackoverflow.com/comment/35016524
has comment: http://stackoverflow.com/comment/35061323
downvote count: 0
has comment: http://stackoverflow.com/comment/35017480
type: Answer
answers question: http://stackoverflow.com/q/22935136
score: 1

image
tags question: http://stackoverflow.com/q/22850157
tags question: http://stackoverflow.com/q/22824041
tags question: http://stackoverflow.com/q/22941341
tags question: http://stackoverflow.com/q/22856814
tags question: http://stackoverflow.com/q/22830917
tags question: http://stackoverflow.com/q/22884435
tags question: http://stackoverflow.com/q/22899956
tags question: http://stackoverflow.com/q/22917709
tags question: http://stackoverflow.com/q/22964645
tags question: http://stackoverflow.com/q/22823129
tags question: http://stackoverflow.com/q/22941621
tags question: http://stackoverflow.com/q/22948896
tags question: http://stackoverflow.com/q/22814456
tags question: http://stackoverflow.com/q/22830489
tags question: http://stackoverflow.com/q/22923518
tags question: http://stackoverflow.com/q/22953915
tags question: http://stackoverflow.com/q/22821073
tags question: http://stackoverflow.com/q/22838381
tags question: http://stackoverflow.com/q/22966109
tags question: http://stackoverflow.com/q/22869946
tags question: http://stackoverflow.com/q/22856461
tags question: http://stackoverflow.com/q/22834065
tags question: http://stackoverflow.com/q/22962344
tags question: http://stackoverflow.com/q/22848829
tags question: http://stackoverflow.com/q/22907869
tags question: http://stackoverflow.com/q/22882764
tags question: http://stackoverflow.com/q/22850721
tags question: http://stackoverflow.com/q/22897146
tags question: http://stackoverflow.com/q/22903232
tags question: http://stackoverflow.com/q/22931476
tags question: http://stackoverflow.com/q/22878601
tag name: image
tags question: http://stackoverflow.com/q/22955482
tags question: http://stackoverflow.com/q/22874109
tags question: http://stackoverflow.com/q/22857985
tags question: http://stackoverflow.com/q/22894154
tags question: http://stackoverflow.com/q/22943972
tags question: http://stackoverflow.com/q/22938047
tags question: http://stackoverflow.com/q/22922301
tags question: http://stackoverflow.com/q/22868978
tags question: http://stackoverflow.com/q/22936576
tags question: http://stackoverflow.com/q/22896582
type: Tag

http://stackoverflow.com/comment/34957628
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22861853
type: Comment
has text: Object item = ((IStructuredSelection) selection).getFirstElement();

http://stackoverflow.com/q/22889075
tagged with: memory-management
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/42820205
has comment: http://stackoverflow.com/comment/34928486
tagged with: java
has title: Do unclosed streams cause memory leaks in java?
upvote count: 18
has answer: http://stackoverflow.com/a/22889202
type: Question
answer count: 3
downvote count: 0
score: 18
favorite count: 0
has body: I believe open streams cause memory leak in java (at least java 1.6 and earlier did had this problem). But, while searching (even here), I found some people agreeing with this while others do not. So, if I write this program: import java.io.*; public class CreatingMemoryLeak { public static void main(String args[]) { String s = "xxxxxxx"; InputStream in = new ByteArrayInputStream(ss.getBytes()); BufferedInputStream bf = new BufferedInputStream(in); try { while(bf.read()&gt;0) { System.out.println("got it"); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Here is a input stream " + s +" causing a memory leak"); } } and if I do not close the bf stream explicitly, will it cause a memory leak?
tagged with: memory-leaks
has answer: http://stackoverflow.com/a/22889178

http://stackoverflow.com/comment/34842767
type: AnswerComment
has text: I forgot to say that i do not have a provider. i need an provider finally, i have emailFrom Subject and Message, and need send this email how?
type: Comment
comment on: http://stackoverflow.com/a/22841818
score: 0

http://stackoverflow.com/q/22833307
score: -1
duplicate of: http://stackoverflow.com/q/10382929
answer count: 3
has answer: http://stackoverflow.com/a/22833389
linked to: http://stackoverflow.com/q/10382929
favorite count: 0
has answer: http://stackoverflow.com/a/22833626
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22834274
tagged with: java
downvote count: 2
tagged with: selenium
has comment: http://stackoverflow.com/comment/34827665
upvote count: 1
has title: Unsupported minor.major version 51.0
type: Question
has body: While running Java program it is giving me and minor.major version mismatch error. I have JRE6.0 installed in my PC and no JDK version installed. The exception which I am getting is: Exception in thread "main" java.lang.UnsupportedClassVersionError: otaclient/ClassFactory : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at Intergrate.main(Intergrate.java:13) Thanks in advance.

http://stackoverflow.com/q/22939407
has answer: http://stackoverflow.com/a/22951716
has title: Android Adding buttons
has comment: http://stackoverflow.com/comment/35019357
score: 0
answer count: 1
tagged with: processing
has comment: http://stackoverflow.com/comment/35021070
has comment: http://stackoverflow.com/comment/35022058
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35033484
has comment: http://stackoverflow.com/comment/35034610
has body: im trying to do android App with GUI to control arduino using apwidgets library . now i have 4 buttons side by side .. but i want to add more buttons under each of them.( i mean i want to add button under of RED button and so on . but idont know this language . can you help me ? //Setup GUI******************************** buttonWidth=((width/n)-(n*gap)); buttonHeight=(height/2); widgetContainer = new APWidgetContainer(this); //create new container for widgets redButton =new APButton((buttonWidth*(n-4)+(gap*1)), gap, buttonWidth, buttonHeight, "RED"); //Create a RED button greenButton = new APButton((buttonWidth*(n-3)+(gap*2)), gap, buttonWidth, buttonHeight, "GREEN"); //Create a GREEN button blueButton = new APButton((buttonWidth*(n-2)+(gap*3)), gap, buttonWidth, buttonHeight, "BLUE"); //Create a BLUE button offButton = new APButton((buttonWidth*(n-1)+(gap*4)), gap, buttonWidth, buttonHeight, "OFF"); //Create a OFF button widgetContainer.addWidget(redButton); //place red button in container widgetContainer.addWidget(greenButton); //place green button in container widgetContainer.addWidget(blueButton);//place blue button in container widgetContainer.addWidget(offButton);//place off button in container background(0); //Start with a black background
tagged with: button
type: Question
tagged with: android

http://stackoverflow.com/a/22838730
type: Answer
has body: Also I don't know if "Java" in your package name is supposed to be capitalized or not. Seems like the compiler is expecting a lower case 'J' from your naming convention
answers question: http://stackoverflow.com/q/22838489
score: 0

http://stackoverflow.com/q/22960901
has body: I'm writing a DAL with Spring Data and Hibernate but I'm running into a IllegalArgumentException exception which is stopping my work. Here is the DALConf.java class which contains DataSource and persistence exception translation processor configurations package my.dal.config; 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.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.core.env.Environment; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; @Configuration @ComponentScan(basePackages = { "my.dal" }) @PropertySource("classpath:dbconnection.properties") public class DALConfig { private static final String PROPERTY_NAME_DATABASE_DRIVER = "db.driver"; 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 final String PROPERTY_NAME_POOL_INITIAL_SIZE = "pool.initialsize"; private static final String PROPERTY_NAME_POOL_MAX_IDLE = "pool.maxidle"; @Resource private Environment environment; @Bean public DataSource dataSource() throws Exception { Properties props = new Properties(); props.put("driverClassName", environment.getProperty(PROPERTY_NAME_DATABASE_DRIVER)); props.put("url", environment.getProperty(PROPERTY_NAME_DATABASE_URL)); props.put("username", environment.getProperty(PROPERTY_NAME_DATABASE_USERNAME)); props.put("password", environment.getProperty(PROPERTY_NAME_DATABASE_PASSWORD)); props.put("initialSize", environment.getProperty(PROPERTY_NAME_POOL_INITIAL_SIZE)); props.put("maxIdle", enviro…
tagged with: illegalargumentexception
answer count: 3
has answer: http://stackoverflow.com/a/22961646
downvote count: 0
has answer: http://stackoverflow.com/a/22980543
favorite count: 0
has title: Spring 4 + Hibernate 4 IllegalArgumentException: Property 'sessionFactory' is required
tagged with: sessionfactory
accepted answer: http://stackoverflow.com/a/22961646
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: spring-data
has answer: http://stackoverflow.com/a/22963785
type: Question
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/22963785

http://stackoverflow.com/comment/34874798
type: Comment
type: QuestionComment
has text: Could you expand please? My java skills are quite limited. I did try declaring it inside a separate if statement along with a counter, but i had compile errors for variable not found. Thanks for your reply
comment on: http://stackoverflow.com/q/22848794
score: 0

http://stackoverflow.com/q/22848784
has title: admob ads stop showing when android package name is changed
has body: Ive recently taken a step into basic java coding and now have an issue. I bought some code which seems fine and builds the final app ok, well ish. Basicly ive narrow the issue down of ads not been shown to when i change the android package name this then stops any ads showing. Any help would be great im using eclipse and it doesnt throw any releivent errors. Thanks rory
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
answer count: 0
tagged with: java
tagged with: eclipse
tagged with: admob
type: Question

http://stackoverflow.com/comment/35046156
type: QuestionComment
comment on: http://stackoverflow.com/q/22952685
score: 0
has text: @JqueryLearner kishan.bheemajiyani@gmail.com here we go. will talk with u after my office hours. :)
type: Comment

http://stackoverflow.com/comment/34933290
type: Comment
has text: Basically imagine it as a sliding window. The sliding window increases to length M to the right, and then it decreases from the left side. Then it increases to the right again.
type: AnswerComment
comment on: http://stackoverflow.com/a/22891640
score: 0

http://stackoverflow.com/comment/34871165
type: Comment
has text: Here I am passing xsi:nil="true" option. It gives me the response properly in another server. During document/literal WSDL Format, the request did not reach the SOAP host, it throws the error Null pointer exception.
type: AnswerComment
comment on: http://stackoverflow.com/a/22857267
score: 0

http://stackoverflow.com/comment/34809551
type: AnswerComment
score: 0
type: Comment
has text: @NotFound is a way to circumnavigate the problem, anyway it causes an extra query with ID 0. The best solution is to keep a null value on that foreign key (using 0 as a FK is a really bad approach respect to DB design). Maybe also a custom hibernate type could help, but I am not sure and I'd anyway prefer the approach suggested above.
comment on: http://stackoverflow.com/a/22821204

http://stackoverflow.com/q/22874242
type: Question
tagged with: jdesktoppane
score: -1
tagged with: jframe
tagged with: swing
answer count: 1
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/22874271
type: UnansweredQuestion
has title: Adding JDesktopPane to JFrame using GridBagLayout
has body: How do I add the JDesktopPane to JFrame using GridBagLayout and set its height and width. If I add JDesktopPane that contains JInternalFrame I don't get anything. But works well in case of GridLayout but the problem is I can't set my desired size in it as GridLayout splits equal space among each component added.
upvote count: 0
tagged with: jinternalframe
favorite count: 0

http://stackoverflow.com/comment/34990109
has text: The problem is that code actually analyzes a file. Sometimes it takes a few hours to finish. I want to run it only for 10 minutes. If it's not finished, kill it and move to the next file.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22922874

http://stackoverflow.com/comment/34889931
type: Comment
has text: Why not check the other way around? I mean, use: `wordMap.contains(word)` where `word` is a word from the iterable `unmatchingWordsHolder` list. That would be much faster.
comment on: http://stackoverflow.com/a/22867373
score: 0
type: AnswerComment

http://stackoverflow.com/comment/93537079
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24757556
has text: `fileTreeTraverser`is now deprecated
score: 0

http://stackoverflow.com/a/23535216
upvote count: 4
has body: You can use histogram of SlidingTimeWindowReservoir: offersMinuteHistogram = new SlidingTimeWindowReservoir(1, TimeUnit.MINUTES); offersMinuteHistogram.getSnapshot().getValues().length This lenght is number of updates of histogram at last minute.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22927429
accepted answer of: http://stackoverflow.com/q/22927429
type: Answer
has comment: http://stackoverflow.com/comment/104904693
score: 4

pattern-matching
tags question: http://stackoverflow.com/q/22860792
type: Tag
tags question: http://stackoverflow.com/q/22838011
tags question: http://stackoverflow.com/q/22947561
tag name: pattern-matching

http://stackoverflow.com/comment/35046361
comment on: http://stackoverflow.com/q/22954590
type: Comment
type: QuestionComment
score: 0
has text: I believe it is a string yeah

http://stackoverflow.com/comment/34980285
type: AnswerComment
score: 0
type: Comment
has text: Thanks for the direction, mihu86. When I try to add the jersey-media-json-jackson dependency, my deployment explodes with this exception: Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @ Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)] I believe this is because this dependency uses Guava 14.0, which I excluded, but then get another similar error. Explored Jackson documentation and tried newer version, as described in my post.
comment on: http://stackoverflow.com/a/22874553

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/22946351
tags question: http://stackoverflow.com/q/22944881
tags question: http://stackoverflow.com/q/22918928
tags question: http://stackoverflow.com/q/22910268
tags question: http://stackoverflow.com/q/22889723
tags question: http://stackoverflow.com/q/22925757
tags question: http://stackoverflow.com/q/22835854
tags question: http://stackoverflow.com/q/22945416
tags question: http://stackoverflow.com/q/22848515
tags question: http://stackoverflow.com/q/22909724
tags question: http://stackoverflow.com/q/22922301
tags question: http://stackoverflow.com/q/22846361
type: Tag
tags question: http://stackoverflow.com/q/22819287
tags question: http://stackoverflow.com/q/22905422
tags question: http://stackoverflow.com/q/22906188
tags question: http://stackoverflow.com/q/22934547
tags question: http://stackoverflow.com/q/22810418
tags question: http://stackoverflow.com/q/22887706
tags question: http://stackoverflow.com/q/22952606
tags question: http://stackoverflow.com/q/22911512
tags question: http://stackoverflow.com/q/22883285
tags question: http://stackoverflow.com/q/22901364
tags question: http://stackoverflow.com/q/22912446
tags question: http://stackoverflow.com/q/22875043
tags question: http://stackoverflow.com/q/22951012
tags question: http://stackoverflow.com/q/22883073
tags question: http://stackoverflow.com/q/22855661
tags question: http://stackoverflow.com/q/22856020
tags question: http://stackoverflow.com/q/22814496
tags question: http://stackoverflow.com/q/22939721
tags question: http://stackoverflow.com/q/22887900
tags question: http://stackoverflow.com/q/22900332
tags question: http://stackoverflow.com/q/22908835
tags question: http://stackoverflow.com/q/22812012
tags question: http://stackoverflow.com/q/22962128
tags question: http://stackoverflow.com/q/22928427
tags question: http://stackoverflow.com/q/22851945
tags question: http://stackoverflow.com/q/22852187
tags question: http://stackoverflow.com/q/22962344
tags question: http://stackoverflow.com/q/22932060
tags question: http://stackoverflow.com/q/22892675
tags question: http://stackoverflow.com/q/22844119
tags question: http://stackoverflow.com/q/22932933
tags question: http://stackoverflow.com/q/22848177
tag name: html
tags question: http://stackoverflow.com/q/22825343
tags question: http://stackoverflow.com/q/22812706
tags question: http://stackoverflow.com/q/22906840
tags question: http://stackoverflow.com/q/22814284
tags question: http://stackoverflow.com/q/22875756
tags question: http://stackoverflow.com/q/22899057
tags question: http://stackoverflow.com/q/22916244
tags question: http://stackoverflow.com/q/22944020
tags question: http://stackoverflow.com/q/22945720
tags question: http://stackoverflow.com/q/22867748
tags question: http://stackoverflow.com/q/22879548
tags question: http://stackoverflow.com/q/22901346
tags question: http://stackoverflow.com/q/22915011
tags question: http://stackoverflow.com/q/22907690

http://stackoverflow.com/comment/131958683
score: 0
has text: @NoHarmDan that is quite the find. Did you manage to dig out any official-looking documentation illustrating this capability gap? Maybe some ICU lib differences?
type: AnswerComment
comment on: http://stackoverflow.com/a/22961817
type: Comment

http://stackoverflow.com/q/22964552
accepted answer: http://stackoverflow.com/a/22964667
tagged with: concurrency
type: Question
tagged with: settext
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/22964667
favorite count: 0
tagged with: event-dispatch-thread
downvote count: 0
tagged with: swing
linked to: http://stackoverflow.com/q/8916221
has title: Update Label text while button click action executing (Java)
type: AnsweredQuestion
has body: I have a button and Label on JFRAME. Clicking on button try to connect linux Server and this takes few second. I want to set the label text Connecting.. and Connected.But this doesn't set the label text Connecting .. during the button operation executing. Any Idea how to do that private void buttonLConnectActionPerformed(java.awt.event.ActionEvent evt) { labelLOut.setText("Connecting"); String ip=""; String userid="username"; String password="password"; Main_Window.LBoxconnect=new SshConnection(ip,userid,password); int x=LBoxconnect.checkConnection(); if(x==1){ labelLOut.setText("Connected"); if(dx==1) buttonBTTInsert.setEnabled(true); else lx=1; } else labelLOut.setText("Connection Failed"); }
score: 1
tagged with: java

http://stackoverflow.com/comment/34899842
comment on: http://stackoverflow.com/q/22873026
score: 0
type: QuestionComment
type: Comment
has text: During runtime, TreeMap consumes most of my memory space. Using clear() or remove() doesn't seem to free references as described here, http://stackoverflow.com/questions/2811537/is-java-hashmap-clear-and-remove-memory-effective. The recommendation here, mentions recreating the TreeMap, however, that is an expensive operation, and I'm trying to find alternatives.

http://stackoverflow.com/a/22962945
type: Answer
score: 2
downvote count: 0
has body: How about using a ThreadPool (http://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html)? You could pack your tasks into it and run them all as threads using a ThreadPoolExecutor (http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html).
upvote count: 2
answers question: http://stackoverflow.com/q/22962711

http://stackoverflow.com/comment/34870609
has text: @remus and using grouping or something to get it back in order to rebuild the string. This can be done, but it's not "exactly that" and this answer is lacking very important aspects from the question.
comment on: http://stackoverflow.com/a/22857188
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22919261
type: Question
has body: Well i have a Jpanel for a timer, and i wish to have a countdown timer inside it for 1 hour. I dont really know how to do it? I have a timer code implemented but i want to write it from scratch, anyone has a template? I just cant get it to appear, i can make static text appear like "Timer goes here" but a countdown seems impossible for me. Would really appreciate the help. Thanks! private JPanel timer() { JPanel timerPanel = new JPanel(); timerPanel.setMinimumSize(new Dimension(100, 100)); timerPanel.setPreferredSize(new Dimension(100, 100)); Countdown(timer, timer); JLabel timerLabel = new JLabel("TIMER GOES HERE"); timerLabel.setFont(new Font("Franklin Gothic Medium", Font.PLAIN, 18)); timerLabel.setAlignmentX(0); timerPanel.add(timerLabel); timerPanel.add(Box.createRigidArea(new Dimension(10, 10))); return timerPanel; }
answer count: 2
has answer: http://stackoverflow.com/a/22919677
score: 0
upvote count: 1
downvote count: 1
tagged with: countdown
has answer: http://stackoverflow.com/a/22919526
favorite count: 0
type: UnansweredQuestion
tagged with: countdowntimer
tagged with: swing
has title: 1 hour countdown in Jpanel?
tagged with: java

http://stackoverflow.com/a/49548588
score: 0
type: Answer
has body: you can take whatever pattern you want like i have date+ time zone. so you can set according to you. here is my code. SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); here i have set the date format. String currentDate = dateFormat.format(currentLocalTime); String localTime = date.format(currentLocalTime);// to get the time zone i have used this. String newtime=currentDate+localTime;// and then i have apeend this now print log you will get the desire result.
answers question: http://stackoverflow.com/q/22814263

http://stackoverflow.com/a/22896905
upvote count: 1
has body: Method .getMessage() returns the string given in constructor: throw new Exception("HERE"); When you catch Exception, you catch also NumberFormatException, InputMismatchException, etc. so you must catch broader ones last. catch (NumberFormatException e3) { // Precisier goes first System.out.println("An integer was not entered"); System.out.println(); input.nextLine(); } catch (Exception e1) { System.out.println(e1.getMessage()); System.out.println(); input.nextLine(); }
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22896308

http://stackoverflow.com/comment/35056798
type: Comment
type: QuestionComment
has text: yea, but which line is from your code?
comment on: http://stackoverflow.com/q/22960648
score: 0

http://stackoverflow.com/q/22919566
has comment: http://stackoverflow.com/comment/34985475
tagged with: java
has comment: http://stackoverflow.com/comment/34986388
has comment: http://stackoverflow.com/comment/34983376
type: Question
accepted answer: http://stackoverflow.com/a/22919819
has comment: http://stackoverflow.com/comment/34985990
has comment: http://stackoverflow.com/comment/34985043
downvote count: 0
has comment: http://stackoverflow.com/comment/34983364
tagged with: random
answer count: 1
has comment: http://stackoverflow.com/comment/34983270
has comment: http://stackoverflow.com/comment/34984425
favorite count: 0
has title: What's wrong with Android's Random.nextInt(2^N)?
upvote count: 2
has comment: http://stackoverflow.com/comment/34985120
tagged with: android
has answer: http://stackoverflow.com/a/22919819
has body: I executed the following code several times by clicking the button: int UP = 4; Log.println(Log.DEBUG, "random", new Random().nextInt(UP) + " " + new Random().nextInt(UP) + " " + new Random().nextInt(UP) + " " + new Random().nextInt(UP) + " " + new Random().nextInt(UP) + " " + new Random().nextInt(UP) + " " + new Random().nextInt(UP) + " " + new Random().nextInt(UP) + " " ); And I was very surprised of getting this in the log: 04-07 21:26:36.659: D/random(15640): 1 1 1 1 1 1 1 1 04-07 21:26:37.059: D/random(15640): 2 2 2 2 2 2 2 2 04-07 21:26:37.429: D/random(15640): 2 2 2 2 2 2 2 2 04-07 21:26:37.789: D/random(15640): 2 2 2 2 2 2 2 2 04-07 21:26:38.119: D/random(15640): 1 1 1 1 1 1 1 1 04-07 21:26:38.429: D/random(15640): 1 1 1 1 1 1 1 1 04-07 21:26:38.739: D/random(15640): 1 1 1 1 1 1 1 1 04-07 21:26:39.019: D/random(15640): 2 2 2 2 2 2 2 2 04-07 21:26:39.319: D/random(15640): 2 2 2 2 2 2 2 1 04-07 21:26:39.599: D/random(15640): 2 1 1 1 1 1 1 1 --for sure, these sequences are absolutely non-random. I know, that I should create one instance of Random object and call its nexInt() as many times as I need. But Java changes static seed number every time new Random instance is created by Random() constructor: public Random() { this(++seedUniquifier + System.nanoTime()); } private static volatile long seedUniquifier = 8682522807148012L; so produced sequences should be random independently on that whether we use one object or every time the new one. But for some reason they are not. I decided to continue my research, calling nextInt() with different arguments. And what I saw next, surprised me much more. I noticed that every time I choose UP constant to be power of 2, result of new Random().nextInt(UP) remains absolutely non-random, but when I choose different number, everything is quite OK. UP = 8: 04-07 21:43:47.169: D/random(15789): 5 4 4 4 4 5 5 5 04-07 21:43:47.809: D/random(15789): 7 7 7 7 7 7 7 7 04-07 21:43:48.249: D/random(15789): 6 7 7 7 7 6 6 6 04-07 21:43:48.6…
has comment: http://stackoverflow.com/comment/34983564
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/22927017
has body: I am using a fragment and cursoradapter to display incoming messages. For every message there is a button that can be clicked. My onclick is implemented in the underlying activity shown below. public class ChatActivity extends FragmentActivity implements StatFragment.OnFragmentInteractionListener, ChatFragment.OnFragmentInteractionListener, EditContactDialog.OnFragmentInteractionListener { @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); profileId = getIntent().getStringExtra(Common.PROFILE_ID); //msgEdit = (EditText) findViewById(R.id.msg_edit); msgInvite_edit = (EditText) findViewById(R.id.msgInvite_edit); buttonNewInvite = (Button) findViewById(R.id.buttonNewInvite); buttonYES = (Button) findViewById(R.id.button1); ans1 = getIntent().getIntExtra(DataProvider.COL_ANSCOUNT, 0); //BAS: de zendknop voor het antwoorden op de Invite sendBtn = (Button) findViewById(R.id.send_btn); //checkBtn = (CheckBox) findViewById(R.id.checkBox1); //buttonId = getIntent.getStringExtra(DataProvider.COL_ID); //BAS: deze tabhost voeg ik toe voor de tabInvites en tabStats TabHost tabHost = (TabHost) findViewById(R.id.tabHost); tabHost.setup(); ActionBar actionBar = getActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); //BAS: dit hoort nog bij tabhost TabHost.TabSpec tabSpec = tabHost.newTabSpec("Stats"); tabSpec.setContent(R.id.tabInvites); tabSpec.setIndicator("Stats"); tabHost.addTab(tabSpec); tabSpec = tabHost.newTabSpec("Chat"); tabSpec.setContent(R.id.tabStats); tabSpec.setIndicator("Chat"); tabHost.addTab(tabSpec); Cursor c = getContentResolver().query(Uri.withAppendedPath(DataProvider.CONTENT_URI_PROFILE, profileId), null, null, null, null); if (c.moveToFirst()) { profileName = c.getString(c.getColumnIndex(DataProvider.COL_NAME)); profileEmail = c.getString(c.getColumnIndex(DataProvider.COL_EMAIL)); actionBar.setTitle(profileN…
has title: get position of button in listfragment
type: Question
has answer: http://stackoverflow.com/a/22945241
score: 0
answer count: 1
tagged with: button
tagged with: android
tagged with: fragment
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19487253
tagged with: java

http://stackoverflow.com/comment/34817283
has text: *"See my **UPDATE**"* Nice answer, even **before** the update. :) I'd probably just use a `JTable` for this, though. ;)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22827296

http://stackoverflow.com/a/22876455
has body: When you do addAll, you get two separate lists, which can each be modified separately. That is, (phonesContainerOne) ⟶ [ Nexus4, Nexus5 ] (phonesContainerTwo) ⟶ [] becomes (phonesContainerOne) ⟶ [ Nexus4, Nexus5 ] (phonesContainerTwo) ⟶ [ Nexus4, Nexus5 ] However, if you just write phonesContainerTwo = phonesContainerOne then you end up with just a single list, but two variables referring to it. (phonesContainerOne) ⟶ [ Nexus4, Nexus5 ] ⟵ (phonesContainerTwo)
has comment: http://stackoverflow.com/comment/34908564
has comment: http://stackoverflow.com/comment/34913891
upvote count: 7
answers question: http://stackoverflow.com/q/22876412
type: Answer
has comment: http://stackoverflow.com/comment/34909870
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/34913805

http://stackoverflow.com/q/22902065
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22902101
score: 1
tagged with: java
tagged with: mysql
tagged with: glassfish
has comment: http://stackoverflow.com/comment/34957490
has comment: http://stackoverflow.com/comment/34957709
downvote count: 0
tagged with: jsp
has title: MySQL and JSP Database connectivity with Glassfish server 4
has answer: http://stackoverflow.com/a/22902171
accepted answer: http://stackoverflow.com/a/22902171
has answer: http://stackoverflow.com/a/22905344
favorite count: 0
has answer: http://stackoverflow.com/a/22902101
answer count: 3
has body: Here is my code. **insert.html** Donate Blood ! Name: Rollno: Blood Group: **Store.jsp** <%@page import="java.sql.DriverManager"%> <%@page import="java.sql.Statement"%> <%@page import="java.sql.Connection"%> <% String name = request.getParameter("nam"); String roll = request.getParameter("rno"); String group = request.getParameter("grp"); Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/blood","root",""); Statement st = con.createStatement(); int i=st.executeUpdate("insert into blood(Name,Rollno,BloodGroup) values('+name+','+roll+','+group+')"); %> My database.. I am running this code in netbeans 8.0. I got the error log as It shows that data is too long for blood group but i just given 'A+' in that textbox. Whats going wrong. As I am new to JSP please help me. Thanks in advance.
type: AnsweredQuestion

http://stackoverflow.com/comment/35060031
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22962432
score: 0
has text: point that line where you are getting null

http://stackoverflow.com/comment/34993176
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22901925
has text: hey @bellabax, I try modify the anootations for the 'key' in entity 'Atributo', but after that I am geting the error 'detached entity passed to persist: om.horariolivre.entity.Key'. Do you can indicate another text like the previous one about this?

http://stackoverflow.com/comment/41427753
type: Comment
type: QuestionComment
has text: how did you inject async bean and call the method?
score: 0
comment on: http://stackoverflow.com/q/22810484

http://stackoverflow.com/comment/34993855
type: Comment
has text: I think you need a context to reference resources
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22925029

http://stackoverflow.com/a/22834526
has body: Change the method arguments to something like: p1.makePerson(new String[]{"joe" ,"jhon", "Alex"}, new int[]{150,160,170}); instead of p1.makePerson({"joe" ,"jhon", "Alex"},{150,160,170});// &lt;- your sending String and ints not Arrays. Also your display method is taking a array of persons not a person. so change it to: public void display(Person[] persons) { And in the makePerson method, you declaring array with a wrong way, it should be like: Person[] persons = new Person[names.length];
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22834413
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/22834413
has comment: http://stackoverflow.com/comment/34829764
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34829891

http://stackoverflow.com/comment/34946494
type: Comment
has text: The bottom part I added is what i should get after it has gone though the code
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22898892

ajax
tags question: http://stackoverflow.com/q/22854419
tags question: http://stackoverflow.com/q/22920836
tags question: http://stackoverflow.com/q/22859375
tags question: http://stackoverflow.com/q/22911806
type: Tag
tags question: http://stackoverflow.com/q/22865047
tags question: http://stackoverflow.com/q/22851945
tags question: http://stackoverflow.com/q/22852074
tags question: http://stackoverflow.com/q/22956073
tags question: http://stackoverflow.com/q/22962774
tags question: http://stackoverflow.com/q/22887192
tags question: http://stackoverflow.com/q/22908261
tags question: http://stackoverflow.com/q/22812841
tags question: http://stackoverflow.com/q/22853509
tag name: ajax

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/22898756
tags question: http://stackoverflow.com/q/22843397
tags question: http://stackoverflow.com/q/22823672
tags question: http://stackoverflow.com/q/22959374
tags question: http://stackoverflow.com/q/22871800
tags question: http://stackoverflow.com/q/22867311
tags question: http://stackoverflow.com/q/22843984
tags question: http://stackoverflow.com/q/22814392
tags question: http://stackoverflow.com/q/22853281
tags question: http://stackoverflow.com/q/22952061
tags question: http://stackoverflow.com/q/22915675
tags question: http://stackoverflow.com/q/22889552
tags question: http://stackoverflow.com/q/22817393
tags question: http://stackoverflow.com/q/22920663
tags question: http://stackoverflow.com/q/22844843
tags question: http://stackoverflow.com/q/22847309
type: Tag
tags question: http://stackoverflow.com/q/22894094
tags question: http://stackoverflow.com/q/22944918
tags question: http://stackoverflow.com/q/22923492
tags question: http://stackoverflow.com/q/22865864
tags question: http://stackoverflow.com/q/22854622
tags question: http://stackoverflow.com/q/22964552
tags question: http://stackoverflow.com/q/22914882
tags question: http://stackoverflow.com/q/22933218

http://stackoverflow.com/a/22952442
has body: You created the array of JButton, but you didn't create every element in the array. To do this: Replace this: floorButton[i].add(new JButton("F" + Integer.toString(i))); by this: floorButton[i] = new JButton("F" + Integer.toString(i));
answers question: http://stackoverflow.com/q/22952405
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/q/22857710
has comment: http://stackoverflow.com/comment/34871485
accepted answer: http://stackoverflow.com/a/22858818
has comment: http://stackoverflow.com/comment/34871397
tagged with: android
answer count: 1
has body: By following this blog how can I implement parsing JSON Data like this? Could anyone give me some link/tutorial in retrieving JSON data. { "batters": { "batter": [ { "id": "1001", "type": "Regular" }, { "id": "1002", "type": "Chocolate" }, { "id": "1003", "type": "Blueberry" }, { "id": "1004", "type": "Devil's Food" } ], "batter2": [ { "id": "6", "type": "POGI" }, { "id": "66", "type": "PWEPWE" }, { "id": "666", "type": "SABON" }, { "id": "6666", "type": "SABAW" } ] }, "topping": [ { "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5005", "type": "Sugar" }, { "id": "5007", "type": "Powdered Sugar" }, { "id": "5006", "type": "Chocolate with Sprinkles" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] } Here is my parser that i've used in retrieving this data but i'm having problem in getting batters tag and getting to the inner tag of batter/batter2 and possibly the id and type can be multiple.. /* ---------------------------------------------------------------------------------------------------------------------------- * Custom * ---------------------------------------------------------------------------------------------------------------------------- */ @SuppressWarnings("unchecked") public Map&lt;String, ArrayList&lt;List&lt;String&gt;&gt;&gt; JsonToMap(String JsonObj) { Map&lt;String, ArrayList&lt;List&lt;String&gt;&gt;&gt; TblMap = new HashMap&lt;String, ArrayList&lt;List&lt;String&gt;&gt;&gt;(); try { List&lt;List&lt;Object&gt;&gt; JObj = (List&lt;List&lt;Object&gt;&gt;) getObjectFromJson(JsonObj); for (int x = 0; x &lt; JObj.size(); x++) { List&lt;Object&gt; Tbl = new ArrayList&lt;Object&gt;(); String MapKey = JObj.get(x).get(0).toString(); Tbl = (List&lt;Object&gt;) JObj.get(x).get(1); TblMap.put(MapKey, new ArrayList&lt;List&lt;String&gt;&gt;()); for (Object obj : Tbl) { TblMap.get(MapKey).add((List&lt;String&gt;) obj); } } } catch (JSONException e) { TblMap = null; } return TblMap; } @SuppressWarning…
favorite count: 0
has comment: http://stackoverflow.com/comment/34871463
has title: Parsing multidimensional JSON in java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22858818
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34871470
upvote count: 1
downvote count: 10
type: Question
score: -9
linked to: http://stackoverflow.com/q/2591098

http://stackoverflow.com/comment/35093185
has text: first of all thanks as this does the job , but something native HQL would have been awesome. thanks once again
type: Comment
comment on: http://stackoverflow.com/a/22962776
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34869067
type: Comment
score: 4
type: AnswerComment
has text: Wouldn't that be a `List<Class<? extends ExerciseMovement>>`?
comment on: http://stackoverflow.com/a/22856386

http://stackoverflow.com/q/22847799
has body: I'm writing a simple chat application on android using UDP. I have a thread (inner class) that is used for receiving packets. fSocket listens to port 11200 for packets. private class fThread extends Thread { private int LISTENING_PORT = 11200; DatagramSocket fSocket; DatagramPacket fpacket; public fThread() { try { fSocket= new DatagramSocket(LISTENING_PORT); fSocket.setBroadcast(false); }catch (IOException e) {} } public void run() { try { while (true) { byte[] buf = new byte[1024]; fpacket = new DatagramPacket(buf, buf.length); fSocket.receive(fpacket); //some other code below } } } private void Write(byte[] newfpacket,String DestIP1) { try { String data = new String (newfpacket); DatagramPacket toForward = new DatagramPacket(data.getBytes(),data.length(),InetAddress.getByName(DestIP1.trim()), LISTENING_PORT); uniSocket.setBroadcast(false); uniSocket.send(toForward); catch (UnknownHostException e1) { android.util.Log.i(TAG1,"Unknown host exception:"+e1.getMessage()); e1.printStackTrace(); } catch (IOException e) { android.util.Log.i(TAG1,"Some IO exception: "+e.getMessage()); e.printStackTrace(); } When I click a button, I call the fThread fthread = new fThread(); fthread.Write(somemessage,"192.168.1.105"), I get a networkonmainthread exception I know it is because the write is being done on main thread, and has to be a Thread of its own or AsyncTAsk. Basically I want to send a UDP packet when ever I press a button, to LISTENING_PORT at some destIP. I try to do it like this, but not sure how to progress to make the thread send a single packet whenever I click a button. private class sendThread extends Thread { //for sending packet to listening port DatagramSocket uniSocket; void run (){ } }
answer count: 1
score: 0
has title: Android: how to send UDP packet using thread or asynctask
has comment: http://stackoverflow.com/comment/34856497
tagged with: sockets
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22848975
accepted answer: http://stackoverflow.com/a/22848975
tagged with: java
type: Question

http://stackoverflow.com/comment/34979766
comment on: http://stackoverflow.com/a/22917539
score: 0
type: AnswerComment
has text: I'm sorry, I forgot that line when I was typing my question.
type: Comment

http://stackoverflow.com/comment/35078252
type: Comment
type: QuestionComment
has text: Thank you @Quillion and Ray for your helpful answers. Both your methods work fine.
comment on: http://stackoverflow.com/q/22942131
score: 0

http://stackoverflow.com/comment/34864896
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22853830
has text: Pretty much exactly what I posted but with j replaced with v. I even switched line 3 and am still having issues.

http://stackoverflow.com/a/22962776
type: AcceptedAnswer
has body: If it's in the native SQL dialect of your database, then you have to use this: List&lt;String&gt; usernames = (List&lt;String&gt;)(getSession().createSQLQuery("yourNativeSqlQuery").list());
has comment: http://stackoverflow.com/comment/35093185
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22960361
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22960361

http://stackoverflow.com/comment/34852159
has text: You get a stack trace for uncaught exceptions at runtime. In your case, your code does not even compile, so you have no stack trace.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22846026

http://stackoverflow.com/q/22811130
has comment: http://stackoverflow.com/comment/34787744
has body: I want to create without ui application I want to start my application on change in phone state and that will start another service that will do the task code but is not working public void onReceive(Context context, Intent intent) { Bundle bundle = intent.getExtras(); if (bundle == null) return; String phoneNumber = null; // Incoming call String state = bundle.getString(TelephonyManager.EXTRA_STATE); if ((state != null) &amp;&amp; (state.equalsIgnoreCase(TelephonyManager.EXTRA_STATE_RINGING))) { phoneNumber = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER); Intent i = new Intent(context,ServiceFromBr.class); context.startService(i); } // Outgoing call else if (state == null) { phoneNumber = bundle.getString(Intent.EXTRA_PHONE_NUMBER); Intent i = new Intent(context,ServiceFromBr.class); context.startService(i); } } and service code is: public class ServiceFromBr extends Service { public void onCreate() { Toast t= Toast.makeText(getApplicationContext(), "in Service", Toast.LENGTH_LONG); t.show(); } } &lt;service android:name=".ServiceFromBr"&gt;&lt;/service&gt; &lt;receiver android:name=".BroadcastStart" android:enabled="true" android:exported="true"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.NEW_OUTGOING_CALL" /&gt; &lt;action android:name="android.intent.action.PHONE_STATE" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt;
has title: How to launch the apk when there is change in phone state (broadcast receiver) that will start the service
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34788322
type: UnansweredQuestion
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/22811565
type: Question

http://stackoverflow.com/comment/35167715
comment on: http://stackoverflow.com/q/22832251
has text: in case you go with MAT, try to click the classloader and see the 'Immediate Dominators', the closest object in the referencer chain that holds the most memory, see here tip 4 of this post -> http://eclipsesource.com/blogs/2013/01/21/10-tips-for-using-the-eclipse-memory-analyzer/, this might help with such a large number of retaining paths
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22847942
upvote count: 1
has answer: http://stackoverflow.com/a/22847987
downvote count: 1
has answer: http://stackoverflow.com/a/22848041
has comment: http://stackoverflow.com/comment/34854160
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22848034
tagged with: java
accepted answer: http://stackoverflow.com/a/22847987
possible better answer: http://stackoverflow.com/a/22848041
has comment: http://stackoverflow.com/comment/34853912
has body: We all know that you can't instantiate an interface in Java (directly at least). But with something like this: public class Test{ public interface Link { void mySamplemethod(); String myString ="HELLO!"; } public static void main(String []args){ Link b; } } What exactly is b... and how could it ever have a practical purpose?
linked to: http://stackoverflow.com/q/383947
type: Question
has comment: http://stackoverflow.com/comment/69030122
has comment: http://stackoverflow.com/comment/34854105
favorite count: 0
score: 0
has title: Java: Interface reference?
tagged with: interface
has answer: http://stackoverflow.com/a/22847993
answer count: 4
has comment: http://stackoverflow.com/comment/34854104
has comment: http://stackoverflow.com/comment/34854244
has comment: http://stackoverflow.com/comment/34853953

http://stackoverflow.com/a/22876378
upvote count: 2
has comment: http://stackoverflow.com/comment/34905784
has body: You should spend more time on your question before posting it - if the code doesn't compile you should either mention that you have a problem compiling it, or you should fix it before posting. But it's an interesting question nonetheless. You can do this: public static void main(String[] args) { // 'i' is the number to process - left code similar to the question int i = 26051, j = 0; // Allocate as many bytes as needed. The 10-log of the number, // rounded up, is the number of digits in the decimal representation. byte[] b = new byte[(int) Math.ceil(Math.log10(i))]; while (i &gt; 0) { // Work backwards through the byte array so that the most significant // digit ends up first. b[b.length - 1 - j] = (byte) (i % 10); i = i / 10; j++; } // Print the result for (byte x : b) { System.out.println(x); } }
has comment: http://stackoverflow.com/comment/34905841
answers question: http://stackoverflow.com/q/22876315
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34831220
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22835472
score: 0
has text: You should look at regular expressions: http://docs.oracle.com/javase/tutorial/essential/regex/

http://stackoverflow.com/comment/34934104
type: Comment
has text: It gives me an error saying Exception in thread "main" java.awt.IllegalComponentStateException: The frame is displayable. at java.awt.Frame.setUndecorated(Frame.java:923) at freetts.FormTTS.<init>(FormTTS.java:93) at freetts.FreeTTS.main(FreeTTS.java:59)
comment on: http://stackoverflow.com/a/22892060
type: AnswerComment
score: 0

http://stackoverflow.com/q/22827441
tagged with: rgb
type: Question
answer count: 2
duplicate of: http://stackoverflow.com/q/22778397
has answer: http://stackoverflow.com/a/22829917
has comment: http://stackoverflow.com/comment/34817282
score: 0
has title: Convert RGB to Hex using java code - Android
tagged with: converters
tagged with: android
linked to: http://stackoverflow.com/q/13465098
linked to: http://stackoverflow.com/q/3607858
tagged with: hex
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22827735
has comment: http://stackoverflow.com/comment/34817086
has comment: http://stackoverflow.com/comment/34817088
has body: I'm converting RGB to Hexadecimal Colors using this code. I have 3 Edittext to input R, G and B. Now what I want to do is to convert it without using the API. Like converting and computing it with my own code and not by toHexString(). can someone help me to do that? Thanks a lot. Here is my code. convert.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { final int r = Integer.parseInt(showRed.getText().toString()); final int g = Integer.parseInt(showGreen.getText().toString()); final int b = Integer.parseInt(showBlue.getText().toString()); final StringBuilder builder = new StringBuilder(); builder.append("#"); builder.append(Integer.toHexString(r)); // Real computation here builder.append(Integer.toHexString(g)); // Real computation here builder.append(Integer.toHexString(b)); // Real computation here result.setText(builder.toString()); } });
tagged with: java
has comment: http://stackoverflow.com/comment/34817066
linked to: http://stackoverflow.com/q/22778397

http://stackoverflow.com/comment/35033203
comment on: http://stackoverflow.com/a/22947009
score: 0
type: Comment
type: AnswerComment
has text: What are you doing? Don't use `==` to compare the strings.

http://stackoverflow.com/q/22887958
has comment: http://stackoverflow.com/comment/34927064
possible better answer: http://stackoverflow.com/a/22888013
has answer: http://stackoverflow.com/a/22888013
answer count: 4
has answer: http://stackoverflow.com/a/22888089
type: AnsweredQuestion
has title: how to add a do-while statement to this?
has answer: http://stackoverflow.com/a/22888333
has body: I need to make it do it repeatedly asks the user for a number between 1 and 10, but it terminates when any number is entered. import javax.swing.*; public class Demo { public static void main (String [] args) { int n; n = Integer.parseInt( JOptionPane.showInputDialog(null, "Enter a number between 1 and 10")); while (n &lt; 1 &amp;&amp; n &gt; 10) { JOptionPane.showMessageDialog(null,"Your number is not between 1 and 10"); n = Integer.parseInt( JOptionPane.showInputDialog(null, "Enter a number between 1 and 10")); } JOptionPane.showMessageDialog(null, "Good!\nClick OK to exit"); System.exit(0); } }
has comment: http://stackoverflow.com/comment/34926433
type: Question
tagged with: do-while
has comment: http://stackoverflow.com/comment/34927229
tagged with: java
has comment: http://stackoverflow.com/comment/34926785
has answer: http://stackoverflow.com/a/22887982
accepted answer: http://stackoverflow.com/a/22887982
score: 0
has comment: http://stackoverflow.com/comment/34926479
tagged with: while-loop

http://stackoverflow.com/comment/34957559
type: Comment
comment on: http://stackoverflow.com/q/22891660
has text: Ah, yes. Sorry for being unclear. I think I'll be able to figure it out now. Thank you.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35298977
type: AnswerComment
type: Comment
has text: Thanks your comment about the configuration profile, i already fixed. Scheduling are working fine. The problem is when i need to send a message from the server to client. I'm creating a link to access the tomcat log.
comment on: http://stackoverflow.com/a/23093452
score: 0

http://stackoverflow.com/q/22948338
tagged with: war
tagged with: spring
score: 1
tagged with: java
type: Question
has body: I'm getting a java.lang.SecurityException when trying to deploy a war in jboss but it is running fine on my machine. Caused by: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:239) [:1.6.0_30] at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:193) [:1.6.0_30] at java.util.jar.JarVerifier.processEntry(JarVerifier.java:296) [:1.6.0_30] at java.util.jar.JarVerifier.update(JarVerifier.java:207) [:1.6.0_30] at java.util.jar.JarFile.initializeVerifier(JarFile.java:342) [:1.6.0_30] at java.util.jar.JarFile.getInputStream(JarFile.java:410) [:1.6.0_30] at org.jboss.vfs.spi.JavaZipFileSystem.getFile(JavaZipFileSystem.java:159) [jboss-vfs.jar:3.0.0.GA] at org.jboss.vfs.VirtualFile.getPhysicalFile(VirtualFile.java:262) [jboss-vfs.jar:3.0.0.GA] at org.jboss.web.deployers.AbstractWarDeployer$1.visit(AbstractWarDeployer.java:853) [:6.0.0.Final] at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:408) [jboss-vfs.jar:3.0.0.GA] at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA] at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA] at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA] at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:396) [jboss-vfs.jar:3.0.0.GA] at org.jboss.web.deployers.AbstractWarDeployer.getExplodedWarUrl(AbstractWarDeployer.java:866) [:6.0.0.Final] at org.jboss.web.deployers.AbstractWarDeployer.deploy(AbstractWarDeployer.java:400) [:6.0.0.Final] ... 47 more Can any one explain me what might be causing it?
tagged with: jboss
has answer: http://stackoverflow.com/a/22949311
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has title: Invalid signature file digest for Manifest main attributes in Jboss
type: UnansweredQuestion

http://stackoverflow.com/a/22853804
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: change the following to: public Cursor getOpenLockers() { Cursor c = ourDatabase.rawQuery("SELECT number, status FROM " + DATABASE_TABLE + " WHERE status = 'open'", null); if (c != null) { c.moveToFirst(); } return c; } to public Cursor getOpenLockers() { Cursor c = ourDatabase.rawQuery("SELECT _id, number, status FROM " + DATABASE_TABLE + " WHERE status = 'open'", null); if (c != null) { c.moveToFirst(); } return c; } Added _id in the select, also ensure that DATABASE_TABLE has the column _id. A cursor adapter will always need an _id column! Hope that helps.!
answers question: http://stackoverflow.com/q/22853721
type: Answer
accepted answer of: http://stackoverflow.com/q/22853721

http://stackoverflow.com/comment/133026434
score: 0
type: AnswerComment
has text: I really like this answer, clearly demonstrates how Java handles exceptions.
type: Comment
comment on: http://stackoverflow.com/a/65473005

http://stackoverflow.com/comment/34980576
type: Comment
has text: @James_D Oh you are an angel ;) Thanks. I wrote as you suggested with new String[0] and now it launched! :D :D Thanks again :D Now i know that for sure and hopefully wont do the same mistake again.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22914895

http://stackoverflow.com/a/23680687
answers question: http://stackoverflow.com/q/22832996
score: 7
downvote count: 0
has body: The fact that PhantomJS keeps sessions between tests is a known problem in GhostDriver, the Selenium Webdriver implementation in PhantomJS. I suppose that this problem will be fixed with the PhantomJS 2 release. The bug is already fixed in GhostDriver 1.1.1, but there is no PhantomJS version which includes this GhostDriver version.
type: Answer
upvote count: 7

http://stackoverflow.com/a/22894916
type: Answer
accepted answer of: http://stackoverflow.com/q/22889058
answers question: http://stackoverflow.com/q/22889058
has body: Defining the useFont() methods and using them before adding the text that should use its specified font is my current approach. It's working and I'm content, but if anyone have any better answers I'm still very interested :-) public class OuterClass { InnerClass inner = new InnerClass(); private class InnerClass { private JTextPane textPane = new JTextPane(); private Font firstFont = new Font("Times New Roman", Font.PLAIN, 18); private Font secondFont = new Font("Calibri", Font.PLAIN, 14); StyledDocument doc = textPane.getStyledDocument(); SimpleAttributeSet aSet = new SimpleAttributeSet(); public InnerClass() { StyledDocument doc = textPane.getStyledDocument(); SimpleAttributeSet center = new SimpleAttributeSet(); StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER); doc.setParagraphAttributes(0, doc.getLength(), center, false); } public void useFont1() { StyleConstants.setFontFamily(aSet, firstFont.getFamily()); StyleConstants.setFontSize(aSet, firstFont.getSize()); doc.setParagraphAttributes(0, 0, aSet, false); } public void useFont2() { StyleConstants.setFontFamily(aSet, secondFont.getFamily()); StyleConstants.setFontSize(aSet, secondFont.getSize()); doc.setParagraphAttributes(doc.getLength(), 0, aSet, false); } } public void decorateTextPane() { inner.useFont1(); inner.textPane.setText("First string"); inner.useFont2(); inner.textPane.append("\nSecond string"); //my textPane class defines an append method. } }
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/35043848
comment on: http://stackoverflow.com/q/22952614
score: 0
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis I know, I think what I tried was crazy. So there is not way but to put the Class<V> in the constructor? :-/

http://stackoverflow.com/comment/34990648
has text: If you can't make an other thread to measure elapsed time you have to measure time elapsed at some point like said Darius. But I think a better solution is with an other thread like said MirroredFate
comment on: http://stackoverflow.com/a/22922874
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34829597
type: Comment
score: 0
has text: @kaushikparmar - use the same handle/fd in both threads. Should be OK.
type: QuestionComment
comment on: http://stackoverflow.com/q/22831544

http://stackoverflow.com/q/22837444
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/32067267
answer count: 1
has comment: http://stackoverflow.com/comment/34837248
has body: I am having problem that even though I specify the property log4j.additivity=false ,still log messages are getting displayed in both logs (Root log and intended log). But I want to log only in intended log file how can I achieve it through configuration in properties file. I am not a log4j expert so any help is appreciated. my log file looks like this #============================================== # RIPNET Logger (..//logs everything under the sun) #============================================== log4j.rootLogger=INFO, RIPNETappender log4j.appender.RIPNETappender=org.apache.log4j.DailyRollingFileAppender log4j.appender.RIPNETappender.layout=org.apache.log4j.PatternLayout log4j.appender.RIPNETappender.layout.ConversionPattern=%d %p [%t:%c] - &lt;%m&gt;%n log4j.appender.RIPNETappender.File=..//logs//RIPNET.log #==================================== # WorkOrder Logger #==================================== log4j.logger.com.reino.ripnet.servlet.alarm=INFO, WorkOrderAppender log4j.appender.WorkOrderAppender=org.apache.log4j.DailyRollingFileAppender log4j.additivity.com.reino.ripnet.servlet.alarm=false log4j.appender.WorkOrderAppender.File=..//logs//WorkOrder.xml.log log4j.appender.WorkOrderAppender.layout=org.apache.log4j.PatternLayout log4j.appender.WorkOrderAppender.layout.ConversionPattern=%d %p [%t:%c] - &lt;%m&gt;%n though i set the value log4j.additivity.com.reino.ripnet.servlet.alarm=false the log messages are still getting logged in root log i even tried setting log4j.additivity.WorkOrderAppender=false in the code i call the logger by Logger logger = Logger.getLogger("WorkOrderAppender"); i also tried using Logger logger = Logger.getLogger(getClass()); but still no use
has comment: http://stackoverflow.com/comment/34835013
score: 0
has title: disable output to log4j.rootLogger
tagged with: log4j
has comment: http://stackoverflow.com/comment/34839272

http://stackoverflow.com/comment/34950873
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22901412
type: Comment
has text: Which line is giving you the `NullPointerException`? Including the stack trace is *always* a good idea when asking for help (and pointing out which line gets reported, because we don't have your exact file, so line numbers without some indication of where the problem actually is are meaningless.

http://stackoverflow.com/a/36155230
answers question: http://stackoverflow.com/q/22944699
has body: As mentioned above, the Screen interface contains a dispose method. Additionally, the dispose method of Game can be overridden to dispose of the current screen automatically. However, there is a reason this is not the default. Let's say you have multiple Screens - Screen1and Screen2. Screen1 was active, then changed the screen to 2. The game is then exited, and the dispose method is called, which calls the current screen's dispose method - leaving screen 1 alone. My preferred method is to have the game keep track of screens set by overriding the setScreen method and adding a Screen[] screens, a boolean[] scrDiss, and an index. When dispose is called on Game, it checks through all screens set, checks if previously disposed, and disposes if not. Additionally, the Screen dispose methods should call a method on the Game that finds it in the array, and marks it disposed. This way, screens can be disposed before the end of the Game, but when Game is disposed, all Screens will be as well.
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/22932612
type: Question
has answer: http://stackoverflow.com/a/22932999
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22932999
tagged with: google-app-engine
has body: How to bypass google sign-in page in GWT with GAE to access certain html file in Java backend servlet? I tried to put the security-constraint in web.xml like following : <web-resource-collection> verifysite /test.html </web-resource-collection> * But it still doesn't work. It always redirect me into the google sign-in page. Thanks.
tagged with: backend
tagged with: gwt
type: AnsweredQuestion
tagged with: java
has title: how to bypass google sign-in page in app engine to access certain html file in java
tagged with: google-search-console

http://stackoverflow.com/q/22952073
tagged with: vector
has answer: http://stackoverflow.com/a/22952188
answer count: 1
accepted answer: http://stackoverflow.com/a/22952188
has title: Normalize a vector so all sum of elements add to 1 everytime
score: 0
linked to: http://stackoverflow.com/q/10095524
has body: I am trying to write some code to normalize a vector with elements [x,y,z] but was wondering if there is a way to normalize the elements so that each time the sum of elements will add to 1. I did come across a formula: (pseudo code) normalized = vectorA/ magnitude(vectorA) However, if the vectorA = [1,4,5] then using the formula above would give: magnitude = sqrt(1^2 + 4^2 + 5^2) magnitude = sqrt(42) magnitude = 6.48 Now based on that if I divide each element of the vector by 6.48 then: 1/6.48 = 0.154 4/6.48 = 0.62 5/6.48 = 0.77 As you can see, the sum is more than 1, so the formula doesn't work everytime and I was wondering if anyone has an idea on how to get the sum of elements to equal to 1 at all times. Any help will be appreciated
tagged with: matrix
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: normalization

http://stackoverflow.com/comment/34894647
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22870204
has text: @DSquare there you go
type: AnswerComment

http://stackoverflow.com/comment/40320166
type: QuestionComment
comment on: http://stackoverflow.com/q/22960273
has text: @V.P.: I had tried with this, did not worked that solution.
score: 0
type: Comment

http://stackoverflow.com/q/22838323
tagged with: android-fragments
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24116591
tagged with: listview
has body: Activity type is "fixed tabs + swipe". I need read data from DB sqlite in my Listvew, which located in fragment xml file (not in main xml). L use my old code from some program, there is a method for creating listview: public void createList(){ db = new DB(this); db.open(); String[] from = new String[] {DB.COLUMN_NAME, DB.COLUMN_TIME }; int[] to = new int[] { R.id.tvTextName, R.id.tvText_time}; scAdapter = new SimpleCursorAdapter(this, R.layout.item, null, from, to, 0); lvData = (ListView) findViewById(R.id.lvData); lvData.setAdapter(scAdapter); getSupportLoaderManager().initLoader(0, null, this); } In simple activity code works ok, but i don't know how to use that code in fragment activity. I try call that method in main class but that code: lvData = (ListView) findViewById(R.id.lvData); lvData.setAdapter(scAdapter); i put in fragment class. Program working, but list view is empty. DB is not empty. There is main parts of code: public class MainActivity extends FragmentActivity implements ActionBar.TabListener, LoaderCallbacks&lt;Cursor&gt; { //*****ОСНОВНЫЕ ПЕРЕМЕННЫЕ***** private static String TAG = "MainActivity"; private static final int CM_DELETE_ID = 1; private static final int RESET_STOPWATCH = 2; static ListView lvData; static DB db; static SimpleCursorAdapter scAdapter; static Context ctx; static String[] from = new String[] {DB.COLUMN_NAME, DB.COLUMN_TIME }; static int[] to = new int[] { R.id.tvTextName, R.id.tvText_time}; SectionsPagerAdapter mSectionsPagerAdapter; ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mSectionsPagerAdapter = new SectionsPagerAdapter( getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager .setOnPageChangeListener(new …
tagged with: sqlite
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24116591
favorite count: 0
upvote count: 2
tagged with: android
has title: Cant read sqlite database in listview android
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/22842971
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34846811
has title: Ant Java Major/Minor 51.0 issue even though 1.6 is targeted
answer count: 0
has body: I have a major.minor version 51.0 exception in my java code. I am using Ant to compile and run. I understand that this issue is because my java code is being compiled as 1.7 and then being run as 1.6. However in my Ant script I am explicitly targeting 1.6 and cant find the issue. My ant script is below: <?xml version="1.0" encoding="windows-1252" ?> <include name="**/*.jar"/> <property name="classes" value="${basedir}/target/classes"/> <property name="javac.debug" value="on"/> <property name="javac.nowarn" value="off"/> <property name="javac.deprecation" value="off"/> <property name="jar.dir" value="${basedir}/target/jar"/> <property name="jar.name" value="jiraClient.jar"/> <tstamp/> <tstamp/> <mkdir dir="${classes}"/> <mkdir dir="${jar.dir}"/> <src path="${basedir}/src/main/java"/> <pathelement location="${classes}"/> My JAVA_HOME is C:\Oracle\Middleware\jdk160_24 My java -version is "1.6.0_24" My Ant version is "1.7.1" I don't understand how I am getting a 51.0 exception when my Ant is 1.6?
tagged with: java
type: Question
tagged with: ant
score: 0
has comment: http://stackoverflow.com/comment/34870601
has comment: http://stackoverflow.com/comment/34845139
linked to: http://stackoverflow.com/q/10543336

http://stackoverflow.com/q/22921828
accepted answer: http://stackoverflow.com/a/23033044
has body: I'm struggling to find the best way to handle the following use case. I've a Wordpress based website and I'm developing a Java EE based web application to handle a particular process that can't be handled in Wordpress. The user base is the same, so I would like to allow the user to sign on on Wordpress and on my Glassfish deployed Java EE application with the same credentials. I'm not talking of SSO, I just need to ensure that the same username/password works in both applications. The solutions that come into my mind are the following (each one has a drawback): setup a jdbcRealm using the wp_users table via a custom jdbc resource. This is not working since Wordpress uses salt and IMHO there's no way to tell Glassfish how to use the same salting mechanism implement a Glassfish authenticator (I've done it for FB login and it's easy) and compute the salted password from the plain text one. This is not going to work since I don't know how to compute WP salted passwords in Java create the user from Glassfish directly into the wp_users table. This is not going to work because recent Wordpress versions can't use plain MD5 and because I've not found a way to compute WP salted passwords in Java use WP XML-RPC API to check the credentials. Does some of you has ever tried to do this? Is this actually possible with the standard WP API? finally the most promising solution is this library which is a Java implementation of the Portable PHP password hashing framework. Before trying this, I'd like to know if anyone has successfully tried it. Any other idea is appreciated. Thank you.
has title: Using Wordpress wp_users table to perform Glassfish authentication
type: AnsweredQuestion
tagged with: java
tagged with: wordpress
tagged with: authentication
type: Question
tagged with: jakarta-ee
answer count: 1
tagged with: glassfish
has answer: http://stackoverflow.com/a/23033044
score: 0

http://stackoverflow.com/q/22827114
has answer: http://stackoverflow.com/a/22829172
tagged with: multithreading
score: 2
has body: OK, So I have these classes that extend Thread, what I'm supposed to do is: Let all alumns arrive. When alumns arrive they say 'Hi'. If the teacher arrives but not all of the Alumns have arrived then he should wait() for them. Alumns should notify() the teacher when they're all there. An alumn is a Thread initialized with boolean value 0. A teacher is a Thread initialized with boolean value 1. Person/Greeting Code public class Person extends Thread { private Thread t; private String threadName; boolean id; Greeting greeting; public Person(String name,boolean tipo,int n){ this.threadName = name; this.id=tipo; greeting =new Greeting(); } @Override public void run() { if(id==false) { try { greeting.alumn(threadName); } catch (InterruptedException ex) { ex.printStackTrace(); } } else{ try { greeting.teacher(threadName); } catch (InterruptedException ex) { ex.printStackTrace(); } } } public void start() { System.out.println("Starting "+ threadName); if(t==null) { t=new Thread(this,threadName); t.start(); } } } class Greeting { public void alumn(String s) throws InterruptedException{ System.out.println(s); synchronized (this){ System.out.println("Alumn: "+s); notifyAll(); } } public synchronized void teacher(String s) throws InterruptedException { wait(); System.out.println(s); } } Main class public class ClassRoom { public static void main(String [] args) { Person francisco = new Person("Francisco",false,1); Person jesus = new Person("Jesus", false,2); Person alberto = new Person("Alberto",false,3); Person karla = new Person("Karla",false,4); Person maestro = new Person("Professor",true,0); francisco.start(); jesus.start(); alberto.start(); karla.start(); maestro.start(); } } The problem: If the teacher arrives first he goes to wait()...then alumns arrive but he never wakes up. If the teacher doesn't arrive first, he still never wakes up! How to fix this?
tagged with: java
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34817122
has comment: http://stackoverflow.com/comment/34817018
has comment: http://stackoverflow.com/comment/34816422
favorite count: 0
has answer: http://stackoverflow.com/a/22831164
has comment: http://stackoverflow.com/comment/34816442
has title: Thread not waking up after notifyAll();
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/34785027
type: Comment
has text: That could be simple, i know that, but here senario is different, I have data in the text file, That text file contains, original_position as well as current_position of the array, based on that i would like to set the data in array-II. i.e manual shuffle.
type: AnswerComment
comment on: http://stackoverflow.com/a/22809431
score: 0

http://stackoverflow.com/comment/34951830
type: QuestionComment
comment on: http://stackoverflow.com/q/22901743
type: Comment
has text: I just get your layout file and implement initControls() method. It is work fine for me. Clean and build. Then check the spellings. It is NullPointerException, that means the button called :calculate not initialize correctly when it is called.
score: 0

http://stackoverflow.com/comment/34977442
score: 0
type: Comment
type: QuestionComment
has text: Can you try to improve your question a little bit? It's hard to understand what you want to achieve.
comment on: http://stackoverflow.com/q/22916284

http://stackoverflow.com/comment/34971828
type: Comment
comment on: http://stackoverflow.com/a/22909070
has text: I attempted using 'new Client("127.0.0.1").startRunning();' instead. It now successfully makes a connection with the server, but no elements (no text, textFields etc.) are displayed in the Client window.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22878725
accepted answer: http://stackoverflow.com/a/22878805
has body: I want to create a text file using java which is write protected so that no body can make changes to it.
favorite count: 0
type: Question
answer count: 1
tagged with: java
has title: Create write protected file using java
has comment: http://stackoverflow.com/comment/34909845
upvote count: 0
downvote count: 5
has answer: http://stackoverflow.com/a/22878805
tagged with: java-io
type: AnsweredQuestion
score: -5

http://stackoverflow.com/comment/34993402
has text: Yepper. Even though you might be registering the Receiver for only `ACTION_DOWNLOAD_COMPLETE`, it's just good practice to it that way. Among other things, it would make it obvious to anyone reading your code exactly what you're doing.
comment on: http://stackoverflow.com/q/22923907
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/65043024
comment on: http://stackoverflow.com/a/23020164
score: 0
type: AnswerComment
type: Comment
has text: I wish you explained what was going here a bit more. I don't fully understand what this is doing.

http://stackoverflow.com/a/22889615
accepted answer of: http://stackoverflow.com/q/22889552
has comment: http://stackoverflow.com/comment/34929933
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34930698
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22889552
has body: Callbacks in Java have been traditionally done with interfaces (for instance Runnable and Callable). Java 8 has introduced Lambda expressionss which alter the syntax of callbacks, but not the underlying mechanics (as far as I understand them). Note that anything that uses the observer pattern is essentially using a callback structure, including ActionListeners, PropertyChangeListeners, etc. And these are often based on passing interface implementations (or now lambda expressions) into method parameters.

http://stackoverflow.com/comment/35023165
type: Comment
comment on: http://stackoverflow.com/a/22920077
type: AnswerComment
has text: of course, that's made by your own... just read `letter` from user input as I said
score: 0

http://stackoverflow.com/comment/34855060
has text: In other words, if I need a format input I'd better use Scanner rather than stream, right?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22848534

http://stackoverflow.com/a/22855465
has comment: http://stackoverflow.com/comment/35004887
accepted answer of: http://stackoverflow.com/q/22845574
has comment: http://stackoverflow.com/comment/34994566
has comment: http://stackoverflow.com/comment/41404083
has comment: http://stackoverflow.com/comment/41398225
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35185807
has comment: http://stackoverflow.com/comment/34964460
has comment: http://stackoverflow.com/comment/34994521
type: Answer
answers question: http://stackoverflow.com/q/22845574
upvote count: 114
has comment: http://stackoverflow.com/comment/89183407
has body: Interesting problem. There are several things going on here. No doubt this could be solved in less than half a page of Haskell or Lisp, but this is Java, so here we go.... One issue is that we have a variable number of filters, whereas most of the examples that have been shown illustrate fixed pipelines. Another issue is that some of the OP's "filters" are context sensitive, such as "top 50% by a certain order". This can't be done with a simple filter(predicate) construct on a stream. The key is to realize that, while lambdas allow functions to be passed as arguments (to good effect) it also means that they can be stored in data structures and computations can be performed on them. The most common computation is to take multiple functions and compose them. Assume that the values being operated on are instances of Widget, which is a POJO that has some obvious getters: class Widget { String name() { ... } int length() { ... } double weight() { ... } // constructors, fields, toString(), etc. } Let's start off with the first issue and figure out how to operate with a variable number of simple predicates. We can create a list of predicates like this: List&lt;Predicate&lt;Widget&gt;&gt; allPredicates = Arrays.asList( w -&gt; w.length() &gt;= 10, w -&gt; w.weight() &gt; 40.0, w -&gt; w.name().compareTo("c") &gt; 0); Given this list, we can permute them (probably not useful, since they're order independent) or select any subset we want. Let's say we just want to apply all of them. How do we apply a variable number of predicates to a stream? There is a Predicate.and() method that will take two predicates and combine them using a logical and, returning a single predicate. So we could take the first predicate and write a loop that combines it with the successive predicates to build up a single predicate that's a composite and of them all: Predicate&lt;Widget&gt; compositePredicate = allPredicates.get(0); for (int i = 1; i &lt; allPredicates.size(); i++) { compositePredicate = …
has comment: http://stackoverflow.com/comment/34948733
has comment: http://stackoverflow.com/comment/126777736
has comment: http://stackoverflow.com/comment/41363755
has comment: http://stackoverflow.com/comment/41363941
score: 114

http://stackoverflow.com/comment/45199731
type: Comment
comment on: http://stackoverflow.com/a/22947952
type: AnswerComment
score: 0
has text: when we override `getLoginPageUrl()` we need to fetch the requested URL for redirect to specific page ?

http://stackoverflow.com/comment/34850698
has text: Looks like it worked no?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22845663

http://stackoverflow.com/q/22890132
answer count: 1
tagged with: generics
linked to: http://stackoverflow.com/q/2770321
has answer: http://stackoverflow.com/a/22907385
tagged with: javafx-2
type: AnsweredQuestion
tagged with: guava
has body: I am currently trying to write my first JavaFX app that writes messages decoded from a socket into a JavaFX Table. The table needs to be dynamic and if a message has data that currently doesn't exist in the table a new column should be added. Some of the fields are nested in a wrapper class and I was trying to represent these nesting using a Nested Column as seen here: http://docs.oracle.com/javafx/2/ui_controls/table-view.htm#CJABHBEH My issue is I cannot seem to get the correct data to bind to the nested columns. When I try binding to PropertyValueFactory("one") for my CustomType I am getting Optionals from MessageType1. I have tried a couple of different things as you will see in my sample below: import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.stage.Stage; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; public class SampleTable extends Application { private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); private final ObservableList&lt;Message&gt; msgList = FXCollections.observableArrayList(); public static void main(final String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { final TableView tableView = new TableView&lt;&gt;(msgList); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); final TableColumn&lt;Message, MessageType&gt; msgTypeCol = new TableColumn&lt;Message, MessageType&gt;(); msgTypeCol.setText("Message Type"); msgTypeCol.setCellValueFactory(new PropertyValueFactory&lt;Message, MessageType&gt;(…
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22907385
has title: JavaFX Binding to Nested Column
score: 0

http://stackoverflow.com/q/22849049
linked to: http://stackoverflow.com/q/18205455
favorite count: 0
tagged with: nullpointerexception
type: Question
has title: Keep on getting this error; Exception in thread "main" java.lang.NullPointerException
upvote count: 2
linked to: http://stackoverflow.com/q/4301329
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34856524
downvote count: 2
has comment: http://stackoverflow.com/comment/34856086
duplicate of: http://stackoverflow.com/q/4301329
has answer: http://stackoverflow.com/a/22849098
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34856071
has answer: http://stackoverflow.com/a/22849116
has body: I keep on get this error: Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.&lt;init&gt;(Unknown Source) at SlotMachinePanel.&lt;init&gt;(SlotMachinePanel.java:55) at SlotMachineDriver.main(SlotMachineDriver.java:16) I am not sure what I am doing wrong, am I referencing the images to the wrong spot? I tried debugging but I'm not sure what the issue is. Please advise me on what to do. Below is my code //----------------------------------- // Slot Machine Panel //----------------------------------- import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.Random; public class SlotMachinePanel extends JPanel { private JPanel buttonPanel, newSlotsPanel, primary; private JButton spin, cashout; private JLabel spinlabel, cashoutlabel, slotsPanelLabel1, slotsPanelLabel2; private JLabel imageLabel; private ImageIcon icon; private int spinResult = 0; private int currentTokens = 5; //--------------------------------------------------------------------- //Constructor: Sets up the SlotMachine GUI. //--------------------------------------------------------------------- public SlotMachinePanel () { //Creation of primary (Background Panel) primary = new JPanel (); primary.setPreferredSize (new Dimension(325,275)); primary.setBackground (Color.red); //Creation of newSlotsPanel (Slot Screen Panel) newSlotsPanel = new JPanel (); newSlotsPanel.setPreferredSize (new Dimension (300,175)); newSlotsPanel.setBackground (Color.white); slotsPanelLabel1 = new JLabel ("Current Tokens:" + currentTokens); slotsPanelLabel2 = new JLabel ("Result of Spin:" + spinResult); //Creation of buttonPanel (Button Panel) buttonPanel = new JPanel(); buttonPanel.setPreferredSize (new Dimension(300,80)); buttonPanel.setBackground (Color.blue); //Creation of spin button spin = new JButton("Spin"); spin.addActionListener (new SpinListener()); spinlabel = new JLabel ("Only costs 1 token to spin! Good luck!"); spinlabel.setForeground (Color.white); //Creation…

http://stackoverflow.com/a/22942731
type: Answer
answers question: http://stackoverflow.com/q/22941081
has body: With new Java 8 syntax the code could look something like this: times.stream() .sorted((d1, d2) -&gt; d1.compareTo(d2)) // or just sorted() for default algorithm .distinct() .forEach(d -&gt; System.out.println(d));
score: 0

http://stackoverflow.com/a/22945384
has body: My current assumption is this public boolean guessLetter(char c) { // convert received character to letter Letter letter = new Letter(c); // loop through your list of letters for(Letter l : letters) { // if list of letters contains same letter as the one you received then return true if(l.getLetter() == letter.getLetter()) return true; } // we did not find the letter, so we return false return false; } Please do make sure that you read this code and understand it. No one is going to cry if you fail the class because you chose to copy paste the answer.
has comment: http://stackoverflow.com/comment/35030627
upvote count: 1
has comment: http://stackoverflow.com/comment/35030248
has comment: http://stackoverflow.com/comment/35030215
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22945051
has comment: http://stackoverflow.com/comment/35030119
has comment: http://stackoverflow.com/comment/35030553
score: 1
has comment: http://stackoverflow.com/comment/35030126

http://stackoverflow.com/comment/34971368
comment on: http://stackoverflow.com/a/22913029
type: AnswerComment
score: 0
type: Comment
has text: Do i have to import this function to make it work ? As it comes up with red lines

http://stackoverflow.com/a/22852562
has comment: http://stackoverflow.com/comment/34863236
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22852113
has comment: http://stackoverflow.com/comment/34862903
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/34863044
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22852113
has comment: http://stackoverflow.com/comment/34862845
has body: Java is an object-oriented language, so I'll just use objects: Create a Student object with the three values you want to store (and a toString() method to print them separated by "%": public class Student { private final String name; private final int number; private final int prizeMoney; public Student(final String name, final int number, final int prizeMoney) { this.name = name; this.number = number; this.prizeMoney = prizeMoney; } @Override public String toString() { return name+"%"+number+"%"+prizeMoney; } public int getPrizeMoney() { return prizeMoney; } } Read your lines as Student objects, and store them in a List: final Scanner scan = new Scanner(new File("/path/to/StudentsList")); final List&lt;Student&gt; students = new ArrayList&lt;Student&gt;(); while (scan.hasNextLine()) { final Scanner line = new Scanner(scan.nextLine()); line.useDelimiter("%"); students.add(new Student(line.next(), line.nextInt(), line.nextInt())); line.close(); } scan.close(); Order the List with a custom Comparator, and print it: students.sort(new Comparator&lt;Student&gt;() { @Override public int compare(final Student s1, final Student s2) { return s1.getPrizeMoney()-s2.getPrizeMoney(); } }); for (final Student student: students) System.out.println(student); Output: Javis%4532%100 Kevin%7657%400 Green%3243%1000 Stefan%31231%1000 IronMan%5435%2000 Lamp%534%3000 Bob%5435%5000 Frank%345%10000

http://stackoverflow.com/q/22825619
accepted answer: http://stackoverflow.com/a/22825828
score: 0
tagged with: java
has body: Would someone please show me how i could make min and max into methods ? I really have no idea and i tried lots of things but i failed I am only a beginner .................................................................. Here is my code now class ArrayCalculator { public static void main(String arng[]) { int max=0; // sum of maximum number in array int min=0; // sum of minimum numbers in array int total=0; // sum of total nnymbers in array int average=0; // sum of average number in array System.out.println(""); System.out.println("*****************WELCOME TO ARRAY CALCULATOR****************"); // Introducton to calculater System.out.println("****************-----------------------------***************"); System.out.println("*****************---------------------------****************"); System.out.println("How Many Numbers Would You Like To Calculate?"); // read in numbers entered by user int Items = EasyIn.getInt(); int[] numbers = new int[Items]; // array for numbers entered for(int i = 0; i&lt; Items; i++) { System.out.println("Enter number " + (i+1)); // read in each figure entered by user numbers[i]=EasyIn.getInt(); total=numbers[i]; total = total + numbers[i]; min=numbers[0]; max=numbers[0]; if (numbers[i] &gt; max) // calculations for maximum number { max = numbers[i]; } else if (numbers[i] &lt; min) // calculations for minimum number { min = numbers[i]; } } average = total/Items; // calculations for average number System.out.println("*********************************************"); System.out.println("You have entered " +numbers.length+" numbers"); // display count of numbers entered System.out.println("Largest number in array is " +max); // display maximum number System.out.println("Smallest number in array is " +min); // display minimum number System.out.println("Total Numbers is " +total); // display total sum of numbers System.out.println("Average is " +average); // display average number System.out.println("Thank You"); System.out.println("***********…
linked to: http://stackoverflow.com/q/3691940
type: Question
possible better answer: http://stackoverflow.com/a/22825710
has answer: http://stackoverflow.com/a/22825710
has comment: http://stackoverflow.com/comment/34814022
has comment: http://stackoverflow.com/comment/34813979
has title: methods in java program?
answer count: 3
has answer: http://stackoverflow.com/a/22825828
has comment: http://stackoverflow.com/comment/34814042
has comment: http://stackoverflow.com/comment/34813994
has comment: http://stackoverflow.com/comment/34815428
has comment: http://stackoverflow.com/comment/34814150
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22825813
has comment: http://stackoverflow.com/comment/34814028

http://stackoverflow.com/a/22823252
score: 1
has body: Read your code: int i=0; int[] Array = new int[i]; //--&gt; Array = new int[0] ... while (k &lt;= Math.sqrt(Array[i])) //"i" can be any number, but Array has size 0. Move i = keyboard.nextInt(); before the initialization of Array
answers question: http://stackoverflow.com/q/22823224
has comment: http://stackoverflow.com/comment/34810085
type: Answer
has comment: http://stackoverflow.com/comment/34810048
has comment: http://stackoverflow.com/comment/34810164
has comment: http://stackoverflow.com/comment/34809949
has comment: http://stackoverflow.com/comment/34809986
upvote count: 1
has comment: http://stackoverflow.com/comment/34810147
downvote count: 0

http://stackoverflow.com/q/22932395
accepted answer: http://stackoverflow.com/a/22933131
downvote count: 0
possible better answer: http://stackoverflow.com/a/22934722
has comment: http://stackoverflow.com/comment/35007648
answer count: 3
has answer: http://stackoverflow.com/a/22934722
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22933131
has body: I'm using Apache POI API to access an Excel .xlsx file, using the API I can read/write cells. My problem is: How can I do that with the .xlsx file opened in Excel GUI? If I try to do that I have conflict arising from concurrent access to the same resource (The process cannot access the file because it is being used by another process). I have been told that the answer is Excel RTD and c#, c++ or other languages. BUT I want to stick with Java,what could I do? Is switching to linux an option? THANKS!!!
tagged with: excel
has title: Apache POI and EXCEL
has answer: http://stackoverflow.com/a/34022654
type: AnsweredQuestion
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/35009950
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/22919096
has answer: http://stackoverflow.com/a/43302408
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/51505544
has comment: http://stackoverflow.com/comment/34982258
has answer: http://stackoverflow.com/a/45567205
has answer: http://stackoverflow.com/a/52459404
score: 2
has body: My Question is- Given two strings s1 and s2 of equal length as input, the expected output is a string which the 1st char from s1, then 1st char from s2, then 2nd char from s1, then 2nd char from s2 and so on. For e.g. if s1=”Outer”, s2 = “Space”, the output is “OSuptaecre”. I have done it with loops and I want to know if there is any other simple code for this program like use of string functions. public class JoinChars { static String testcase1 = "Right"; static String testcase2 = "Wrong"; public static void main(String args[]){ JoinChars testInstance= new JoinChars(); String result = testInstance.join(testcase1,testcase2); System.out.println(result); } public String join(String str1, String str2){ String str3=""; if(str1.length()&gt;=str2.length()){ for(int i=0;i&lt;str1.length();i++){ str3+=str1.charAt(i); for(int j=i;j&lt;str2.length();){ str3+=str2.charAt(j); break; } } } else if(str2.length()&gt;=str1.length()){ for(int i=0;i&lt;str2.length();i++){ str3+=str2.charAt(i); for(int j=i;j&lt;str1.length();){ str3+=str1.charAt(j); break; } } } return str3; } }
has answer: http://stackoverflow.com/a/22919542
has answer: http://stackoverflow.com/a/22919186
tagged with: string
has answer: http://stackoverflow.com/a/54845731
favorite count: 0
has answer: http://stackoverflow.com/a/43310020
linked to: http://stackoverflow.com/q/25954495
type: Question
has answer: http://stackoverflow.com/a/69613497
has answer: http://stackoverflow.com/a/47617274
answer count: 13
upvote count: 3
has title: How to build a string taking alternate characters from two equal length input strings?
downvote count: 1
has comment: http://stackoverflow.com/comment/34982286
has answer: http://stackoverflow.com/a/45413131
has answer: http://stackoverflow.com/a/22919233
has answer: http://stackoverflow.com/a/36253092

http://stackoverflow.com/q/22848723
has comment: http://stackoverflow.com/comment/34855510
has answer: http://stackoverflow.com/a/22848909
has title: recursion, computing sum of positive integers
downvote count: 1
has comment: http://stackoverflow.com/comment/34855576
type: Question
has comment: http://stackoverflow.com/comment/34855680
tagged with: recursion
has comment: http://stackoverflow.com/comment/34855595
has body: so, my whole point is to print out the sum of positive numbers, and i have it adding and printing just fine, the only issue it is also adding the negative numbers. any ideas on why this could be? i just want it to add the positive numbers. public static double computeSumPositive(double[]numbers, int count) { double total=0; { if(count&gt;0) { total = numbers[count-1] + computeSumPositive(numbers, count -1); return total; } else return total; } }
has answer: http://stackoverflow.com/a/22848943
tagged with: java
has comment: http://stackoverflow.com/comment/34855444
upvote count: 1
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/34855778
answer count: 3
accepted answer: http://stackoverflow.com/a/22848909
possible better answer: http://stackoverflow.com/a/22848943
has answer: http://stackoverflow.com/a/60784761
type: AnsweredQuestion

http://stackoverflow.com/a/22897833
accepted answer of: http://stackoverflow.com/q/22896682
upvote count: 3
has body: Instead of onCreate() move all ur initialization into onCreateView() as those buttons and textview is in ur fragment_main.xml thats why u got NPE as those buttons and textview is not the part of activity_main.xml. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); counter = 0; add = (Button) rootView.findViewById (R.id.bAdd); sub = (Button) rootView.findViewById (R.id.bsub); display = (TextView) rootView.findViewById(R.id.tvDisplay); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter++; display.setText("Your total is " + counter); } }); sub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter --; display.setText("Your total is " + counter); } }); return rootView; }
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22896682
has comment: http://stackoverflow.com/comment/34944431
score: 3

http://stackoverflow.com/a/22812392
downvote count: 0
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34791125
has body: Unless there is a pressing need to change values after construction, I'd strongly recommend setting the fields in the constructor. The reason is that only fields set in the constructor can be made immutable, and immutability is a very good thing, as it makes it impossible for the class to be altered, by reflection or any other means. An example of a final field: public class MyClass { private final int id; public MyClass(int id) { this.id = id; } When a field is changeable in a setter, the only way to lock the class down is by either doing a check such as public void setID(int id) { if(id != -1) { throw new IllegalStateException("Already set!"); } this.id = id; } Or by somehow locking the object as a whole: public void lock() { if(getID() == -1) { throw new IllegalStateException("Must first setID(i)."); } isLocked = true; } public void setID(int id) { if(isLocked()) { throw new IllegalStateException("isLocked() is true."); } this.id = id; } As should be obvious, setting fields in the constructor is a whole lot less complicated.
answers question: http://stackoverflow.com/q/22812104

http://stackoverflow.com/comment/35034273
has text: getIcon() Worked! (See default question below "Solved:")
type: QuestionComment
comment on: http://stackoverflow.com/q/22923514
score: 0
type: Comment

http://stackoverflow.com/comment/34997847
score: 0
type: AnswerComment
type: Comment
has text: shoot, I'm mad that I didn't pick that up. it works now, thank you very much!
comment on: http://stackoverflow.com/a/22927225

http://stackoverflow.com/comment/34824025
has text: Yes. All SingleValueConverters have to override toString to represent single value object. For more complex objects you can look at com.thoughtworks.xstream.converters.Converter (these kinds of converters might be registered with the same way).
comment on: http://stackoverflow.com/a/22828686
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34859126
has text: How about showing some code?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22850583
type: QuestionComment

http://stackoverflow.com/q/22895905
upvote count: 1
has answer: http://stackoverflow.com/a/22896133
type: Question
tagged with: algorithm
has body: My problem is that right now my A* algorithm in java can find the path only if it goes from top down and from left to right. I want the code to be able to check top bottom left right before deciding where to move not only bottom and right. Can you guys help me? This is my code public class PathFinder extends AStar<PathFinder.Node>{ private int[][] map; public static class Node{ public int x; public int y; Node(int x, int y){ this.x = x; this.y = y; } public String toString(){ return "(" + x + ", " + y + ") "; } } public PathFinder(int[][] map){ this.map = map; } protected boolean isGoal(Node node){ return (node.x == map[0].length - 1) && (node.y == map.length - 1); } protected Double g(Node from, Node to){ if(from.x == to.x && from.y == to.y) return 0.0; if(map[to.y][to.x] == 1) return 1.0; return Double.MAX_VALUE; } protected Double h(Node from, Node to){ /* Use the Manhattan distance heuristic. */ return new Double(Math.abs(map[0].length - 1 - to.x) + Math.abs(map.length - 1 - to.y)); } protected List<Node> generateSuccessors(Node node){ List<Node> ret = new LinkedList<Node>(); int x = node.x; int y = node.y; if(y < map.length - 1 && map[y+1][x] == 1) ret.add(new Node(x, y+1)); if(x < map[0].length - 1 && map[y][x+1] == 1) ret.add(new Node(x+1, y)); return ret; } public static void main(String [] args){ int [][] map = new int[][]{ {1, 0, 1, 0, 1, 0 ,1 ,0, 1, 0 ,1, 0}, {1, 1, 1, 1, 1, 1, 1 ,1 ,1 ,1, 1 ,1}, {1, 1, 1, 0, 1, 1 ,1, 1, 1 ,0, 1 ,0}, {0, 1, 1, 1, 1, 1 ,0, 1, 0, 1, 1 ,1}, {0, 0, 1, 1, 1, 0 ,1, 1 ,1, 1, 0 ,0}, {0, 1, 0, 1, 0, 0, 1, 1, 1, 1 ,1, 1}, {1, 1, 1, 1, 1, 1, 1 ,0 ,1 ,0, 1, 0}, {1, 0, 0, 0, 1, 0 ,1, 1 ,1 ,0 ,1 ,1}, {1, 1, 0, 1, 1, 0 ,1 ,0 ,1, 1, 1, 0}, {1, 1, 1, 1, 0, 1, 1 ,1 ,0 ,1, 1 ,1}, {1, 0, 1, 1, 1, 1, 0, 1, 1 ,0 ,1, 0}, {1, 0, 1, 0, 1, 1, 0 ,1, 0, 1, 1 ,1} }; PathFinder pf = new PathFinder(map); System.out.println("Find a path from the top left corner to the right bottom one."); for(int i = 0; i < map.length; i++){ for(int j = 0; j < map[0].le…
has title: A* algorithm not looking every where
has comment: http://stackoverflow.com/comment/34940585
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22896133
favorite count: 0
type: AnsweredQuestion
tagged with: a-star
score: 1
tagged with: java

http://stackoverflow.com/comment/34873818
comment on: http://stackoverflow.com/a/22858243
has text: yes i can able to load by using this line Properties APPTEXT = new Properties(); Log.info("Getting Input from the Property file"); FileInputStream fs = new FileInputStream("C:\\FilterSection\\dropdown.properties"); APPTEXT.load(fs); System.out.println ("" +APPTEXT); but the problem how will you pick. In which line are you picking value from the property file
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37652184
score: 0
has text: Whats wrong with this? You will probably set a private field of `MainActivity` class, and initialize it after `setContentView()`. But you can also write `final ImageView view = (ImageView) findViewById(R.id.imageView1)` inside the `onPictureTaken()`.
type: Comment
comment on: http://stackoverflow.com/a/22881932
type: AnswerComment

http://stackoverflow.com/a/77869710
downvote count: 0
score: 1
has body: First of all, try to check version of checkstyle in build.gradle: println checkstyle.toolVersion I believe that you've already added: plugins { id 'checkstyle' } After that try to find appropriate version of checkstyle in checkstyle releases. Download release and unpack only file /src/main/resources/google_check.xml Put google_check.xml to your project in ./config/checkstyle/ (it's default folder) Configure checkstyle in build.gradle: checkstyle { configFile file("config/checkstyle/google_checks.xml") } checkstyleMain { source = 'src/main/java' } checkstyleTest { source = 'src/test/java' } Worked for gradle 8.4, checkstyle 9.3, Java 17. Enjoy! :)
answers question: http://stackoverflow.com/q/22841805
upvote count: 1
type: Answer

http://stackoverflow.com/q/22811830
has title: Is it possible to dropWhile on a FluentIterable?
has body: I would like to do something like python's dropwhile using Iterables in java. Is it possible using FluentIterables? dropwhile removes elements from an iterable until the first one that doesn't match and then returns all the rest of the elements. I don't see an implementation like that in FluentIterable nor in Iterables.
tagged with: python
type: UnansweredQuestion
tagged with: guava
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23980874
answer count: 1
tagged with: iterable
score: 0

http://stackoverflow.com/q/22844161
has title: How do I print lines from a command-line input file to a command-line output file?
has body: the input file has lines of text like this: allison wesley 28011990 peter smith 05071992 and my code (to try and print this to an output file) is the following(im providing both the input and output as command-line args): import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class FormatNames{ public static void main(String[] args) throws FileNotFoundException{ Scanner in = new Scanner(args[0]); PrintWriter out = new PrintWriter(args[1]); while(in.hasNext()){ String str = in.next(); out.print(""+str); } in.close(); out.close(); } } Does anyone know why this doesn't work? At the moment, the only thing it outputs to the file is the name of the input file Thanks
tagged with: java
tagged with: output
type: Question
has answer: http://stackoverflow.com/a/22844244
answer count: 1
tagged with: command-line-arguments
tagged with: bluej
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34846817
type: UnansweredQuestion
tagged with: input
upvote count: 1

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/22843902
tag name: grouplayout
tags question: http://stackoverflow.com/q/22957539
tags question: http://stackoverflow.com/q/22841584

http://stackoverflow.com/a/22976899
score: 0
answers question: http://stackoverflow.com/q/22927210
type: Answer
has body: Don't create new streams per message. Use a single ObjectInoutStream and ObjectOutputStream for the life of the socket, at both ends. These streams have stream headers, and recreating them is just an opportunity to get completely out of sync.

http://stackoverflow.com/comment/34849786
type: AnswerComment
has text: nevemind, it's because the block was too small. i'm testing with bigger docs now. how would you deal with a block that is too small though?
type: Comment
comment on: http://stackoverflow.com/a/22829673
score: 0

http://stackoverflow.com/q/22873597
tagged with: maps
has answer: http://stackoverflow.com/a/22879294
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34913268
tagged with: java
accepted answer: http://stackoverflow.com/a/22879483
possible better answer: http://stackoverflow.com/a/22879079
has comment: http://stackoverflow.com/comment/34900906
type: Question
has answer: http://stackoverflow.com/a/22879079
linked to: http://stackoverflow.com/q/22879469
has comment: http://stackoverflow.com/comment/34901840
has comment: http://stackoverflow.com/comment/34901247
has body: I have two maps that get generated just fine. Now I want to stop generating them and work from a file. The map structure is private Map&lt;String, List&lt;Integer&gt;&gt; codebook = new HashMap&lt;String, List&lt;Integer&gt;&gt;(); private Map&lt;Integer, String&gt; decodebook = new HashMap&lt;Integer, String&gt;(); Below is the code I am using for saving and loading. The decodebook seems to work just fine, it is the codebook I can not seem to load back to program. I am afraid seen as I am working with a Objects it is difficult to tell if it is even saving correctly. I run the program once and this code will run be run with it. try { saveCodeBook(codebook, "CodeBook"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { saveDecodeBook(decodebook, "DecodeBook"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void saveCodeBook(Map&lt;String, List&lt;Integer&gt;&gt; obj, String filePath) throws IOException { OutputStream os = null; try { os = new ObjectOutputStream(new FileOutputStream(filePath)); ((ObjectOutputStream) os).writeObject(obj); } catch (Exception ex) { } finally { os.close(); } } public void saveDecodeBook(Map&lt;Integer,String&gt; obj, String filePath) throws IOException { OutputStream os = null; try { os = new ObjectOutputStream(new FileOutputStream(filePath)); ((ObjectOutputStream) os).writeObject(obj); } catch (Exception ex) { } finally { os.close(); } } The second time I run the program, I comment out above code. (NOT THIS Piece directly below, this is always left) private Map&lt;String, List&lt;Integer&gt;&gt; codebook = new HashMap&lt;String, List&lt;Integer&gt;&gt;(); private Map&lt;Integer, String&gt; decodebook = new HashMap&lt;Integer, String&gt;(); Ok once above code is removed, I run the program again, with this code included. public void loadBooks() throws IOException{ loadCodeBook("CodeBook"); //System.out.println(codebook); loadDeCodeBook("DecodeBook"); //Sy…
has comment: http://stackoverflow.com/comment/34903343
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34902864
has title: Issue saving Map to File in Java
has comment: http://stackoverflow.com/comment/34950729
has answer: http://stackoverflow.com/a/22879483
has comment: http://stackoverflow.com/comment/34903152
has comment: http://stackoverflow.com/comment/34913262
tagged with: save
tagged with: encryption
tagged with: file

http://stackoverflow.com/comment/35059350
type: Comment
comment on: http://stackoverflow.com/a/22960864
score: 0
has text: Once you made the above changes it should work check for any other places where you have the addAccount method
type: AnswerComment

http://stackoverflow.com/comment/34946806
score: 0
has text: Yes, sure, so I can accept it
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22898371

http://stackoverflow.com/comment/34801914
score: 0
type: Comment
type: QuestionComment
has text: I apologise for a long and badly formed query..!! I could've said this in a simpler way..
comment on: http://stackoverflow.com/q/22818973

http://stackoverflow.com/comment/34794629
has text: Show us the declaration and the initialization of the field (or variable) `klantenBindingRef`.
score: 1
comment on: http://stackoverflow.com/q/22815047
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35028739
type: Comment
type: QuestionComment
has text: @bzlm Sorry Since I am new to java so i used that word simple . I need a java program for the scenario which i have mentioned above.
score: 0
comment on: http://stackoverflow.com/q/22944524

http://stackoverflow.com/q/22912692
tagged with: sql
has comment: http://stackoverflow.com/comment/35136572
tagged with: jdbc
has body: i have time string which i get from jtextfield as intime and second string which i get from database want to calculate totoal duty hrs and OverTime hrs and send it to the database in java stm=con.createStatement();rs = stm.executeQuery("Select * from InOut where Token_No='"+jTextField1.getText()+"'"); if(rs.next()) { String intime = rs.getString("In_Time");JOptionPane.showMessageDialog(null,"IN Time is '"+intime+"'"+"'"); String outtime = jTextField2.getText(); JOptionPane.showMessageDialog(null,"Out Time is '"+outtime+"'"+"'"); Please guide....
has comment: http://stackoverflow.com/comment/35473927
answer count: 0
tagged with: time
has comment: http://stackoverflow.com/comment/35136402
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35136027
type: Question
tagged with: java
has title: calculate time for Duty Hrs & OverTime Hrs in java
tagged with: string
has comment: http://stackoverflow.com/comment/35134977
has comment: http://stackoverflow.com/comment/35139061
score: 0

http://stackoverflow.com/q/22954091
tagged with: mysql
has comment: http://stackoverflow.com/comment/35046132
type: Question
has comment: http://stackoverflow.com/comment/35045431
tagged with: jsoup
score: 0
has body: I am crawling a url and adding the url links on that page to a mysql table. Is there anyway I can further crawl each link that I found and list the links within that page, and then further crawl all those links etc... Here is my crawl function: String url = "http://jsoup.org"; try { Statement stat = connection.createStatement(); Document doc = Jsoup.connect(url).get(); Elements links = doc.getElementsByTag("a"); for (Element link : links) { urlID = NextURLID; stat.executeUpdate("INSERT INTO urls VALUES ('"+urlID+"','"+link.absUrl("href")+"','','')"); NextURLID++; } } catch (IOException | SQLException e) { e.printStackTrace(); } Thanks
answer count: 0
type: UnansweredQuestion
has title: How to recursively crawl links JSOUP?
tagged with: java

http://stackoverflow.com/comment/34960099
type: Comment
has text: @KshitizSharma: It depends - if you're considering creating a new thread per request in a server, then you're basically saying that to handle 1000 requests per second, you'd be spending *all* the time creating threads.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22905938

http://stackoverflow.com/comment/35059227
comment on: http://stackoverflow.com/a/22916324
type: Comment
type: AnswerComment
score: 0
has text: Someone has privileges to look at the log files. Find that person and ask for help. There is nothing you can to on the client side to find out why this happens.

http://stackoverflow.com/comment/35067837
type: Comment
type: QuestionComment
has text: well the fastest thing I would do is: if(input.equals("Q"){System.exit("1");}
score: 0
comment on: http://stackoverflow.com/q/22966666

http://stackoverflow.com/q/22931743
answer count: 2
has answer: http://stackoverflow.com/a/22932051
has answer: http://stackoverflow.com/a/22933035
accepted answer: http://stackoverflow.com/a/22933035
tagged with: disk
upvote count: 1
has comment: http://stackoverflow.com/comment/35005570
favorite count: 0
has comment: http://stackoverflow.com/comment/35005478
possible better answer: http://stackoverflow.com/a/22932051
has body: I am receiving files through a socket and saving them to database. So, i'm receiving the byte stream, and passing it to a back-end process, say Process1 for the DB save. I'm looking to do this without saving the stream on disk. So, rather than storing the incoming stream as a file on disk and then passing that file to Process1, i'm looking to pass it while it's still in the memory. This is to eliminate the time-costly disk read &amp; write. One way i can do is to pass the byte[] to Process1. I'm wondering whether there's a better way of doing this. TIA.
tagged with: file
has title: Java - processing file in memory without the disk R/W
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35005657
downvote count: 0
score: 1
tagged with: java
tagged with: memory
has comment: http://stackoverflow.com/comment/35005840
type: Question

http://stackoverflow.com/comment/34951586
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22901651
has text: All working now, thank you everyone! It was what Amir said, I had overlooked the for loop.
type: QuestionComment

http://stackoverflow.com/q/22828986
tagged with: string-concatenation
score: 6
has comment: http://stackoverflow.com/comment/34820962
has answer: http://stackoverflow.com/a/22829045
has answer: http://stackoverflow.com/a/60438884
has answer: http://stackoverflow.com/a/22829104
downvote count: 0
has answer: http://stackoverflow.com/a/22829051
favorite count: 0
type: Question
answer count: 8
tagged with: string-formatting
tagged with: android
upvote count: 6
tagged with: java
linked to: http://stackoverflow.com/q/3656371
has answer: http://stackoverflow.com/a/22829100
has title: Concatenate 2 strings in android?
has answer: http://stackoverflow.com/a/22829060
has body: I am displaying a Error message in a Toast with strings.xml. Like this mErrorMsgId=R.string.username_or_password_incorrectfull; But now i need to concatenate the message with R.string.add_selfhosted_blog to avoid translation inconsistencies. Read some similar questions but can't figure it out. EDIT: I want to concatenate nux_add_selfhosted_blog after the word tap in the username_or_password_incorrectfull string ... The username or password you entered is incorrect \- If you\'re a self hosted user, don\'t forget to tap **Add Self Hosted Site** and fill the URL field Add self-hosted site How can i acheive this ??
has answer: http://stackoverflow.com/a/59769241
has answer: http://stackoverflow.com/a/22829973
has comment: http://stackoverflow.com/comment/34819931
type: UnansweredQuestion

http://stackoverflow.com/q/22891221
has body: I have implemented a class that should compress or expand binary input from standard input using run-length encoding. I have fixed all of the errors that were flagged by my IDE, but when I actually run it I get an error. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at runlength.RunLength.main(RunLength.java:49) Java Result: 1 BUILD SUCCESSFUL (total time: 1 second) In the code, line 49 is the following: switch (args[0]) { here is the full code: package runlength; import edu.princeton.cs.introcs.BinaryStdIn; import edu.princeton.cs.introcs.BinaryStdOut; public class RunLength { private static final int R = 256; private static final int lgR = 8; public static void expand() { boolean b = false; while (!BinaryStdIn.isEmpty()) { int run = BinaryStdIn.readInt(lgR); for (int i = 0; i &lt; run; i++) BinaryStdOut.write(b); b = !b; } BinaryStdOut.close(); } public static void compress() { char run = 0; boolean old = false; while (!BinaryStdIn.isEmpty()) { boolean b = BinaryStdIn.readBoolean(); if (b != old) { BinaryStdOut.write(run, lgR); run = 1; old = !old; } else { if (run == R-1) { BinaryStdOut.write(run, lgR); run = 0; BinaryStdOut.write(run, lgR); } run++; } } BinaryStdOut.write(run, lgR); BinaryStdOut.close(); } public static void main(String[] args) { switch (args[0]) { case "-": compress(); break; case "+": expand(); break; default: throw new IllegalArgumentException("Illegal command line argument"); } } } If anyone can explain to me what my problem is, I would really appreciate it.
score: 0
answer count: 1
duplicate of: http://stackoverflow.com/q/5554734
accepted answer: http://stackoverflow.com/a/22891246
has title: Java : Run-Length Encoding implementation
linked to: http://stackoverflow.com/q/5554734
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34932335
tagged with: run-length-encoding
type: Question
has answer: http://stackoverflow.com/a/22891246

http://stackoverflow.com/a/22848883
has body: The browser is caching the responses. Set no-cache headers in the servlet that returns the data. response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); response.setHeader("Pragma","no-cache"); That may solve it by itself on most browsers, but not on IE because IE will still try to cache responses received through Ajax. To fix this you will need to add a parameter to your Ajax POST that is a timestamp or random number. You just need to send this parameter to trick IE into working properly (by making it clear this is a unique request). You don't have to read the parameter on the servlet end.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/34885226
answers question: http://stackoverflow.com/q/22844044
has comment: http://stackoverflow.com/comment/34887198
has comment: http://stackoverflow.com/comment/34885015

http://stackoverflow.com/comment/34835156
type: AnswerComment
type: Comment
has text: What type of node is videojet? This exception is thrown when a particular node type is not allowed to be added under the given node or if you are trying to add a node as a child of a property
comment on: http://stackoverflow.com/a/22829640
score: 1

http://stackoverflow.com/comment/34916688
type: AnswerComment
type: Comment
has text: @Braj oversight on my part :)
comment on: http://stackoverflow.com/a/22882503
score: 0

http://stackoverflow.com/comment/34809308
type: QuestionComment
comment on: http://stackoverflow.com/q/22822247
has text: Yes, I have added the trayicon on system tray bar, I just need to blink the icon just like messenger which blinks when there is new message
score: 0
type: Comment

http://stackoverflow.com/q/22960152
favorite count: 0
has comment: http://stackoverflow.com/comment/35056512
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35055605
type: Question
tagged with: object
has title: Is down casting considered bad practice?
has comment: http://stackoverflow.com/comment/35058720
has body: So, I have a set up like below where A and B are both abstract classes. abstract class ObjectA extends ObjectB&lt;ObjectC&gt; { } public class ObjectD extends ObjectA{ public static void main(String[] args){ ObjectA x = new ObjectD(); ObjectD y = (ObjectD)x; // down cast } } I'm using a library where I want to avail of the abstract methods in ObjectB and provide a default constructor for all classes - ObjectA. I'm not sure on my approach. BTW ObjectB is part of a predefine library I'm using. ObjectA is my own class providing default properties and constructor. I'm not so sure on my approach, doesn't seem nice? Just to add: ObjectA requires a type that extends ObjectA. public abstract class ObjectA&lt;T extends ObjectA&lt;T&gt;&gt; { } Hence, the need for what I'm doing.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22960256
has comment: http://stackoverflow.com/comment/35061808
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/496928
has comment: http://stackoverflow.com/comment/35055633

http://stackoverflow.com/comment/34941588
comment on: http://stackoverflow.com/q/22894510
has text: Problems with imaging?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23025059
has comment: http://stackoverflow.com/comment/57940063
has comment: http://stackoverflow.com/comment/57942756
downvote count: 0
answers question: http://stackoverflow.com/q/22880055
has body: According to Tomcat developer @mark-thomas client IP is not exposed via JSR-356 thus it is impossible to implement such a function with pure JSR-356 API-s. You have to use a rather ugly hack to work around the limitation of the standard. What needs to be done boils down to: Generate each user a token that contains their IP on initial request (before websocket handshake) Pass the token down the chain until it reaches endpoint implementation There are at least two hacky options to achieve that. Use HttpSession Listen to incoming HTTP requests with a ServletRequestListener Call request.getSession() on incoming request to ensure it has a session and store client IP as a session attribute. Create a ServerEndpointConfig.Configurator that lifts client IP from HandshakeRequest#getHttpSession and attaches it to EndpointConfig as a user property using the modifyHandshake method. Get the client IP from EndpointConfig user properties, store it in map or whatever and trigger cleanup logic if the number of sessions per IP exceeds a threshold. You can also use a @WebFilter instead of ServletRequestListener Note that this option can have a high resource consumption unless your application already uses sessions e.g. for authentication purposes. Pass IP as an encrypted token in the URL Create a servlet or a filter that attaches to a non websocket entry point. e.g. /mychat Get client IP, encrypt it with a random salt and a secret key to generate a token. Use ServletRequest#getRequestDispatcher to forward the request to /mychat/TOKEN Configure your endpoint to use path parameters e.g. @ServerEndpoint("/mychat/{token}") Lift the token from @PathParam and decrypt to get client IP. Store it in map or whatever and trigger cleanup logic if the number of sessions per IP exceeds a threshold. For ease of installation you may wish to generate encryption keys on application startup. Please note that you need to encrypt the IP even if you are doing an internal dispatch that is not visible to the …
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22880055
has comment: http://stackoverflow.com/comment/58001441
type: Answer
score: 13
upvote count: 13

http://stackoverflow.com/q/22885402
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22885665
has comment: http://stackoverflow.com/comment/34921869
has answer: http://stackoverflow.com/a/22885527
has comment: http://stackoverflow.com/comment/34921826
type: Question
has body: I am trying to compress a String. For example, if the user input is "aaabbcccd" - the output should count the letters and if count is above 1, print the letter, then the number: a3b2c3d. This is what I've come up with but my output in the console is still incorrect. public class Compress { public static void main(String[] args) { String a = IO.readString(); int aLength = aLength.length(); int repeatedStart = 0; int repeatedLength = 1; int currentStart = 0; int currentLength = 1; for(int i = 1; i &lt; aLength; i++) { if(a.charAt(i) == a.charAt(i-1)) { currentLength+=1; if(currentLength &gt; repeatedLength) { repeatedStart = currentStart; repeatedLength = currentLength; IO.outputStringAnswer(repeatedLength+""+a.charAt(repeatedStart)); } } else { currentStart = i; currentLength = 1; IO.outputStringAnswer(currentLength+""+a.charAt(currentStart)); } } } } My output in the console is: --------MacBook-Pro:cs ----------$ java Compress aaaabbcc RESULT: "2a" RESULT: "3a" RESULT: "4a" RESULT: "1b" RESULT: "1c" I know that my outputStringAnswer is definitely in the wrong place. Any help would be greatly appreciated. Thank you
downvote count: 0
has title: Compress a string "aaabbccccd" to "a3b2c4d"
tagged with: string
has answer: http://stackoverflow.com/a/22885673
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10749176
has answer: http://stackoverflow.com/a/22885874
answer count: 4
duplicate of: http://stackoverflow.com/q/10749176
has comment: http://stackoverflow.com/comment/34922194

http://stackoverflow.com/comment/34932174
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22865083
has text: Thanks. We'll try with adding a community tomorrow. How would we get the group id to create group members? Is that assigned by Connections, or by the LDAP directory? As stated in my original question, the SBT `SearchService` doesn't return groups, so doesn't seem to provide a way to find a group id.
type: AnswerComment

http://stackoverflow.com/q/22873417
has comment: http://stackoverflow.com/comment/34900690
has comment: http://stackoverflow.com/comment/34900285
has comment: http://stackoverflow.com/comment/34900782
score: 0
has comment: http://stackoverflow.com/comment/34901062
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/34900728
has comment: http://stackoverflow.com/comment/34900824
has title: Choosing a txt file with JFileChooser and making it appear on a JTextField just won't work
type: AnsweredQuestion
has body: When I press open another window appears with JFileChooser to select the file again, and when I try to select the file again it just gives me "open command canceled by user" message. The program stops working and ends with an unknown exception. Here is my code: import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextArea; import javax.swing.filechooser.FileNameExtensionFilter; public class FileC extends JFrame { File file; JFileChooser chooser = new JFileChooser(); JTextArea TArea = new JTextArea(); public FileC() { super.setLayout(new FlowLayout()); super.add(chooser); super.add(TArea); FileNameExtensionFilter filter = new FileNameExtensionFilter ( "text files " , "txt"); chooser.setFileFilter(filter); ActionHandler handler = new ActionHandler (); chooser.addActionListener(handler); } private class ActionHandler implements ActionListener { public void actionPerformed(ActionEvent e) { int returnVal = chooser.showOpenDialog(FileC.this); if (returnVal == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); } else { JOptionPane.showMessageDialog(null,"Open command cancelled by user."); } try { BufferedReader in = new BufferedReader ( new FileReader (file)); String s = in.readLine(); while (s != null) { TArea.append(s); s = in.readLine(); } }catch (FileNotFoundException z){ JOptionPane.showMessageDialog(null, "file not found"); } catch (IOException z) { z.printStackTrace(); } } } } the new codes public class FileC extends JFrame { File file; JFileChooser chooser = new JFileChooser(); JTextArea TArea = new JTextArea(); JButton b = new JButton("open"); public FileC() { TArea.setRows(10); TArea.setColumns(20); super.setLayout(new FlowLayout()); super.add(TArea)…
tagged with: java
has answer: http://stackoverflow.com/a/22874222
accepted answer: http://stackoverflow.com/a/22874222
tagged with: swing
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/34901794
tagged with: jfilechooser
type: Question

http://stackoverflow.com/q/22933218
has comment: http://stackoverflow.com/comment/35007994
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2350737
has comment: http://stackoverflow.com/comment/35008305
has comment: http://stackoverflow.com/comment/35008144
has comment: http://stackoverflow.com/comment/35010427
has comment: http://stackoverflow.com/comment/35010658
has comment: http://stackoverflow.com/comment/35008019
has comment: http://stackoverflow.com/comment/35007946
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/35008851
has answer: http://stackoverflow.com/a/22933588
type: Question
has title: Basic Java exception handling
has body: Considering following code class work { do_something() { try { // so something } catch (Throwable t) {/* operation alpha */ }// } } class thread_instance implements Runnable { work w; public void run() { try { w.do_something(); } catch (Throwable t) {/* operation beta */ }// } } Later I want to create a thread(thread_instance) and might cancel it if some conditions appear, and I would give signal to thread_instance in order to reach operation beta. class call_thread { static public void main(String...main){ Thread tx=new Thread(new thread_instance()); tx.start(); //.... if(&lt;&lt;some condition&gt;&gt;){tx.stop();} //tries to tell thread_instance about stop command } } But as word#do_something(void) is called by thread_instance and ables to catch the any exception, the operation beta won't called anyway. Question: How may I figure out if there was an exception/error by thread_instance#run(void) method, while the exception has catched by inner call (word#do_something(void))? and suppose the inner call will not throws the exception for higher level.
has comment: http://stackoverflow.com/comment/35008146
has comment: http://stackoverflow.com/comment/35007958
has comment: http://stackoverflow.com/comment/35008102
score: 0
has comment: http://stackoverflow.com/comment/35008720
has comment: http://stackoverflow.com/comment/35008396
answer count: 1
has comment: http://stackoverflow.com/comment/35010465

aide-ide
tag name: aide-ide
type: Tag
tags question: http://stackoverflow.com/q/22891758

http://stackoverflow.com/a/22831050
score: 0
has body: in your full screen activity when ever come in increate() method then u will found one file path just delete that path from there from this code File file = new File(selectedFilePath); boolean deleted = file.delete(); After delete just refresh media gallery class like this using from this line i.e u can see the changes after delete of that picture. sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(new File(filePath)))); also take permission &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
has comment: http://stackoverflow.com/comment/34824482
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34825821
has comment: http://stackoverflow.com/comment/34824456
has comment: http://stackoverflow.com/comment/34825646
has comment: http://stackoverflow.com/comment/34823622
has comment: http://stackoverflow.com/comment/34828395
has comment: http://stackoverflow.com/comment/34826876
has comment: http://stackoverflow.com/comment/34824029
type: Answer
has comment: http://stackoverflow.com/comment/34825753
has comment: http://stackoverflow.com/comment/34825270
has comment: http://stackoverflow.com/comment/34826377
has comment: http://stackoverflow.com/comment/34825697
has comment: http://stackoverflow.com/comment/34825845
has comment: http://stackoverflow.com/comment/34823948
has comment: http://stackoverflow.com/comment/34825599
has comment: http://stackoverflow.com/comment/34825544
answers question: http://stackoverflow.com/q/22830917
has comment: http://stackoverflow.com/comment/34825262
has comment: http://stackoverflow.com/comment/34823920
has comment: http://stackoverflow.com/comment/34827725
accepted answer of: http://stackoverflow.com/q/22830917

bluetooth
tags question: http://stackoverflow.com/q/22908639
tags question: http://stackoverflow.com/q/22874716
tag name: bluetooth
tags question: http://stackoverflow.com/q/22893661
tags question: http://stackoverflow.com/q/22910682
tags question: http://stackoverflow.com/q/22893045
tags question: http://stackoverflow.com/q/22846076
tags question: http://stackoverflow.com/q/22968344
tags question: http://stackoverflow.com/q/22892738
tags question: http://stackoverflow.com/q/22922116
type: Tag
tags question: http://stackoverflow.com/q/22858506
tags question: http://stackoverflow.com/q/22927585
tags question: http://stackoverflow.com/q/22845780
tags question: http://stackoverflow.com/q/22951007
tags question: http://stackoverflow.com/q/22825781

http://stackoverflow.com/comment/37565474
type: AnswerComment
comment on: http://stackoverflow.com/a/22833635
score: 0
type: Comment
has text: @alex Yes. Precisely what I thought. Isn' the responsibility of binding the model and view together lies with Controller. To make myself clear Controller should be the place where View attaches itself to a Model. I am just conceptualizing as I don't have the running code but I want to convert my Java web application to Desktop one and want to know if my assumption is correct?

http://stackoverflow.com/q/22884745
tagged with: hashtable
has answer: http://stackoverflow.com/a/22884791
upvote count: 2
type: UnansweredQuestion
tagged with: dictionary
score: 2
tagged with: algorithm
tagged with: java
has body: I am writing an implementation of a Dictionary class. I am currently writing the add method (public V add (K key, V value)) Algorithm: if the table is too full rehash grab the index based on the key probe with the index and key to resolve collisions if the table at the index is null, or has been removed increment the number of entries increment the number of locations used set the table at that index to a new tableentry else grab the value currently at that index set the value at the index to the new value return the old value I can't figure out how to grab the index based on the key provided. I also don't know how to refer to a specific index in a Hashtable. Thanks
has comment: http://stackoverflow.com/comment/34920704
type: Question
has title: Getting index of a key in a Hashtable in Java
answer count: 1
downvote count: 0
tagged with: key
has comment: http://stackoverflow.com/comment/34920683
favorite count: 0

http://stackoverflow.com/a/22851093
type: Answer
has comment: http://stackoverflow.com/comment/34897867
has comment: http://stackoverflow.com/comment/34860386
has comment: http://stackoverflow.com/comment/34894216
has comment: http://stackoverflow.com/comment/34892346
score: 0
answers question: http://stackoverflow.com/q/22850485
has body: The Eclipse terminate button performs basically what force quit in Task Manager does -- it terminates the process forcibly. Alt+F4 or CMD+Q notifies the program to be terminated, which should response in a timely manner; if it doesn't, you'll get the unresponsive program alert in Windows.

http://stackoverflow.com/q/22925293
tagged with: linked-list
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22930228
tagged with: garbage-collection
upvote count: 1
has comment: http://stackoverflow.com/comment/34994504
has body: I am implementing my own LinkedList. Right now, I'm on the clear() function which removes all of the elements from the list. Here is my code so far: public class LinkedList&lt;E&gt; { // the first element of this LinkedList private Node start; // the last element of this LinkedList private Node end; // the number of elements that constitute this LinkedList private int length; private class Node { private Node last; private Node next; private E data; // each Node has a reference to the previous Node and // the next Node. The first element of the LinkedList // will have a null reference to the previous element // and the last element will have a null reference to // the next element. Each Node stores a piece of data // in the data variable. } public void clear() { start = null; end = null; length = 0; } // other methods omitted } In the clear() function, I set the start and end references to null. I am unsure how this will affect the nodes in the middle of the linked list (or even the start and end nodes). If I have four nodes (or more) in my LinkedList, the middle two (or more) will point to each other. Once I set start and end to null, my code doesn't have any references to those objects anymore, but they have references to each other. Will these middle nodes, or even the start and end nodes, be eligible for garbage collection or not, and why? Bonus question: how could I figure this out experimentally?
tagged with: java
has comment: http://stackoverflow.com/comment/34995299
has title: Will these LinkedList nodes be eligible for garbage collection?
downvote count: 0
has answer: http://stackoverflow.com/a/22930228
has comment: http://stackoverflow.com/comment/34996824
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22930458
score: 1
has answer: http://stackoverflow.com/a/22930458
has comment: http://stackoverflow.com/comment/34994704
favorite count: 0

http://stackoverflow.com/q/22934290
has body: I want to create an application which will have: a text field that will take input from the user, and a button, which, when clicked, will open a calendar application that is already available in the phone; then, the input text will be added as a note to the selected date. How can this be done? Is it even possible to do this? If not, how can I display a calendar in my application? I guess this may be a layman's question, but I have just started up with Android programming. Also, I am planning to make the app using HTML, CSS and Javascript. Is it ok to go with it? or is it easier to use only Java and XML files?
tagged with: mobile
has title: Inserting note into already installed calender application on android phone
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22934451
has answer: http://stackoverflow.com/a/22934476
favorite count: 0
type: UnansweredQuestion
tagged with: android
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/22835757
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: jsp
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/22836355
tagged with: struts2
linked to: http://stackoverflow.com/q/20772405
has body: I have been upgraded struts 2.0 to 2.3.16.1 through the http://mvnrepository.com/ in my web application once I deployed in tomcat server its giving following error: Unable to load configuration. - bean - jar:file:/C:/Projects/apache-tomcat-7.0.50/webapps/myweb/WEB-INF/lib/struts2-image-plugin-0.1.jar!/struts-plugin.xml:8:136 ... Caused by: Unable to load configuration. - bean - jar:file:/C:/Projects/apache-tomcat-7.0.50/webapps/myweb/WEB-INF/lib/struts2-image-plugin-0.1.jar!/struts-plugin.xml:8:136 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489) Caused by: Unable to load bean: type:org.apache.struts2.views.TagLibrary class:com.aurifa.struts2.plugin.image.views.ImageTagLibrary - bean - jar:file:/C:/Projects/apache-tomcat-7.0.50/webapps/myweb/WEB-INF/lib/struts2-image-plugin-0.1.jar!/struts-plugin.xml:8:136 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:224) at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55) I updated all struts related plugins, but I couldn't find any version to update struts2-image-plugin Are there any replacement for struts2-image-plugin instead of that or any other way to resolve this issue? Appreciate if anyone give a solution or idea.
has title: struts2-image-plugin is unable to load in struts 2.3.16.1 version
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/22836355
type: AnsweredQuestion

http://stackoverflow.com/comment/34932453
comment on: http://stackoverflow.com/q/22880555
score: 0
type: Comment
has text: Very strange! I'll see only month. I've added StackTrace to the first message.
type: QuestionComment

http://stackoverflow.com/q/22830101
has answer: http://stackoverflow.com/a/22836745
type: Question
tagged with: jakarta-ee
answer count: 1
score: 0
has body: Is there are simple way how to show maintenance toolbar or page e.g. 5 min before Jboss restart ? We have tens of various Java EE applications deployed in Jboss - would be great if we could inform users about maintenance / shutdown globally (we don't want to implement such functionality in each Java app).
accepted answer: http://stackoverflow.com/a/22836745
has title: maintenance page / toolbar in Jboss
type: AnsweredQuestion
tagged with: java
tagged with: jboss

http://stackoverflow.com/q/22812575
answer count: 2
has answer: http://stackoverflow.com/a/22815989
tagged with: sockets
tagged with: asynchronous
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22814469
type: Question
tagged with: java
has title: Asynchronous send and receive using datagramSockets in java
has body: I am new to Socket programming in java, but quite familiar with the .NET socket programming. I wanted to know that, how can we asynchronously exchange(send/receive) the packets/messages using datagramsockets in java. Like C# provides BeginSend and BeginReceive methods for this purpose , Does java also provide something like this.
score: 0

http://stackoverflow.com/q/22809300
linked to: http://stackoverflow.com/q/21279085
downvote count: 0
has comment: http://stackoverflow.com/comment/35009644
has comment: http://stackoverflow.com/comment/34784594
has comment: http://stackoverflow.com/comment/34784517
has body: My Java application works fine with all previous versions of Java apart from JRE1.7 Update 51. Though i minimized the security level to minimum and added my url to Exception list, the app is still blocked. Note: My client side jar is signed and server side jar is not signed. Any suggestions would be of great help.
favorite count: 0
has comment: http://stackoverflow.com/comment/34784137
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34784553
upvote count: 1
has comment: http://stackoverflow.com/comment/34784361
linked to: http://stackoverflow.com/q/19440354
tagged with: backwards-compatibility
answer count: 0
score: 1
tagged with: java
has title: Java Web Application not working with JRE1.7 Update 51
type: Question

http://stackoverflow.com/comment/34817667
has text: Or this thread: https://stackoverflow.com/questions/3814055/writing-data-to-system-in
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22827630

http://stackoverflow.com/comment/34842103
comment on: http://stackoverflow.com/q/22841368
type: Comment
type: QuestionComment
has text: @BrettOkken wrote the example pretty quick. I mean this. Thanks
score: 0

http://stackoverflow.com/comment/35017283
score: 0
type: AnswerComment
type: Comment
has text: So, I should have `JPanel` (say main), which should contain another `JPanel` (say map) with layout and other components, and I should add `JScrollPane(map)` to the main, correct? Otherwise I'm confused.
comment on: http://stackoverflow.com/a/22937780

http://stackoverflow.com/q/22883690
has title: Java: How to have one array reference the start of another?
accepted answer: http://stackoverflow.com/a/22883796
tagged with: indexing
type: AnsweredQuestion
has body: Im trying to make a fun application that will take a sound file and modify it, and create a new sound file. One of the things I am trying to do is make the sound file twice as long. So I essentially make a new array that goes {2,2,3,3,7,7,8,8} instead of the original {2,3,7,8}. I am using doubles, this is simply an example I want the original array (samples) to now reference the start of the array I just created (temp) so when the file saves it now save the temp array. I can increase or decrease the volume of the music file no problem, and save it as such. I omitted that part of the code as it is not pertinent here. If anyone is kind enough to help me, I also want to know the why behind it public class Sound { double[] samples; //So we only have to declare it once. Reference to an array public Sound() { //This constructor should initialize the samples array to be empty samples = new double[0]; //Initialize an array with nothing because we will be using that to reference the //location of other arrays } public void wavRead(String fileName) { samples = WavIO.read(fileName); //Samples was an adress of an array we set to 0. Then we used WavIO to create an aray of doubles, now //we tell samples to reference this new address over here. Samples has the addsss of the new array } public void wavSave(String fileName) { WavIO.write(fileName, samples); } public void lengthen() { double[] temp = new double[(samples.length *2)]; int t = 0; for(int i = 0; i &lt; samples.length; i++) { //Set a variable to increase the temp array by temp[t] = samples[i]; //Have position 0 of temp = position 0 of soundRaw t++; //Increase the position in the temp array by one temp[t] = samples[i]; //Have position 1 of temp array = position 0 of soundRaw } samples[0] = temp; //Here is where I try and have the samples array reference the start of another array. I tried multiple things, this is simply the last effort I tried } And here is the application I am using to test the code public class App { pub…
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22883772
has answer: http://stackoverflow.com/a/22883822
tagged with: arrays
tagged with: wav
possible better answer: http://stackoverflow.com/a/22883772
has answer: http://stackoverflow.com/a/22883796
score: 0
tagged with: element
answer count: 3

http://stackoverflow.com/q/22931820
has answer: http://stackoverflow.com/a/22932351
has title: Add library in my android project
has body: I want to use a library for my android project. When I use an external library, everything works. But when I add .jar to my folder "libs", there is this error : 04-08 10:39:47.879: E/AndroidRuntime(13453): java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.allbrary/eu.janmuller.android.simplecropimage.CropImage}: java.lang.NullPointerException 04-08 10:39:47.879: E/AndroidRuntime(13453): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245) 04-08 10:39:47.879: E/AndroidRuntime(13453): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295) 04-08 10:39:47.879: E/AndroidRuntime(13453): at android.app.ActivityThread.access$700(ActivityThread.java:150) 04-08 10:39:47.879: E/AndroidRuntime(13453): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280) 04-08 10:39:47.879: E/AndroidRuntime(13453): at android.os.Handler.dispatchMessage(Handler.java:99) 04-08 10:39:47.879: E/AndroidRuntime(13453): at android.os.Looper.loop(Looper.java:176) 04-08 10:39:47.879: E/AndroidRuntime(13453): at android.app.ActivityThread.main(ActivityThread.java:5279) 04-08 10:39:47.879: E/AndroidRuntime(13453): at java.lang.reflect.Method.invokeNative(Native Method) 04-08 10:39:47.879: E/AndroidRuntime(13453): at java.lang.reflect.Method.invoke(Method.java:511) 04-08 10:39:47.879: E/AndroidRuntime(13453): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 04-08 10:39:47.879: E/AndroidRuntime(13453): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 04-08 10:39:47.879: E/AndroidRuntime(13453): at dalvik.system.NativeStart.main(Native Method) 04-08 10:39:47.879: E/AndroidRuntime(13453): Caused by: java.lang.NullPointerException 04-08 10:39:47.879: E/AndroidRuntime(13453): at eu.janmuller.android.simplecropimage.CropImage.onCreate(CropImage.java:167) 04-08 10:39:47.879: E/AndroidRuntime(13453): at android.app.Activity.performCreate(Activity.java:5267) 04-08 10:39:47.879: E/An…
has comment: http://stackoverflow.com/comment/35005827
tagged with: java
has comment: http://stackoverflow.com/comment/35047152
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22932038
tagged with: jar
has comment: http://stackoverflow.com/comment/35048707
has answer: http://stackoverflow.com/a/22931990
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/35048642
favorite count: 0
score: 2
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34950696
comment on: http://stackoverflow.com/q/22901322
has text: @DavidWallace: I disagree. If no Comparator is used, then the natural ordering ***is*** in fact used to determine priorities or order.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22851581
score: 0
has title: Using imported data Java
type: UnansweredQuestion
tagged with: io
answer count: 0
tagged with: java
has body: I'm just learning to use File I/O and struggling to figure out how to use the data. For example, I have a .txt file that is setup with a name and list of scores that apply to that name, each list ending with a -1. I have successfully imported the file and was able to print it on the console but I need to add this information to an ArrayList so I can sort it, find the high and low, and the average and median. When I attempt to enter the data into an ArrayList I get a Exception I don't know how to handle. Here is the code I have so far, any help would be appreciated. public static void main(String[] args) throws IOException { File file = new File("Project11input.txt"); Scanner inFile = new Scanner(file); ArrayList&lt;Integer&gt; TerryCrews = readNextSeries(inFile); int median = getMedian(TerryCrews); System.out.println("The median is " + median); int average = getAverage(TerryCrews); System.out.println("The average is " + average); } private static ArrayList&lt;Integer&gt; readNextSeries(Scanner inScanner) { ArrayList&lt;Integer&gt; Input = new ArrayList&lt;Integer&gt;(); int thesex = 0; while(thesex &gt;= 0){ thesex = inScanner.nextInt(); Input.add(thesex); } System.out.println("End of input"); return Input;} private static int getMedian(ArrayList&lt;Integer&gt; inList) { int last = 0; int power = (inList.size()/2) - 1; int pow=0; int ful = power+1; int wap =0; int onetwo = inList.size()%2; if(onetwo == 1){ last = inList.get(ful);} else{ pow = inList.get(power); wap = inList.get(ful); last = (pow + wap); last=last/2; } return last; } to clarify, I basically need the numbers in the File "file" to be in an ArrayList so they can be used.
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/34860960
has comment: http://stackoverflow.com/comment/34860802
tagged with: arraylist

http://stackoverflow.com/a/22821755
upvote count: 3
has comment: http://stackoverflow.com/comment/34809079
has comment: http://stackoverflow.com/comment/34807697
has comment: http://stackoverflow.com/comment/34808857
score: 3
has comment: http://stackoverflow.com/comment/34808511
has comment: http://stackoverflow.com/comment/34808327
has body: One of the relevant reasons of using static factory over constructors (quote from Effective Java): A third advantage of static factory methods is that, unlike constructors, they can return an object of any subtype of their return type So, essentially it can give you ability to write something like : Base x = Factory.getInstance(TypeX.class); x.methodOfBase(); where TypeX could be completely hidden and have private constructor. You may want to have a look at java.util.Collections API implementation, for instance consider static factory method : public static &lt;T&gt; List&lt;T&gt; synchronizedList(List&lt;T&gt; list) as you see return type is an interface, and therefore returned object(some hidden implementation of List) could only be used as a List. So if you want to use methods x1(), x2() which are exclusive to subtype TypeX and do not belong to Base interface, you will have to cast your object to TypeX anyway. In this case you can instantiate TypeX directly via constructor (by keeping it public), as static factory won't give you anything. You may also want to have a look at other 3 reasons to use static factory over constructors in the book and verify that non of them are applicable to what you described in your question so far.
has comment: http://stackoverflow.com/comment/34822749
has comment: http://stackoverflow.com/comment/34818536
has comment: http://stackoverflow.com/comment/34809620
downvote count: 0
has comment: http://stackoverflow.com/comment/34831612
has comment: http://stackoverflow.com/comment/34809405
has comment: http://stackoverflow.com/comment/34823614
has comment: http://stackoverflow.com/comment/34809533
has comment: http://stackoverflow.com/comment/34809248
type: Answer
has comment: http://stackoverflow.com/comment/34810253
has comment: http://stackoverflow.com/comment/34809566
answers question: http://stackoverflow.com/q/22821258

http://stackoverflow.com/q/22932770
tagged with: java
type: Question
upvote count: 6
has body: I want to define a value in my Scala code and treat this value as constant (used in annotation) within my Java code (which is calling scala). For example: object MyValues { val a = 5 } However when I'm trying to use this value within Java annotation it gives me an error: java: attribute value must be constant @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface MyJavaAnnotation { int aValue() default MyValues.a(); // &lt;-- Error } Calling it like this doesn't work either: MyValues$.MODULE$.a(); I also tried to prefix the val with a final keyword without success. Is there a workaround for this ?
answer count: 1
has title: Is there a way to treat scala value as constant from java
favorite count: 0
tagged with: scala
score: 6
tagged with: constants
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22933196
accepted answer: http://stackoverflow.com/a/22933196
downvote count: 0

http://stackoverflow.com/a/22907792
has body: Assuming you want integers only, try something like this: @Override public void afterTextChanged(Editable s) { if (s.length() == 0) { // complain about no input } else { try { int yValue = Integer.parseInt(s.toString()); // ... } catch (NumberFormatException e) { // complain about invalid input } } } I'm not an Android developer, but I'd be surprised if there wasn't a way to add a mask to your input field that prevents anything other than integers being input.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22907559

http://stackoverflow.com/comment/35087529
comment on: http://stackoverflow.com/q/22961140
has text: Error solved: Transferring keys as byte[] or Object instead of String. (Actually posted the solution as answer but some moderator didn't like it although it worked for me.)
score: 0
type: Comment
type: QuestionComment

string
tags question: http://stackoverflow.com/q/22851220
tags question: http://stackoverflow.com/q/22861735
tags question: http://stackoverflow.com/q/22885402
tags question: http://stackoverflow.com/q/22859229
tags question: http://stackoverflow.com/q/22874800
tags question: http://stackoverflow.com/q/22832671
tags question: http://stackoverflow.com/q/22850759
tags question: http://stackoverflow.com/q/22851221
tags question: http://stackoverflow.com/q/22935466
tags question: http://stackoverflow.com/q/22886584
tags question: http://stackoverflow.com/q/22956584
tags question: http://stackoverflow.com/q/22877895
tags question: http://stackoverflow.com/q/22878200
tags question: http://stackoverflow.com/q/22919408
tags question: http://stackoverflow.com/q/22955567
tags question: http://stackoverflow.com/q/22862756
tags question: http://stackoverflow.com/q/22852587
tags question: http://stackoverflow.com/q/22909964
tags question: http://stackoverflow.com/q/22949799
tags question: http://stackoverflow.com/q/22894301
tags question: http://stackoverflow.com/q/22936341
tags question: http://stackoverflow.com/q/22890046
tags question: http://stackoverflow.com/q/22866011
tags question: http://stackoverflow.com/q/22939151
tags question: http://stackoverflow.com/q/22954395
tags question: http://stackoverflow.com/q/22899028
tags question: http://stackoverflow.com/q/22825838
tags question: http://stackoverflow.com/q/22874662
tags question: http://stackoverflow.com/q/22905330
tags question: http://stackoverflow.com/q/22854329
tags question: http://stackoverflow.com/q/22894996
tags question: http://stackoverflow.com/q/22890879
tags question: http://stackoverflow.com/q/22830215
tags question: http://stackoverflow.com/q/22880505
tags question: http://stackoverflow.com/q/22863866
tags question: http://stackoverflow.com/q/22826997
tags question: http://stackoverflow.com/q/22966894
tags question: http://stackoverflow.com/q/22834091
tags question: http://stackoverflow.com/q/22937461
tags question: http://stackoverflow.com/q/22844503
tags question: http://stackoverflow.com/q/22861407
tags question: http://stackoverflow.com/q/22928661
tags question: http://stackoverflow.com/q/22900587
tags question: http://stackoverflow.com/q/22923372
tags question: http://stackoverflow.com/q/22923739
tags question: http://stackoverflow.com/q/22902292
tags question: http://stackoverflow.com/q/22869598
tags question: http://stackoverflow.com/q/22840770
tags question: http://stackoverflow.com/q/22835983
tags question: http://stackoverflow.com/q/22856074
tags question: http://stackoverflow.com/q/22955302
tags question: http://stackoverflow.com/q/22937720
tags question: http://stackoverflow.com/q/22817349
tags question: http://stackoverflow.com/q/22932082
tags question: http://stackoverflow.com/q/22919660
tags question: http://stackoverflow.com/q/22912009
tags question: http://stackoverflow.com/q/22867778
tags question: http://stackoverflow.com/q/22903465
tags question: http://stackoverflow.com/q/22924058
tags question: http://stackoverflow.com/q/22823907
tag name: string
tags question: http://stackoverflow.com/q/22948802
tags question: http://stackoverflow.com/q/22952642
tags question: http://stackoverflow.com/q/22893583
tags question: http://stackoverflow.com/q/22916843
tags question: http://stackoverflow.com/q/22902977
tags question: http://stackoverflow.com/q/22917358
tags question: http://stackoverflow.com/q/22821589
tags question: http://stackoverflow.com/q/22920058
tags question: http://stackoverflow.com/q/22852645
tags question: http://stackoverflow.com/q/22918226
tags question: http://stackoverflow.com/q/22861020
tags question: http://stackoverflow.com/q/22919096
tags question: http://stackoverflow.com/q/22810829
tags question: http://stackoverflow.com/q/22899646
type: Tag
tags question: http://stackoverflow.com/q/22906592
tags question: http://stackoverflow.com/q/22810107
tags question: http://stackoverflow.com/q/22957011
tags question: http://stackoverflow.com/q/22837101

http://stackoverflow.com/comment/34971925
has text: You were right considering my faulty answer. I have been using JavaScript for the past couple of weeks, so I forgot that Java just doesn't compile when you pass a wrong argument to a method. My bad, I've deleted the answer. Perhaps this - answered - question helps out: http://stackoverflow.com/questions/35186/how-do-i-fix-a-nosuchmethoderror
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22910580
score: 0

http://stackoverflow.com/q/22819707
has answer: http://stackoverflow.com/a/22822168
has body: I am puzzled by the strange behavior of ShingleFilter in Lucene 4.6. What I would like to do is extract all possible bigrams from a sentence. So if the sentence is "this is a dog", I want "this is", "is a ", "a dog". What I see instead is: "this this is" "this is is" "is is a" "is a a" "a a dog" "a dog dog" So somehow it replicates words and makes 3-grams instead of bigrams. Here is my Java code: Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_46); ShingleAnalyzerWrapper shingleAnalyzer = new ShingleAnalyzerWrapper(analyzer,2,2); String theSentence = "this is a dog"; StringReader reader = new StringReader(theSentence); TokenStream tokenStream = shingleAnalyzer.tokenStream("content", reader); ShingleFilter theFilter = new ShingleFilter(tokenStream); theFilter.setOutputUnigrams(false); CharTermAttribute charTermAttribute = theFilter.addAttribute(CharTermAttribute.class); theFilter.reset(); while (theFilter.incrementToken()) { System.out.println(charTermAttribute.toString()); } theFilter.end(); theFilter.close(); Could someone please help me modify it so it actually outputs bigrams and does not replicate words? Thank you! Natalia
type: UnansweredQuestion
tagged with: lucene
has answer: http://stackoverflow.com/a/22822160
has comment: http://stackoverflow.com/comment/34806093
score: 2
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34807922
upvote count: 2
tagged with: java
answer count: 2
has title: ShingleFilter in Lucene 4.6 adds words to bigrams

http://stackoverflow.com/q/22888563
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/16621738
has body: I have the following String String str1 = "Peter L. Douglas 04/02/1984 X1 X5 YY" ; I need to get three separate strings as following String str1_name = "Peter L. Douglas" ; String str1_date = "04/02/1984" ; String str1_nbr = "3" ; // 3 is three elements after date , i.e. X1 X5 YY I am not sure how I could do this in the most efficient way , especially counting the elements after the date Other possible Strings are String str1 = "Alexander Evanston 05/02/1986 X5 YY" ;
answer count: 2
upvote count: 1
has title: How to get a date and count elements from a string?
has answer: http://stackoverflow.com/a/22888615
favorite count: 0
linked to: http://stackoverflow.com/q/22130429
type: UnansweredQuestion
tagged with: regex
linked to: http://stackoverflow.com/q/17194645
has comment: http://stackoverflow.com/comment/34927474
has answer: http://stackoverflow.com/a/22888601
downvote count: 0
score: 1

http://stackoverflow.com/comment/34817643
comment on: http://stackoverflow.com/q/22827698
score: 0
has text: Sorry I added two questions together. they're separate.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34827190
type: Comment
type: QuestionComment
has text: share your User class with all getter and setter methods.?
score: 0
comment on: http://stackoverflow.com/q/22832346

http://stackoverflow.com/comment/35030879
comment on: http://stackoverflow.com/a/22945549
score: 0
type: AnswerComment
type: Comment
has text: Yes, that's a good one!

http://stackoverflow.com/a/22902910
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22902804
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34953490
answers question: http://stackoverflow.com/q/22902804
score: 1
has body: Here you are. try{ JSONObject jObject = new JSONObject(result); JSONArray jarray = jObject.getJSONArray("lectiveSemesters"); for(int i = 0; jarray != null &amp; i &lt; jarray.length(); i++){ JSONObject jitem = (JSONObject) jarray.get(i); } } catch (Exception e){ }
type: AcceptedAnswer

http://stackoverflow.com/a/22902395
downvote count: 0
has body: Try running your drawing actions after jframe creation, i.e. // create a new window to hold the visualization JFrame frame = new JFrame("prefuse example"); // ensure application exits when window is closed frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(d); frame.pack(); // layout components in window frame.setVisible(true); // show the window vis.run("draw"); vis.run("layout"); Or, if that doesn't work, calling frame.repaint(). You need to force drawing of the visualization somehow, I'm thinking.
type: AcceptedAnswer
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22871216
score: 1
accepted answer of: http://stackoverflow.com/q/22871216

http://stackoverflow.com/comment/34868312
type: AnswerComment
comment on: http://stackoverflow.com/a/22855545
type: Comment
has text: JAXB looks to be specifically for Java. If I want to send XML file to other program (written in any other language which understands XML) will I be able to achieve it?
score: 0

http://stackoverflow.com/comment/34959043
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22906036
has text: I provided the link to the project web site, you can download the jar from there. Or if you use Maven, take a look at http://mvnrepository.com/artifact/commons-beanutils/commons-beanutils/1.9.1

http://stackoverflow.com/a/22824029
accepted answer of: http://stackoverflow.com/q/22823438
has comment: http://stackoverflow.com/comment/34812982
has comment: http://stackoverflow.com/comment/35061104
has comment: http://stackoverflow.com/comment/34815108
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: Actually DocFlavor.STRING is a nested class. So you need to use $ to grab a reference to it: StringFlavor = createObject("java","javax.print.DocFlavor$STRING"); Then you can access the public field: writeDump( StringFlavor.TEXT_PLAIN ); Side note, printService.init() should not work. PrintService is an interface and cannot be instantiated. So calling init() should throw an error.
upvote count: 4
answers question: http://stackoverflow.com/q/22823438

http://stackoverflow.com/q/22873753
has body: I'm designing an application and I want to set a space on the side. My problem now is, I'm using the FormLayout, and the FormAttachment can only define the percentage of the layout; so whenever the editor get wider(i have scrolledComposite in the background), the side space gets wider too, in which I hope it can remain as a same size. Does anyone has idea about how to solve this problem? thanks in advanced. FormData data = new FormData(); data.left = new FormAttachment(5); data.top = new FormAttachment(5); data.right = new FormAttachment(95); Label1.setLayoutData(data);
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22877858
accepted answer: http://stackoverflow.com/a/22877858
tagged with: java
type: Question
tagged with: form-layout
tagged with: layout
answer count: 1
score: 0
tagged with: swt
has title: swt: how to leave space on the side?

http://stackoverflow.com/comment/35028281
type: Comment
comment on: http://stackoverflow.com/a/22944196
has text: Some guys also suggested ESB but i could find anu good example where it could help in this kind of stuff.Do you have any ideas how ESB can help here or comparison of ESB vs CAMEL?
type: AnswerComment
score: 0

http://stackoverflow.com/q/22947872
has title: Control keyboard input in Java
has answer: http://stackoverflow.com/a/22947943
score: 0
has answer: http://stackoverflow.com/a/22948536
answer count: 3
has body: I have this program to write and have no idea how to control keyboard input: Write a method to check whether the word entered is valid or not. Valid word should: Have at least 10 characters Start with a letter Contain a letter in upper case Contain at least 3 digits Contain a special character (e.g. @,$.% …etc) Contain a space
linked to: http://stackoverflow.com/q/16127923
has answer: http://stackoverflow.com/a/35763447
possible better answer: http://stackoverflow.com/a/22947943
accepted answer: http://stackoverflow.com/a/22948536
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35034797
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35034882

http://stackoverflow.com/comment/34906310
type: AnswerComment
has text: @MenoHochschild No, the input was not in UTC. The data type of the Postgres column was `DATE`. A [Postgres `DATE`](http://www.postgresql.org/docs/current/static/datatype-datetime.html) represents **only a date** (year, month, day-of-month) **without a time portion**, per the [SQL-92 spec](http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt). The core problem here is retrieving date-only from the database, and then used to create a java.util.Date object which includes a time-of-day along with the date. A time portion is created in the process, presumably 00:00:00 for a time zone (UTC?).
comment on: http://stackoverflow.com/a/22868793
score: 0
type: Comment

http://stackoverflow.com/q/22959208
tagged with: web-services
has comment: http://stackoverflow.com/comment/35057555
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35059224
tagged with: java
type: Question
tagged with: message-queue
answer count: 1
has comment: http://stackoverflow.com/comment/35060601
score: 0
has body: Hi I have created the below class to read messages off a jibco jms queue. In a different class I create an instance of this class and try to getMessage() into a stirng. I have placed a message in the queue, My application gets stuck as I call the getMessage() method... Any idea ? or an improvement I could add to below class? public class EMSReceiver { private QueueConnection connection; private QueueReceiver queueReceiver; private Queue queue; private TextMessage message; public EMSReceiver(String initialContextFactory, String userName, String password, String serverUrl, String confact, String q){ try { Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); env.put(Context.SECURITY_PRINCIPAL, userName); env.put(Context.SECURITY_CREDENTIALS, password); env.put(Context.PROVIDER_URL, serverUrl); InitialContext jndi = new InitialContext(env); QueueConnectionFactory connectionFactory = (QueueConnectionFactory) jndi.lookup(confact); QueueConnection connection = connectionFactory.createQueueConnection(userName, password); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); this.queue = (Queue) jndi.lookup(q); this.queueReceiver = session.createReceiver(queue); connection.start(); } catch (JMSException e) { e.printStackTrace(); System.exit(0); } catch (NamingException e) { e.printStackTrace(); } } public String getMessage() throws JMSException{ try { this.message = (TextMessage) queueReceiver.receive(); } catch (JMSException e) { System.out.println("Could not retrieve the message."); e.printStackTrace(); } return message.getText(); }
tagged with: tibco
has answer: http://stackoverflow.com/a/23366829
accepted answer: http://stackoverflow.com/a/23366829
tagged with: jms
has comment: http://stackoverflow.com/comment/35789125
has title: TIBCO JMS Queue message reciever gets stuck

http://stackoverflow.com/comment/34854307
has text: Go to java 8 as there is no more such an error...
score: 1
comment on: http://stackoverflow.com/q/22847935
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35071463
comment on: http://stackoverflow.com/q/22956920
score: 0
type: QuestionComment
has text: btw copy your code into the description of SOF not external links
type: Comment

http://stackoverflow.com/q/22928661
type: Question
has answer: http://stackoverflow.com/a/22929149
has comment: http://stackoverflow.com/comment/35000222
has title: One string contains another string
possible better answer: http://stackoverflow.com/a/22928686
answer count: 3
tagged with: compare
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/22928850
accepted answer: http://stackoverflow.com/a/22928850
has body: Need Help on String concepts in java, String s1="Java is oop probgramming, R1|R2|R4|R5|R"; String s2="R"; String s3="R2"; String s4="R5"; I want to compare to s2, s3, s4 with s1 string compare after , I have tried fallowing System.out.println(s3.matches(s1.substring(Options1.indexOf(","), s1.indexOf("|")))); System.out.println(s2.matches(s1.substring(Options1.indexOf(","), s1.indexOf("|")))); I am getting the false both statements. I want when I compare to s2 string with s1 it should true.
has answer: http://stackoverflow.com/a/22928686
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/22855069
type: Answer
accepted answer of: http://stackoverflow.com/q/22854939
answers question: http://stackoverflow.com/q/22854939
has body: It happen at times with eclipse. Try the following ways #1 Try cleaning your project and build again. or #2 Right click on your Project → go to Android tools → and click android support library. then clean and build your project. HIH.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34866912

http://stackoverflow.com/a/22962482
has body: As I promised before, I tested thread that uses Looper to run infinitely and can accept Runnables to execute them one by one. // create a custom Thread class class ThreadWorking extends Thread { public volatile Handler handler; @Override public void run(){ // between Looper.prepare() and Looper.loop() we need to create a handler // which will receive messages and runnables for this thread Looper.prepare(); handler = new Handler(); Looper.loop(); } }; // then create new thread and start it final ThreadWorking threadWorking = new ThreadWorking(); threadWorking.start(); Log.println(Log.DEBUG, "thread test", "New thread started"); Now the new Thread is looping and can receive Messages and Runnables by its Handler. They will be stored in internal queue and executed one after another in this particular thread. To test, I send Runnable on button click: threadWorking.handler.post(new Runnable(){ @Override public void run() { try { Log.println(Log.DEBUG, "thread test", "Executed: " + System.currentTimeMillis()/1000); Thread.sleep(2000); } catch (InterruptedException e) { } } }); After I launched an app and clicked the button several times quickly, log shows this: 04-09 16:21:56.599: D/thread test(19264): New thread started 04-09 16:21:59.569: D/thread test(19264): Executed: 1397046119 04-09 16:22:01.569: D/thread test(19264): Executed: 1397046121 04-09 16:22:03.569: D/thread test(19264): Executed: 1397046123 04-09 16:22:05.569: D/thread test(19264): Executed: 1397046125 04-09 16:22:07.569: D/thread test(19264): Executed: 1397046127 04-09 16:22:09.569: D/thread test(19264): Executed: 1397046129 So everything is working correctly as expected, without freezing UI or creating additional threads.
has comment: http://stackoverflow.com/comment/35069551
answers question: http://stackoverflow.com/q/22911395
downvote count: 0
has comment: http://stackoverflow.com/comment/35069126
has comment: http://stackoverflow.com/comment/35066145
type: Answer
has comment: http://stackoverflow.com/comment/35070571
has comment: http://stackoverflow.com/comment/35068214
score: 1
upvote count: 1

http://stackoverflow.com/comment/35004211
has text: I was able to resolve the issue with this request: `code Bundle params = new Bundle(); params.putString("id", id); params.putString("fields", "name"); Request request = new Request(nsession, "search", params, HttpMethod.GET, new Request.Callback() { public void onCompleted(Response response) { try { JSONObject res = response.getGraphObject().getInnerJSONObject().getJSONArray("data").getJSONObject(0); final String nname = (String) res.get("name");`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22897731

http://stackoverflow.com/a/22889590
answers question: http://stackoverflow.com/q/22888152
has body: Only some phones will support textures bigger than 2048x2048. This is a GPU hardware/OpenGL driver limitation and not the fault of LibGDX. The most common solution is to build a map out of several smaller textures that can be repeated to create the illusion of a giant map. You don't just take the map of the world and divide it into 2048x2048 chunks, you instead have a bunch of tiles that are 32x32 pixels and represent things like grass, dirt, grass meeting dirt, etc. This is why LibGDX has a maps package. See https://github.com/libgdx/libgdx/wiki/Tile-maps Instead of trying to create the map programmatically you record the map in a text file and use a map loader at runtime. There are a couple of supported map formats. The best way to create the map files is to use a map editor like http://www.mapeditor.org/
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22888152
upvote count: 1
score: 1

http://stackoverflow.com/q/22837502
score: 2
answer count: 0
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34999384
type: Question
has comment: http://stackoverflow.com/comment/62175814
has comment: http://stackoverflow.com/comment/34836348
tagged with: apache-poi
upvote count: 2
linked to: http://stackoverflow.com/q/37326333
has comment: http://stackoverflow.com/comment/71147631
has title: Hiding empty columns and rows with apache poi
has comment: http://stackoverflow.com/comment/36082304
tagged with: java
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/37326333
has body: I'm searching the answer for that, but find out nothing yet. I'm migrating a report, which was done manually so far, to a automatic job using apache poi. In the original report it shows the report cells, lets say from cell A1 to AC186 and all others cols and rows are hiden. See a image showing it here: http://img.chandoo.org/q/show-only-few-rows-and-columns-in-excel.png I've tested some codes from the web, but still not getting that. To hide the cols I tried this code: for (int i = mylastReportCol; i &lt;= 16384; i++) { sheet.setColumnHidden(i, true); } But still not working. Have anyone ever tried the same with poi??

http://stackoverflow.com/comment/34870720
score: 2
comment on: http://stackoverflow.com/q/22856931
type: Comment
has text: @Shitu: Right, so you don't want `java.sql.Date` at all. Please edit your post.
type: QuestionComment

http://stackoverflow.com/comment/34870362
has text: split each string on a regular expression for non-number (`[^0-9]`). Add each array numbered item to the next array's item at the same index. Then join on the original delimiter? The only way you're going to be able to make that work though is if you have the same number of split objects.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22857015
score: 1

http://stackoverflow.com/q/22924223
has title: Issues with cross-class methods and Objected Oriented Logic in Java
type: Question
tagged with: oop
possible better answer: http://stackoverflow.com/a/22924348
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22924348
has body: I'm in a beginners Java course, and I am working on my first object oriented assignment. I do understand the basics of OOP, but I don't have quite the knowledge required to put it into practice. If anyone could please point out any newbie mistakes or give me some pointers, I would be very grateful. Here is the assignment: Create class SavingsAccount. Use a private static class variable to store the annualInterestRate for each of the savers. Each object of the class contains a private instance variable savingsBalance indicating the amount the saver currently has on deposit. Provide method calculateMonthlyInterest to calculate the monthly interest by multiplying the balance by annualInterestRate divided by 12; this interest should be added to savingsBalance. Provide static method modifyInterestRate that sets the annualInterestRate to a new value. Write a driver program to test class SavingsAccount. Instantiate two different savingsAccount objects, saver1 and saver2, with balances of $2,000.00 and $4,000.00, respectively. Set annualInterestRate to 3%, then calculate the monthly interest and print the new balances for each of the savers. Then set the annualInterestRate to 5% and calculate the next month's interest and print the new balances for each of the savers. Here is my current code: class savings{ public static void main(String[] args){ double annualInterestRate = 0; double monthlyInterest = 0; SavingsAccount saver1 = new SavingsAccount(2000, .03); SavingsAccount saver2 = new SavingsAccount(4000, .03); calculateMonthlyInterest(saver1); System.out.println("Monthly Interest at 3%: " + monthlyInterest); calculateMonthlyInterest(saver2); System.out.println("Monthly Interest at 3%: " + monthlyInterest); modifyInterestRate(saver1); modifyInterestRate(saver2); calculateMonthlyInterest(saver1); System.out.println("Monthly Interest at 5%: " + monthlyInterest); calculateMonthlyInterest(saver2); System.out.println("Monthly Interest at 5%: " + monthlyInterest); } } class Savi…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22924335
accepted answer: http://stackoverflow.com/a/22924335
has comment: http://stackoverflow.com/comment/34992413
has comment: http://stackoverflow.com/comment/34992539
tagged with: methods

http://stackoverflow.com/q/22840845
has comment: http://stackoverflow.com/comment/34843419
accepted answer: http://stackoverflow.com/a/22842539
has comment: http://stackoverflow.com/comment/34842469
type: AnsweredQuestion
has body: I develop java application using Eclipse IDE and Windows OS. I have this problem: From cmd my maven task works good but if I invoke it from eclipse - I see build failure I want to use maven with configuration from cmd in my eclipse. I made following steps: C:\&gt;set m2_home M2_HOME=C:\Program Files\apache\apache-maven-3.1.1 I want to perform the same actions as from cmd only from Eclipse. Can you help me? update - problem demonstration from Eclipse: I invoke so: result: ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 45.273s [INFO] Finished at: Thu Apr 03 18:39:58 MSK 2014 [INFO] Final Memory: 91M/782M ... from cmd: D:\work\ct\ctc-core&gt;mvn clean install ..... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1:01.446s [INFO] Finished at: Thu Apr 03 18:42:48 MSK 2014 update if I add -X in maven command from eclipse [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 41.161s [INFO] Finished at: Thu Apr 03 19:09:16 MSK 2014 [INFO] Final Memory: 91M/752M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.7.4:scr (generate-scr-descriptor) on project ctc-core-import: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.7.4:scr failed: Comparison method violates its general contract! -&gt; [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-scr-plugin:1.7.4:scr (generate-scr-descriptor) on project ctc-core-import: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.7.4:scr failed: Comparison method v…
upvote count: 3
has answer: http://stackoverflow.com/a/22842539
has title: How to say to eclipse-maven-plugin perform from eclipse same actions as mvn from cmd
tagged with: maven
has comment: http://stackoverflow.com/comment/34843477
type: Question
score: 3
tagged with: maven-eclipse-plugin
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34842376
linked to: http://stackoverflow.com/q/6626437
has comment: http://stackoverflow.com/comment/34843177
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34841703

http://stackoverflow.com/comment/35007979
score: 0
comment on: http://stackoverflow.com/q/22930522
type: QuestionComment
type: Comment
has text: Well that is nothing to do with estimating a variable's value.

http://stackoverflow.com/comment/35054415
has text: can you show what you have tried base on the tutorials ? and what you don't understand exactly
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22957753
score: 0

http://stackoverflow.com/comment/66403044
has text: Probably should specify a charset.
comment on: http://stackoverflow.com/a/38789604
score: 12
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35039854
type: Comment
type: QuestionComment
has text: I'm not sure if this is contributing to your problem but as a general rule, your `Scanner#hasNextXXX()` should always be matched by a `Scanner#nextXXX()` of the same type. So if you state `while (input.hasNextLine())`, this should be followed by a single `input.nextLine()`.
comment on: http://stackoverflow.com/q/22950778
score: 0

http://stackoverflow.com/a/22877193
answers question: http://stackoverflow.com/q/22870714
score: 0
has body: Try this try { URL url = new URL("server url"); //This will open the connection URLConnection conn = url.openConnection(); //connection is open now you can exchange your piece of information /* * YOUR INFO EXCHANGING CODE * */ } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
type: Answer

http://stackoverflow.com/q/22812488
score: 93
has answer: http://stackoverflow.com/a/22812914
tagged with: java-8
has answer: http://stackoverflow.com/a/36117504
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/46103883
linked to: http://stackoverflow.com/q/31817620
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/22815472
tagged with: eclipse
has answer: http://stackoverflow.com/a/32090574
type: Question
linked to: http://stackoverflow.com/q/32565193
has answer: http://stackoverflow.com/a/41537322
has body: When trying to use javafx related classes in my new java 8 project I get an access restriction error from eclipse. So far the only 'solution' I've been able to find is to tell eclipse to ignore the access restriction, but I am not satisfied with that. An example of the error: Access restriction: The type Pane is not accessible due to restriction on required library C:\Program Files\Java\jre8_0\lib\ext\jfxrt.jar I'm using Eclipse Kepler with the Eclipse JDT patch for java 8. This seems to be an issue related to the fact that JavaFX is not a part of the JavaSE execution environment. I am now toughly confused as according to http://en.wikipedia.org/wiki/JavaFX javaFX is a part of the JavaSE. Is it possible that Eclipse is not recognizing that it is a part of the javaSE?
upvote count: 93
downvote count: 0
answer count: 11
has answer: http://stackoverflow.com/a/29247211
has answer: http://stackoverflow.com/a/31758174
has answer: http://stackoverflow.com/a/29594315
possible better answer: http://stackoverflow.com/a/32062263
linked to: http://stackoverflow.com/q/860187
accepted answer: http://stackoverflow.com/a/22815472
has answer: http://stackoverflow.com/a/32062263
has comment: http://stackoverflow.com/comment/34790760
has answer: http://stackoverflow.com/a/27459335
has title: Using JavaFX in JRE 8, “Access restriction” error
has comment: http://stackoverflow.com/comment/34791062
favorite count: 0

http://stackoverflow.com/q/22852007
possible better answer: http://stackoverflow.com/a/22852184
answer count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/22852349
has answer: http://stackoverflow.com/a/22852184
has body: I have this code: class PrintDemo { public void printCount(){ try { for(int i = 5; i &gt; 0; i--) { System.out.println("Counter --- " + i ); } } catch (Exception e) { System.out.println("Thread interrupted."); } } } class ThreadDemo extends Thread { private Thread t; private String threadName; PrintDemo PD; ThreadDemo( String name, PrintDemo pd) { threadName = name; PD = pd; } public void run() { synchronized(PD) { PD.printCount(); } System.out.println("Thread " + threadName + " exiting."); } public void start () { System.out.println("Starting " + threadName); if (t == null) { t = new Thread (this, threadName); t.start (); } } } public class TestThread { public static void main(String args[]) { PrintDemo PD = new PrintDemo(); ThreadDemo T1 = new ThreadDemo( "Thread - 1 ", PD ); ThreadDemo T2 = new ThreadDemo( "Thread - 2 ", PD ); T1.start(); T2.start(); // wait for threads to end try { T1.join(); T2.join(); } catch( Exception e) { System.out.println("Interrupted"); } System.out.println("hello"); } } When I run this the hello message doesn't show at the end. It supposed that the main thread would wait for the others to end right???? Thanks in advance.
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22852349
has title: Function Join() in java Threads
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34861641
type: Question

http://stackoverflow.com/q/22832916
upvote count: 6
tagged with: struts
answer count: 2
linked to: http://stackoverflow.com/q/4068629
favorite count: 0
has body: I want the user to enter hyphens with the following code mask ^[a-zA-Z0-9]*$ I am using struts validation. so please help me to address this. EDIT the user can enter the hyphens anywhere in the string,so there is no restriction on whether the - should be at the beginning, middle or end.
has answer: http://stackoverflow.com/a/22832948
score: 6
tagged with: regex
has title: how to allow hyphens using regex
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22832940
accepted answer: http://stackoverflow.com/a/22832940
type: Question
linked to: http://stackoverflow.com/q/9589074
duplicate of: http://stackoverflow.com/q/4068629
possible better answer: http://stackoverflow.com/a/22832948

http://stackoverflow.com/q/22827358
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/22888569
has comment: http://stackoverflow.com/comment/34855708
type: Question
tagged with: libgdx
tagged with: scene2d
tagged with: java
accepted answer: http://stackoverflow.com/a/22888569
has body: in libGDX, I have a TextButtonStyle defined like this: TextButtonStyle style = new TextButtonStyle(); style.font = header; style.up = Resources.guiSkin.getDrawable("buttonUp"); style.down = Resources.guiSkin.getDrawable("buttonDown"); My TextButton is defined like this: TextButton textButton = new TextButton("text",style); I add the TextButton to a table like this: table.add(playButton); The table is configured to: (I have tested with and without this configuration and nothing changes) setFillParent(true); The problem I am having is that the TextButtonStyle's textures, style.up and style.down, resize to the text of the button. For example, if I write "t" as the text, the style.up and style.down textures will resize themselves to surround only the "t", rather than staying at their native image size. In this image, different lengths of text show different sizes of buttons, though they are all the same texture. Also, as you can see, the ends of the text do not fit as desired inside the button, for the text extends from one end to the other, starting at the beginning and ending at the end, when really I would like it to start at just after the beginning and end just before the end. Also, the text is at the bottom portion of the image, which just looks awkward. Overall, the whole thing just looks awkward and I am wondering whether or not there is a way to fix this. My thoughts are that since I am using a very small image as the button texture (something like 34x11 pixels), the button always resizes the image. If the image was greater than the size needed to house the text, it would not resize. However, I am using a pixelly themed button, and the easiest way to do this is by using a small image, so is there any way to get around this resize? Any help would be greatly appreciated.
answer count: 1
tagged with: user-interface
downvote count: 0
has comment: http://stackoverflow.com/comment/34869229
favorite count: 0
has title: libGDX TextButton image resize
has comment: http://stackoverflow.com/comment/34848252

http://stackoverflow.com/q/22815047
has title: Adding item to ArrayList in different class
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22815262
has comment: http://stackoverflow.com/comment/34801129
has body: For an assignment I have to make a Java application and one of the functions I'm having a problem with is adding to an ArrayList. The ArrayList is in a different class then the method and I get a nullpointer (doesn't happen when I make it static). This is the code where I'm trying to add: if (e.getSource() == voegToe) { if (naam.equals("") || straat.equals("") || huisnummer.equals("") || postcode.equals("") || plaats.equals("") || telefoonnummer.equals("") || email.equals("")) { allesoke = false; foutmelding += "\n"; } if (allesoke == true) { Klant newKlant = new Klant (naam, postcode, huisnummer); System.out.println("HOI"); klantenBindingRef.alleKlanten.add(newKlant); System.out.println(klantenBindingRef.alleKlanten); } else { JOptionPane.showMessageDialog(null, foutmelding, "Foutmelding", JOptionPane.INFORMATION_MESSAGE, null); } And this is part of the code of the class with the ArrayList: public class Klantenbinding { private String naam; protected List&lt;Klant&gt; alleKlanten = new ArrayList&lt;Klant&gt; (); // klanten public void voegKlantToe(Klant nweKlant) { if (!heeftKlant(nweKlant.getNaam())) { alleKlanten.add(nweKlant); } } public boolean heeftKlant(String naam) { boolean b = false; for (Klant k : alleKlanten) { if (k.getNaam() == naam) { b = true; } } return b; } The nullpointer comes from the line: klantenBindingRef.alleKlanten.add(newKlant); public class KlantToevoegen extends JFrame implements ActionListener { /** * */ JFrame frame; private static final long serialVersionUID = 1L; private JButton voegToe, terug; private JPanel contentPane; private JTextField nmTf, strTf, hnrTf, pcTf, plTf, telnrTf, emailTf; private JLabel lblAanhef, lblNaam, lblStraat, lblNieuweKlantToevoegen, lblHuisnr, lblPostcode, lblPlaats, lblTelnr, lblEmail; private JComboBox aanhefBox; private Klantenbinding klantenBindingRef; private AutoToevoegenFrame autoToevoegenFrameRef; private JSeparator separator; private JSeparator separator_1; /** * Launch the application. */
tagged with: arraylist
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/22815167
has comment: http://stackoverflow.com/comment/34794629
has comment: http://stackoverflow.com/comment/34795255
has answer: http://stackoverflow.com/a/22815167
has answer: http://stackoverflow.com/a/22815191
accepted answer: http://stackoverflow.com/a/22815191
type: AnsweredQuestion

http://stackoverflow.com/comment/35047584
comment on: http://stackoverflow.com/q/22955312
score: 0
has text: Then what is the solution? its give warning also for that line "Argument rowLink might be null",
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34999222
has text: If you didn't run each a few tens of millions of times so that JIT was nice and warmed up then any benchmarks are invalid. Search the web for "java micro benchmark" to learn why this is _really hard_ to do right.
comment on: http://stackoverflow.com/q/22928091
score: 2
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22937857
score: 7
answers question: http://stackoverflow.com/q/22937807
downvote count: 0
has body: Remove this. before response. They're parametres, not class variables.
type: Answer
upvote count: 7

http://stackoverflow.com/comment/34858246
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22850077
has text: Okay, that bothered me a bit. I'm so used to always knowing what type argument to give it. Thanks.

http://stackoverflow.com/comment/35039672
has text: Is this [link](http://www.javapractices.com/topic/TopicAction.do?Id=181) helpful? It sounds like you might want to use the `forward(..)` method of `RequestDispatcher`.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22950063

http://stackoverflow.com/q/22923282
answer count: 2
has body: Sales Order Entity. @Entity @Table(name = "sales_orders") @IdClass(ReceiptPK.class) public class SalesOrders implements Serializable { public SalesOrders() { } @Id protected Integer receiptID; @Id protected Integer dateKey; public SalesOrders(Integer receiptID, Integer dateKey) { this.receiptID = receiptID; this.dateKey = dateKey; } //order contains many details @OneToMany(fetch = FetchType.LAZY, mappedBy = "salesOrders") @Cascade({CascadeType.SAVE_UPDATE, CascadeType.DELETE}) private Set&lt;SalesOrderDetails&gt; orderDetails = new HashSet&lt;SalesOrderDetails&gt;(); public Set&lt;SalesOrderDetails&gt; getOrderDetails() { return orderDetails; } public void setOrderDetails(Set&lt;SalesOrderDetails&gt; orderDetails) { this.orderDetails = orderDetails; } // other property .. Order Details Entity. @Entity @Table(name = "sales_order_details") public class SalesOrderDetails implements Serializable { public SalesOrderDetails() { } private int id; @Id @GeneratedValue(strategy = GenerationType.AUTO) public int getId() { return id; } public void setId(int id) { this.id = id; } // Order holder private SalesOrders salesOrders; @ManyToOne @JoinColumns({ @JoinColumn(name = "order_num", referencedColumnName = "receiptID"), @JoinColumn(name = "date_key", referencedColumnName = "dateKey")}) public SalesOrders getSalesOrders() { return salesOrders; } public void setSalesOrders(SalesOrders salesOrders) { this.salesOrders = salesOrders; } // other property ... My Question : When i try to remove Order item that doesn't affect on sales_order_details . SalesOrders saleOrder = (SalesOrders) getSession().get(SalesOrders.class ,new ReceiptPK(receiptID,dateKey)); saleOrder.getOrderDetails().remove(someDetails); getSession().beginTransaction(); getSession().saveOrUpdate(saleOrder); getSession().getTransaction().commit(); But someDetails doesn't removed. -- Any help will be appreciated ...
score: 0
has answer: http://stackoverflow.com/a/22935924
type: UnansweredQuestion
tagged with: annotations
has title: hibernate update one to many items set
type: Question
tagged with: java
tagged with: hibernate
tagged with: mysql
has answer: http://stackoverflow.com/a/22923371

http://stackoverflow.com/q/22949281
has title: java Generalized Hypergeometric function
type: UnansweredQuestion
upvote count: 16
has answer: http://stackoverflow.com/a/46980399
tagged with: java
score: 16
has answer: http://stackoverflow.com/a/46998771
has answer: http://stackoverflow.com/a/22949344
type: Question
tagged with: math
has body: I am looking for a java library that can calculate generalized hypergeometric function (http://en.wikipedia.org/wiki/Generalized_hypergeometric_series). I looked at Apach Common Math, but did not find the function. Actually, I need the function to calculate the cumulative probability function for beta-binomial distribution (http://en.wikipedia.org/wiki/Beta-binomial_distribution). If anyone knows a java package including the distribution, it would be good for me. Thanks,
tagged with: statistics
answer count: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/34927900
comment on: http://stackoverflow.com/a/22888159
score: 0
type: AnswerComment
has text: But in that last case, you could write `static <T> Class<T> forName(String className)` and it would be OK. There is no case when you actually **need** `<?>`.
type: Comment

http://stackoverflow.com/q/22934418
answer count: 3
has comment: http://stackoverflow.com/comment/35010236
downvote count: 0
possible better answer: http://stackoverflow.com/a/23107100
has title: Converting from Set<SomeEnum> to Set<? extends SomeInterface> when SomeEnum implements SomeInterface
tagged with: generics
accepted answer: http://stackoverflow.com/a/23111001
favorite count: 0
has answer: http://stackoverflow.com/a/23110253
has answer: http://stackoverflow.com/a/23111001
type: AnsweredQuestion
score: 3
tagged with: enums
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23107100
has comment: http://stackoverflow.com/comment/35312798
has comment: http://stackoverflow.com/comment/35320614
type: Question
linked to: http://stackoverflow.com/q/4958913
has body: I have an interface and an enum as follows: public interface SomeInterface { ...... } public enum SomeEnum implements SomeInterface { ...... } public class SomeClass { public void someMethod(Set&lt;SomeInterface&gt; s) { ... } } Now to call someMethod(Set&lt;SomeInterface&gt; s) I create an enum set containing all of the elements, so I do following: Set&lt;? extends SomeInterface&gt; choosen = EnumSet.allOf(SomeEnum.class); SomeClass obj = new SomeClass(); obj.someMethod(choosen) I get compile time error: error: method someMethod in class SomeClass cannot be applied to given types; required: Set&lt;SomeInterface&gt; found: Set&lt;CAP#1&gt; reason: actual argument Set&lt;CAP#1&gt; cannot be converted to Set&lt;SomeInterface&gt; by method invocation conversion where CAP#1 is a fresh type-variable: CAP#1 extends SomeInterface from capture of ? extends SomeInterface IMP: I know that the error can be resolved by changing the method to someMethod(Set&lt;? extends SomeInterface&gt; s), but I CAN NOT change the signature of someMethod
has comment: http://stackoverflow.com/comment/35331112

http://stackoverflow.com/a/22859434
type: Answer
answers question: http://stackoverflow.com/q/22859324
has comment: http://stackoverflow.com/comment/34874511
has body: You are missing the remove part. Try something like this: public static void main(String[] args) { Integer [] colm = {1,2,3,4,5,67,87}; final List&lt;Integer&gt; ints = new ArrayList&lt;Integer&gt;(Arrays.asList(colm)); Random rand = new Random(); for(int i = 0; (i&lt;5) &amp;&amp; (ints.size() &gt; 0); i ++) { final int randomIndex = rand.nextInt(ints.size()); System.out.println(" " + ints.get(randomIndex)); ints.remove(randomIndex); } }
has comment: http://stackoverflow.com/comment/34875231
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/q/22845718
answer count: 2
possible better answer: http://stackoverflow.com/a/22845858
has body: Yesterday I read that using getApplicationContext() was potentially hazardous. Thus, code like this: Toast.makeText(getApplicationContext(), "You mashed the button, dude.", Toast.LENGTH_SHORT).show(); ...should be this instead: Toast.makeText(MainActivity.this, "You mashed the button, dude.", Toast.LENGTH_SHORT).show(); (where "MainActivity" is the name of the class in which the code lives). Yet I see many code snippets that include getApplicationContext(), such as: button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { _initTask = new InitTask(); _initTask.execute( getApplicationContext() ); } }); ...from here. Is it really preferable to use &lt;className>.this over getApplicationContext()? UPDATE I've obviously still not understanding the niceties (or meanities) of this; with this code: Toast.makeText(GetVendorsTask.this, s[0], Toast.LENGTH_SHORT).show(); I get this compilation err msg: Error:(156, 18) error: no suitable method found for makeText(MainActivity.GetVendorsTask,String,int) method Toast.makeText(Context,CharSequence,int) is not applicable (argument mismatch; MainActivity.GetVendorsTask cannot be converted to Context) method Toast.makeText(Context,int,int) is not applicable (argument mismatch; MainActivity.GetVendorsTask cannot be converted to Context) So I changed the complained-about line of code to: Toast.makeText(MainActivity.this, s[0], Toast.LENGTH_SHORT).show(); ...and it works (compiles). MainActivity is the outermost class in the .java file (named MainActivity.java, that is); but GetVendorsTask is the most proximate class (that line of code is within the GetVendorsTask class). To be clear, the code is: public class MainActivity extends ActionBarActivity { . . . class GetVendorsTask extends AsyncTask&lt;Context, String, SearchResponse&gt; { . . . @Override protected void onProgressUpdate(String... s) { super.onProgressUpdate(s); //Toast.makeText(getApplicationContext(), s[0], Toast.LENGTH_SHORT).show(); &lt;= "getAp…
score: 1
has answer: http://stackoverflow.com/a/22845858
has comment: http://stackoverflow.com/comment/34849886
tagged with: android
accepted answer: http://stackoverflow.com/a/22845899
favorite count: 0
has comment: http://stackoverflow.com/comment/34849939
upvote count: 2
downvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7298731
has title: Is Use of getApplicationContext() considered Harmful?
tagged with: java
has answer: http://stackoverflow.com/a/22845899
type: Question

http://stackoverflow.com/a/22910415
score: 7
upvote count: 7
has body: That works fine because you are implicitly performing a widening primitive conversion from int to float and long respectively. However this would not compile and you would need to add an f or a L to make it work: float f = 1.0; //can't convert from double to float long l = 12345678912; //12345678912 is not a valid int
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22910343
accepted answer of: http://stackoverflow.com/q/22910343
type: Answer

http://stackoverflow.com/a/38073038
has body: the problem will be solved by checking on 'JRE System Library' and 'Maven Dependencies' checkboxs Click OK. this is found in the project's 'build path option'
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22914927
upvote count: 1

http://stackoverflow.com/comment/34992205
type: Comment
type: QuestionComment
has text: Lets say i have a size of 2 elements in my linkedlist. I'll name them c and c+1, how would i add them between with the index? Can i just say list.add(c+1) and he moves the reference on his own?
score: 0
comment on: http://stackoverflow.com/q/22924044

http://stackoverflow.com/comment/35023225
comment on: http://stackoverflow.com/a/22941470
has text: OK I have found a [Link](http://stackoverflow.com/questions/10122969/java-tcp-server-program-running-on-apache-tomcat), but I'm unable to figure that out correctly
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35091693
type: Comment
has text: hi Nitin,thanks a lot buddy...I tried this code but it did not work for me. I would like to know if there is something missing.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22958143

http://stackoverflow.com/comment/35033219
type: QuestionComment
comment on: http://stackoverflow.com/q/22946961
score: 0
has text: i could post my code but it's very long and probably not the best in the world because I'm new to Java.swing.. but if you want to see it I will post it
type: Comment

http://stackoverflow.com/comment/35092833
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).
score: 0
comment on: http://stackoverflow.com/q/22966976
type: Comment
type: QuestionComment

http://stackoverflow.com/a/33811407
answers question: http://stackoverflow.com/q/22967008
type: Answer
has comment: http://stackoverflow.com/comment/55398030
has body: Add the following to your pom.xml, inside your project tag: org.apache.hadoop hadoop-core 1.2.1
score: 0

http://stackoverflow.com/comment/34946833
type: Comment
comment on: http://stackoverflow.com/a/22899094
score: 0
type: AnswerComment
has text: this is exactly what i needed to fix my problem! i thought there was a function in java to do this, but actually we must use this algorithm.. thank you so much for your help sir! i'll mark this as the answer :)

http://stackoverflow.com/comment/35002822
has text: Also, it seems to me that you are actually testing the Marshaller, not the testToXml method
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22917585

http://stackoverflow.com/comment/35049013
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22955882
has text: The iterating up is what we're doing right now, while this works, the amount of projects is increasing rapidly so this gets slower very quickly...
score: 0

http://stackoverflow.com/q/22926507
has comment: http://stackoverflow.com/comment/34996535
tagged with: unit-testing
type: Question
tagged with: mockito
has title: Mockito when and InOrder
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34996870
answer count: 0
has comment: http://stackoverflow.com/comment/34996659
tagged with: java
has body: Lets say I have a class: public class A { private B mB; private C mC; public A(B b, C c) { mB = b; mC = c; } public void doSomething(D d) { mB.doThisFirst(mC); if (mB.isValid(d)) { mB.doIfValid(mC, d); } else { mB.doIfNotValid(mC, d); } } Now I'm testing A and make a mock of B and C. I want to do two tests: the first one will assume that mB.isValid(d) is true, while the second one will assume that mB.isValid(d) is false. How do I verify? I tried stubbing mB.isValid() to return true, but mB.isValid() actually always returns false. private A mA; private B mB; private C mC; @Before public void setup() { mB = mock(B.class); mC = mock(C.class); mA = new A(mB, mC); } @Test public void test() { d = new D(); when(mB.isValid(d)).thenReturn(true); mA.doSomething(d); InOrder inOrder = inOrder(mB); inOrder.verify(mB).doThisFirst(mC); inOrder.verify(mB).doIfValid(mc, d); } inOrder.verify(mB).doIfValid(mc, d) will always fail. If I change it to inOrder.verify(mB).doIfNotValid(mc, d), it will pass. If this is not the correct way to do this, please tell me how. Thanks.
has comment: http://stackoverflow.com/comment/34996549
has comment: http://stackoverflow.com/comment/34996719

http://stackoverflow.com/comment/35005090
type: QuestionComment
comment on: http://stackoverflow.com/q/22929900
has text: @rex8tom What else do you have which we do not know about? Do you have a `Provider` something like that in your solution? Please upload your solution somewhere so we can check it, the code you mentioned above is not the issue here.
score: 0
type: Comment

http://stackoverflow.com/a/22927584
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22927388
has body: When you construct your class, your array 'foodName' is initiated with a length of zero. The reason for this is that when you declare an integer eg.public int foodTypes', all the compiler sees is public int foodTypes = 0; Arrays cannot be resized after you have initialized them so you cannot 'reset' the size of the array. I would add a constructor that takes a number from input and assigns that to foodTypes so it is not 0. here is some untested code: class Gerbil { public int foodTypes; public String[] foodName; public Gerbil(int num){ this.foodTypes = num; this.foodName = new String[foodTypes]; } } public class Assignment4 { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); System.out.println("How many types of food do the gerbils eat?"); Gerbil gerbil = new Gerbil(keyboard.nextInt()); for (int x = 0; x &lt; gerbil.foodTypes ; x++) { System.out.println("Enter the name of food item " + (x+1)); gerbil.foodName[x] = keyboard.nextLine(); keyboard.nextLine(); System.out.println("Maximum consumed per gerbil:"); gerbil.foodMax[x] = keyboard.nextInt(); } Here is some further documentation on arrays.

http://stackoverflow.com/q/22935550
accepted answer: http://stackoverflow.com/a/22936065
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22936010
tagged with: date
type: Question
possible better answer: http://stackoverflow.com/a/22935891
has comment: http://stackoverflow.com/comment/35012399
has comment: http://stackoverflow.com/comment/35012402
linked to: http://stackoverflow.com/q/22163662
answer count: 3
upvote count: 1
has body: I want to execute a task periodically if time is in between 9 AM to 9:11 AM I was able to capture the current time, but could please tell me how can I compare that with the above condition ?? public class Test { public static void main(String[] args) { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); String systemTime = sdf.format(new Date()).toString(); System.out.println(systemTime); } }
favorite count: 0
has answer: http://stackoverflow.com/a/22935891
has title: Compare time and execute some a task repeatedly
downvote count: 0
has answer: http://stackoverflow.com/a/22936065

http://stackoverflow.com/a/22964593
has comment: http://stackoverflow.com/comment/104845514
has body: All your business logic should be in the Service Layer. Any access to the Database (any storage) should go to the Repository Layer. Lets take an Example. You have to save an entity(Person). But before saving the Person you want to make sure that the Person's FirstName does not exist already. So the validation part should go to the business layer. In the service Layer PersonRepository repository; public Person save(Person p){ Person p = findByName(p.getName(); if (p != null){ return some customException(); } return repository.save(p); } public Person findByName(String name){ return repository.findByName(name); } And in your Repository Layer just concentrate on DB Operation. You could have done this in Repository Layer it self. Assume you have implemented this in your Repository then your save method always check before saving (some time you may not required to do).
has comment: http://stackoverflow.com/comment/87532730
upvote count: 29
answers question: http://stackoverflow.com/q/22963352
downvote count: 1
score: 28
type: Answer
has comment: http://stackoverflow.com/comment/87463118

http://stackoverflow.com/q/22847578
has title: Implementing a new Interface on subclass' inherited AbstractMap.SimpleEntry?
has comment: http://stackoverflow.com/comment/34853308
has comment: http://stackoverflow.com/comment/34853475
has body: Given, public class XHashMap&lt;K,V&gt; extends AbstractMap&lt;K,V&gt; implements Map&lt;K,V&gt; { //impl } I want to subclass XHashMap and have its inherited SimpleEntry inner class implement a new Interface Y. So what do I do after this obvious code public class MyXHashMap&lt;K,V&gt; extends XHashMap&lt;K,V&gt; { // over-ride to affect outer My intent // see below re: questions of My inner intent } to correctly (in Java) then affect the inner equiv of MyXHashMap.SimpleEntry&lt;K,V&gt; implements Y { //impl of Y } ??
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34853374
has answer: http://stackoverflow.com/a/22847817
accepted answer: http://stackoverflow.com/a/22847817
type: Question
has comment: http://stackoverflow.com/comment/34853190
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/34853580
answer count: 1

http://stackoverflow.com/comment/34933858
score: 0
type: Comment
type: AnswerComment
has text: Oh I see what you're saying, FreeTTS is the launching class. You need the code in FormTTS (which is the frame)
comment on: http://stackoverflow.com/a/22892065

http://stackoverflow.com/comment/35058726
comment on: http://stackoverflow.com/a/22945704
score: 0
type: AnswerComment
has text: No need to answer the last question. I just added the .class like you said, created my executable JAR file and rant it. Worked beautifully. Thanks Stefan!!!
type: Comment

http://stackoverflow.com/q/22910018
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22910308
tagged with: entity-framework
type: Question
accepted answer: http://stackoverflow.com/a/23196776
tagged with: java
has body: I'm having a JPA-Project in IntelliJ Idea and there are some entities my colleague mapped some time ago. Now the DB team added a bunch of tables I'm trying to add as entities to the Java-Project. But when I'm trying to map a new entity to a existing entity IntelliJ Idea doesn't know the entity. So I'm wondering, if the only way is to re-import the table? BankEntity exists in the JavaProject, but the mapper doesn't recognize it. Thanks !
answer count: 2
possible better answer: http://stackoverflow.com/a/22910308
has answer: http://stackoverflow.com/a/23196776
tagged with: intellij-idea
tagged with: jpa
has title: Edit JPA-Mapping in IntelliJ Idea

http://stackoverflow.com/a/22939283
has comment: http://stackoverflow.com/comment/35019562
answers question: http://stackoverflow.com/q/22937199
type: AcceptedAnswer
upvote count: 2
has body: An object does not have a name. We give names to variables so that we know what they point to, what they represent. Dynamically name a variable does not seem very useful, since you need to reference it afterwards. If the reference is dynamic too, then why not use a data structure instead? For instance: If you're trying to give numbers to your variables, for instance ship0, ship1... then you can use an array ships instead, and access ships[0], ships[1]. If you want more general names that reference objects, you can use a Map&lt;String,Object&gt; instead.
type: Answer
has comment: http://stackoverflow.com/comment/35019168
has comment: http://stackoverflow.com/comment/35019422
score: 2
accepted answer of: http://stackoverflow.com/q/22937199
downvote count: 0

http://stackoverflow.com/comment/35114320
type: AnswerComment
score: 0
type: Comment
has text: I am using netbeans 8 and JDk 1.8.0 and i executed the command in the same manner as you did.
comment on: http://stackoverflow.com/a/22964156

http://stackoverflow.com/comment/35022676
has text: I forgot to crop the } , sorry.
comment on: http://stackoverflow.com/a/22941263
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22903111
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34953974
type: UnansweredQuestion
has title: trouble with implementing classes
has body: I have trouble implementing the classes for Car ship and plane. I already made an interface which is: public interface Movable public void moveForward(); public void moveForward(int x); public void moveBackward(); public void moveBackward(int x); public void moveLeft(); public void moveLeft(int y); public void moveRight(); public void moveRight(int y); public void displayCoordinates(); But i want to have two int fields to keep track of the coordinates (x, y). • The default coordinates will be (0, 0), and an overloaded constructor will allow the user to initialize them to other values. • The movement of the objects will change the coordinates (x, y) one step at a time by default depending on the direction (i.e. moveForward() will add 1 to x, moveLeft() will subtract 1 from y). Overloaded methods will allow the user to change the coordinates a n number of steps at a time (i.e. moveForward( 7 ) will add 7 to x). But I don't know what do. Can anyone help me?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22903177
has comment: http://stackoverflow.com/comment/34953871

http://stackoverflow.com/comment/34922149
comment on: http://stackoverflow.com/q/22885387
score: 0
type: Comment
type: QuestionComment
has text: Eclipse is asking you to set `dataSet = null` because Eclipse does not like it to be uninitialized. If you set `dataSet = new ArrayList<Integer>()`, then Eclipse will stop complaining. However, that does not solve your general problem.

http://stackoverflow.com/q/22934965
tagged with: autocomplete
has title: google places autocomplet is not showing any resault
type: UnansweredQuestion
has body: i am trying to build an auto complete from google places in the debugger i see i get back the result and the JSON parser return a list of the places but the autocomplete list doesn't sown in the app any suggestion code is attached below package autocompleat; import android.R.id; import android.view.MotionEvent; import android.view.View.OnClickListener; import android.view.View.OnTouchListener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.HashMap; import java.util.List; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.location.Address; import android.location.Geocoder; import android.os.AsyncTask; import android.os.Bundle; import android.os.StrictMode; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.SimpleAdapter; import android.view.View; import com.example.hellogooglemaps.MainActivity; import com.example.hellogooglemaps.R; import com.google.android.gms.maps.model.LatLng; import dialogs.JumpToDialog; public class Autocomplet extends Activity{ AutoCompleteTextView atvPlaces; PlacesTask placesTask; ParserTask parserTask; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.jumpto); JumpToDialog jumpTo = new JumpToDialog(); jumpTo.getActivity(); atvPlaces= (AutoCompleteTextView) findViewById(R.id.addressToGo); atvPlaces.setThreshold(2); atvPlaces.setOnTouchListener(new View.OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub atvPlaces.showDropDown(); return false; } }); atvPlaces.addTextChangedListener(new TextWatc…
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/22935228
tagged with: google-places-api
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 1

http://stackoverflow.com/a/22855989
score: 1
answers question: http://stackoverflow.com/q/22855484
downvote count: 0
type: Answer
upvote count: 1
has body: Instead doing programmatically, check your connection pool has the option to set auto commit to false when returning connection from the pool. DBCP's BasicDataSource has such option Spring will do rollback if any RuntimeException is thrown .

http://stackoverflow.com/q/22942223
tagged with: java-8
has answer: http://stackoverflow.com/a/22944342
type: AnsweredQuestion
tagged with: java-stream
accepted answer: http://stackoverflow.com/a/22942829
has body: Suppose I have a collection of the unknown type. What I want to do is stream it, do some stuff on the stream, and collect it back into the same collection type as my original collection. For instance: Collection&lt;? extends Integer&gt; getBigger(Collection&lt;? extends Integer&gt; col, int value) { return col.stream().filter(v -&gt; v &gt; value).collect(????); } The idea of this incomplete code example is to return a List if col is of List class (or any subclass of it), a Set if col is of Set class, etc... The method name and actual operations on the stream here are not important, I've specified them just to illustrate my question. So, is it possible?
tagged with: java
upvote count: 10
type: Question
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/49825560
linked to: http://stackoverflow.com/q/22918847
has comment: http://stackoverflow.com/comment/35024609
answer count: 3
has title: Collecting stream back into the same collection type
has answer: http://stackoverflow.com/a/22942829
score: 10
possible better answer: http://stackoverflow.com/a/22944342

http://stackoverflow.com/q/22846484
tagged with: design-patterns
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34853758
tagged with: oop
accepted answer: http://stackoverflow.com/a/22848096
tagged with: java
has comment: http://stackoverflow.com/comment/34852984
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/34853920
has comment: http://stackoverflow.com/comment/34851741
score: 0
has answer: http://stackoverflow.com/a/22848096
answer count: 1
has title: How would you design a Collabritive/ Shareable Text Editor: Key points are given below
has body: Read/Write operations by multiple users. A user may be able to make the editor read only i.e only the creator of the session writes. You should be able to share the link of the current session to add more users to work on simultaneously. It should be concurrent(synchronization) and avoid editing conflicts. Suggest approach to do this. Please focus on a correct and scalable functionality. Should have auto save Editor should maintain changes/edits on each save. Support rollback to any change. Must have share/like functionality for social media. I was able to come with the following, need help identifying classes to build a class diagram for this: It will be a client server implementation. For website, client can be written in HTML5 and Javascript. We can use additional javascript frameworks for specific requirements(eg. angularjs). For sending request two methods are available: 1. Request/Response -- Sending request every second 2. Long pooling -- Make a never ending http request to server and communicate through it. This method will be way faster that earlier one because multiple http request will not be made. Its the work of client to send the changes to server on fixed interval (1 second). Its the work of client to understand the changes done by other users and display the same to current user. Server will be expose an API which will be used to -- Get current document -- SendUpdate request whose response will contain modification done by other users on same document. We will try and capture the delta and represent the changes on the client side. Server Stack has to be very fast(.node.js or golang will be suitable for such requirement) because of its very short response time. Data should be stored in memory, we can use Redis to store data. We can on intervals or on explicit save requests, save data on the file system or non in memory databases also. Every request will contain set of changes made by client. These changes will be saved in Redis along with timestamp. W…
tagged with: multithreading

fonts
tags question: http://stackoverflow.com/q/22839206
tags question: http://stackoverflow.com/q/22889058
tags question: http://stackoverflow.com/q/22879563
tags question: http://stackoverflow.com/q/22886205
tags question: http://stackoverflow.com/q/22847148
type: Tag
tags question: http://stackoverflow.com/q/22945684
tags question: http://stackoverflow.com/q/22853386
tag name: fonts

http://stackoverflow.com/comment/34865560
type: QuestionComment
comment on: http://stackoverflow.com/q/22854329
score: 0
has text: If the values are compile time constants then use an `enum` to store them. Otherwise use a `Map`.
type: Comment

http://stackoverflow.com/comment/34990295
type: Comment
comment on: http://stackoverflow.com/q/22922997
has text: I don't think there's a way to do that. I think I'd need to see what you're trying to accomplish to suggest a good solution. My offhand suggestion is to create an object that has `WebElement` and `By` properties, and pass in `element.By` to your method.
score: 0
type: QuestionComment

http://stackoverflow.com/q/22845648
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/34866891
tagged with: java
has title: Saving with Jackon in LibGDX
type: Question
tagged with: libgdx
tagged with: jackson
has comment: http://stackoverflow.com/comment/34856108
score: 0
has body: I'm making a note-taking program using libgdx (a game engine). I want to save the user's notes and sheets when they hit save . First question is, is writing to JSON with Jackson the right way to do this? If it isn't, could someone tell me the right way to save? I have too much stuff for preferences and the JSon class built into libgdx isn't working for me. toJSon throws a StackOverflowError. If Jackson is the right thing to use, how can I fix this error com.fasterxml.jackson.databind.JsonMappingException: (was java.nio.BufferUnderflowException) (through reference chain):etc

http://stackoverflow.com/a/23092203
type: Answer
has body: I couldn't run your code as it is posted, but I believe upon visual inspection the line BoardSquares[row][column] = bs; should be bs = BoardSquares[row][column]; As it is written above, a NullPointerException would occur and bs is never actually getting set. The revision I have offered would allow the shape to be set in the GameBoard class.
answers question: http://stackoverflow.com/q/22926839
score: 0

http://stackoverflow.com/comment/34858126
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22849340
has text: Awesome find. We fit in this category too. Now how do we fix it? :)

http://stackoverflow.com/comment/34864861
has text: 1) Why code an applet? If it is due to spec. by teacher, please refer them to [Why CS teachers should stop teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). 2) Why AWT rather than Swing? See my answer on [Swing extras over AWT](http://stackoverflow.com/a/6255978/418556) for many good reasons to abandon using AWT components.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22830399
score: 0

http://stackoverflow.com/a/22835344
type: AcceptedAnswer
score: 0
type: Answer
has body: Problem got solved. Though I don't understand why did it occur. I changed new FileBody(file, ContentType.create( "image/jpg")/*,"Swapnil.jpg"*/ ) to new FileBody(file, ContentType.create( "image/jpg"),"Swapnil.jpg" ). For some reason it solved the issue.
answers question: http://stackoverflow.com/q/22811650
accepted answer of: http://stackoverflow.com/q/22811650

http://stackoverflow.com/comment/34818883
has text: Why it happens - your parameter (or parameters) aren't convertible to an `Integer`. How do you fix it? Always pass integral values to those parameters.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22828417
type: Comment

configuration
tags question: http://stackoverflow.com/q/22917228
tags question: http://stackoverflow.com/q/22934604
tags question: http://stackoverflow.com/q/22959977
type: Tag
tags question: http://stackoverflow.com/q/22953224
tag name: configuration
tags question: http://stackoverflow.com/q/22965667

http://stackoverflow.com/comment/34792698
comment on: http://stackoverflow.com/q/22813848
score: 1
has text: I don't get it. If you want to isolate that single time when code executes in `a.java` why not set the breakpoint in `a.java`?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22954144
has body: I would like to make a program that can transfer data as pulses of a certain frequency but am unsure on how to detect if a frequency is present. I would assume I need to filter out all unneeded frequencies but I can't seem to find anything on how to do this. Are there any libraries that already do this or would I have to build my own? Are there any examples of this or something similar being done?
type: AnsweredQuestion
tagged with: audio
score: 1
tagged with: java
upvote count: 1
has title: Detect frequency from microphone Java
type: Question
has answer: http://stackoverflow.com/a/22954647
has comment: http://stackoverflow.com/comment/35045683
has answer: http://stackoverflow.com/a/22972015
possible better answer: http://stackoverflow.com/a/22954647
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22972015
tagged with: frequency

http://stackoverflow.com/comment/34862060
score: 0
type: AnswerComment
type: Comment
has text: Jonn is this all going under Main?
comment on: http://stackoverflow.com/a/22852281

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/22924096
type: Tag
tags question: http://stackoverflow.com/q/22850398
tags question: http://stackoverflow.com/q/22878201

http://stackoverflow.com/q/22961215
accepted answer: http://stackoverflow.com/a/22961246
tagged with: java
has comment: http://stackoverflow.com/comment/35057823
has answer: http://stackoverflow.com/a/22961751
type: Question
has title: Java OutOfMemory Heap Space
has comment: http://stackoverflow.com/comment/35057607
possible better answer: http://stackoverflow.com/a/22961518
has comment: http://stackoverflow.com/comment/35057881
linked to: http://stackoverflow.com/q/1565388
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35057772
tagged with: heap-memory
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/35058466
has answer: http://stackoverflow.com/a/22961246
has body: everyone. I am working on a project. Along the way, I got the "OutOfMemory" problem with this line of code... this.A = new int[n][n]; ...for n = 10000; I tried fixing it by adding -Xmx2048m command but the thing is when added, all of the rest of running programs stops responding. Any other suggestion for my case? Thanks a lot
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35058342
has answer: http://stackoverflow.com/a/22961518

inputstream
tags question: http://stackoverflow.com/q/22881660
tags question: http://stackoverflow.com/q/22817969
tags question: http://stackoverflow.com/q/22920753
tag name: inputstream
tags question: http://stackoverflow.com/q/22812381
tags question: http://stackoverflow.com/q/22870782
type: Tag
tags question: http://stackoverflow.com/q/22874147
tags question: http://stackoverflow.com/q/22843417
tags question: http://stackoverflow.com/q/22871599
tags question: http://stackoverflow.com/q/22859002
tags question: http://stackoverflow.com/q/22832324

http://stackoverflow.com/comment/34851575
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22846448
has text: Thanks! Here's one hint... Your font is defined as 12 [Points](http://en.wikipedia.org/wiki/Point_%28typography%29) (see the third argument in the Font constructor). There are 72 points in an inch.

http://stackoverflow.com/a/22929849
has body: At first format your string with %,d format then replace all (,) with (.) as follows... String formatedString = (String.format("%,d", 1000000)).replace(',', '.'); Log.d("Fomated String", formatedString); Output: D/Fomated String(20323): 1.000.000
type: Answer
answers question: http://stackoverflow.com/q/22929551
score: 0

http://stackoverflow.com/q/22826640
possible better answer: http://stackoverflow.com/a/22828688
has comment: http://stackoverflow.com/comment/34983168
downvote count: 0
has answer: http://stackoverflow.com/a/22828688
accepted answer: http://stackoverflow.com/a/22851163
favorite count: 0
has body: I have enabled StrictMode and captured this log(/data/anr/traces.txt). The issue is that the listview is hanging after processing about 3 rows(on the 4th row). I am using the holder pattern. The list view everywhere else seems to be working fine. Any help is appreciated. JNI: CheckJNI is off; workarounds are off; pins=0; globals=320 DALVIK THREADS: (mutexes: tll=0 tsl=0 tscl=0 ghl=0) "main" prio=5 tid=1 SUSPENDED | group="main" sCount=1 dsCount=0 obj=0x41ddbca8 self=0x41dca3c8 | sysTid=22827 nice=0 sched=0/0 cgrp=apps handle=1075642708 | state=S schedstat=( 38273640000 1091756000 67689 ) utm=3677 stm=150 core=1 at android.view.View.getContext(View.java:~8153) at android.view.View.getLayoutDirection(View.java:6247) at android.widget.RelativeLayout.getRelatedView(RelativeLayout.java:997) at android.widget.RelativeLayout.getRelatedViewBaseline(RelativeLayout.java:1021) at android.widget.RelativeLayout.alignBaseline(RelativeLayout.java:642) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:519) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16497) at android.widget.ListView.setupChild(ListView.java:1870) at android.widget.ListView.makeAndAddView(ListView.java:1793) at android.widget.ListView.fillDown(ListView.java:691) at android.widget.ListView.fillFromTop(ListView.java:752) at android.widget.ListView.layoutChildren(ListView.java:1616) at android.widget.AbsListView.onLayout(AbsListView.java:2091) 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 androi…
tagged with: android-listview
tagged with: android
has title: What does this ANR mean?
has comment: http://stackoverflow.com/comment/34855589
upvote count: 3
tagged with: android-anr-dialog
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22851163
tagged with: java
has comment: http://stackoverflow.com/comment/34816330
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34855264

http://stackoverflow.com/comment/35038369
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22949086
type: QuestionComment
has text: @SujanSivagurunathan `[EL Fine]: sql: 2014-04-09 02:11:25.068--ServerSession(1326241430)--Connection(781388466)--Thread(Thread[http-bio-8080-exec-10,5,main])--SELECT t0.DATE, t0.DEPARTURE, t0.DESTINATION, COUNT(t1.ID), SUM(t0.TICKETCOST) FROM flights t0, tickets t1 WHERE ((((t1.STATUS = ?) AND NOT ((((((t1.ADDRESS IS NULL) AND (t1.EMAIL IS NULL)) AND (t1.NAME IS NULL)) AND (t1.OWNERFROM IS NULL)) AND (t1.PHONE IS NULL)))) AND (t0.DATE BETWEEN ? AND ?)) AND (t0.ID = t1.flightId)) GROUP BY t0.ID bind => [SOLD, 2014-04-01, 2014-04-30] ` is the SQLite log

http://stackoverflow.com/comment/34908502
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22877595
type: AnswerComment
has text: I added a call to `repaint` before the `Thread.sleep` to simulate and got [this](http://imgur.com/JRfW9n4) result. It wouldn't take much to throw it off in production and have you scratching your head wondering why...

http://stackoverflow.com/comment/34932772
has text: No I'm reading it now.But i think that catch it soon.
score: 0
comment on: http://stackoverflow.com/q/22891478
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22842235
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/22844876
has title: java.lang.RuntimeException: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
answer count: 1
downvote count: 0
score: 4
linked to: http://stackoverflow.com/q/46812752
tagged with: public-key-encryption
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/22844876
type: AnsweredQuestion
tagged with: java
has body: I get this error(in the title). I am not sure why, help, please. Code below: public static String decryptRSA(Context mContext, byte[] message) throws Exception { InputStream in = mContext.getResources().openRawResource(R.raw.publicrsakey); X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(org.apache.commons.io.IOUtils.toByteArray(in)); PublicKey publicKey = KeyFactory.getInstance("RSA").generatePublic(x509EncodedKeySpec); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, publicKey); final String encryptedString = Base64.encode(cipher.doFinal(message)); return encryptedString; } Edit. In the end i managed this problem using public key file with .der extension (before it was .crt), and the code that worked was: InputStream in = mContext.getResources().openRawResource(R.raw.key); CertificateFactory cf = CertificateFactory.getInstance("X509"); Certificate cert = cf.generateCertificate(new ByteArrayInputStream(org.apache.commons.io.IOUtils.toByteArray(in))); PublicKey pubKey = cert.getPublicKey(); try { Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); final String encryptedString = Base64.encode(cipher.doFinal(message)); return encryptedString; } catch (Exception e) { e.printStackTrace(); } return ""; But "divanov" answered the question i was asking.

http://stackoverflow.com/a/22843021
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22842969
answers question: http://stackoverflow.com/q/22842969
type: Answer
has body: It's not a bad practice, however you may want to separate your classes within the same package, or even in different packages once your code grows. If it's for a quick test, there's absolutely nothing wrong with it. In other words... The main method is an entry point to your application. If your application only consists of one class or a few classes, possibly within the same file, then your entry point can be a static method of (one of) your class(es). Once you start to get package hierarchies and a lot of structured code you may want to separate your entry point from your data, presentation, resources, etc.

http://stackoverflow.com/a/22923717
score: 0
has body: try adding this, instead of 4.0.0.RELEASE: org.springframework spring-tx 3.2.4.RELEASE and then do a mvn clean install
type: Answer
answers question: http://stackoverflow.com/q/22905798

http://stackoverflow.com/q/22945386
tagged with: spring-test
has answer: http://stackoverflow.com/a/22946290
tagged with: junit
answer count: 1
has comment: http://stackoverflow.com/comment/35029899
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has body: I'm writing my test cases with MockMvc. This is how my controller looks like: @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(locations = { "classpath:/WEB-INF/context/local-applicationContext-database.xml", "classpath:/WEB-INF/context/applicationContext-common.xml", "classpath:/WEB-INF/context/applicationContext-dao.xml", "classpath:/WEB-INF/context/applicationContext-service.xml", "classpath:/WEB-INF/context/applicationContext-ehcache.xml", "classpath:/WEB-INF/context/applicationContext-aop.xml", "classpath:/WEB-INF/context/applicationContext-transaction.xml", "classpath:/WEB-INF/context/local-applicationContext-host.xml" }) public class ControllerTest { @Autowired private WebApplicationContext wac; private MockMvc mockMvc; @Before public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); } But I am gettinG ApplicationContext errors: org.springframework.beans.factory.BeanCreationException: Error creating bean (the beans which are defines inside the above inluded conext files). If I us e the same configuration with old approach (i.e without using MockMvc , it works) Any suggestions what is wrong here? full stack trace: Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@224a9e5] to prepare test instance [com.omgeo.ts.confirm.controller.profile.test.BTIImportProfileControllerTest@224a97f] [org.springframework.test.context.TestContextManager:314] java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:105) at org.springframework.test.context.web.ServletTestExecutionListener.prepare…
tagged with: spring-mvc
score: 2
has comment: http://stackoverflow.com/comment/35030200
has comment: http://stackoverflow.com/comment/35031625
upvote count: 2
tagged with: java
has title: Junit test spring controller mockMvc @ContextConfiguration
type: Question

http://stackoverflow.com/comment/35004747
type: QuestionComment
score: 0
has text: @EJP If he is asking _Could it write directly an integter or string?_ I think the easiest way is using serialization, don't you think?
comment on: http://stackoverflow.com/q/22929248
type: Comment

http://stackoverflow.com/comment/34895908
has text: @ylun.za behind get initialized to 0 by default. lastTime should be initialized to the current time at beginning. I fixed that.
comment on: http://stackoverflow.com/q/22869740
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22812124
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34790043
has body: You can remove labels from nodes using: node.removeLabel(DynamicLabel.label("MyLabel")); And you can find all the nodes with the incorrect label using the global operations: GlobalGraphOperations.at(graphDB).getAllNodesWithLabel( DynamicLabel.label("MyLabel") );
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22811885
answers question: http://stackoverflow.com/q/22811885
type: Answer

http://stackoverflow.com/a/22890975
answers question: http://stackoverflow.com/q/22885491
has comment: http://stackoverflow.com/comment/34934078
has comment: http://stackoverflow.com/comment/34932935
score: 0
has body: You must put keyIterator.remove() after keyIterator.next() The selector doesn't remove anything from selectedKeys() itself. NB You don't need to attach the channel to the key as an attachment. You can get it from key.channel().
type: Answer
has comment: http://stackoverflow.com/comment/34936362

http://stackoverflow.com/comment/34909453
type: Comment
comment on: http://stackoverflow.com/q/22878501
has text: Strings can be very slow. Do you really need to split it or can you just process the string without having to copy portions of it out and insert into a hashset?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34950521
type: Comment
type: QuestionComment
has text: @Close-voters It's only 'too broad' if you actually think it makes any difference, and that there really are numerous factors involved. It doesn't, and there aren't.
score: 0
comment on: http://stackoverflow.com/q/22900261

http://stackoverflow.com/q/22915116
possible better answer: http://stackoverflow.com/a/22926600
has comment: http://stackoverflow.com/comment/34975296
favorite count: 0
score: -3
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34975084
has body: Need help! In java swing, how can I jump back(open up) the hidden form from which the previous form had been generated? Elaborating -> I made an object of form2 in form1, hid the 1st form and displayed the 2nd one. Now after a while I have to hide the form2 and open the original form1. How can I do that?
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/22926600
has title: Related to java swings
type: Question
has answer: http://stackoverflow.com/a/22915172
accepted answer: http://stackoverflow.com/a/22915172
linked to: http://stackoverflow.com/q/9554636
upvote count: 0
answer count: 2

http://stackoverflow.com/comment/35091499
type: Comment
score: 0
has text: if worked perfectly, accept it with +1, and `documentList[${documentLoop.index}].ynChkBox` is the proper you cannot write `document[${documentLoop.index}].ynChkBox` it means document property is not available in `Policydocumentsetform` but in `private ArrayList<Document> documentList`.
type: AnswerComment
comment on: http://stackoverflow.com/a/22970693

http://stackoverflow.com/comment/34848158
type: Comment
comment on: http://stackoverflow.com/a/22844485
has text: yes, thats the general idea.In your code, you're making two sets of 50 elements each,linked one-one.The other way, you'd be making 50 sets of a pair of state & city.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34902113
type: Comment
type: QuestionComment
has text: The code is supposed to work like this. A menu pops up and gives the option to run the race, reset the race, or quit. When run race is selected, the circles run across the screen until it reaches the finish line. The other circles should stop in their tracks and terminate. I have it working to where the circles race eachother but there is multiple winners. I shall post the other two classes in case anyone wants to run it and see how it works.
comment on: http://stackoverflow.com/q/22874126
score: 0

http://stackoverflow.com/comment/34968873
comment on: http://stackoverflow.com/q/22911705
has text: #LadyBernkastel i made it using mysql and jdbc....but it will not work in other machines
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22882469
has comment: http://stackoverflow.com/comment/34923901
downvote count: 0
has comment: http://stackoverflow.com/comment/34924011
upvote count: 2
type: Answer
has body: As per documentation on Connection.createStatement(int, int) Method signature is: Statement createStatement( int resultSetType, int resultSetConcurrency ) throws SQLException Parameters: resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE But you have put concurrency type as first parameter. Change: stmt = con.createStatement( CONCUR_UPDATABLE, TYPE_SCROLL_SENSITIVE ); To: stmt = con.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE );
score: 2
answers question: http://stackoverflow.com/q/22882307

http://stackoverflow.com/comment/35020398
has text: Can you put a `WindowsListener` on closing `jframe2.requestFocusInWindow()` ?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22939426

criteria
tags question: http://stackoverflow.com/q/22957898
tags question: http://stackoverflow.com/q/22913725
tag name: criteria
type: Tag
tags question: http://stackoverflow.com/q/22840829
tags question: http://stackoverflow.com/q/22945544

http://stackoverflow.com/q/22962080
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22962647
has body: I have a problem with tiled-maps. I must to render every tile in one of the layers tile-by-tile (from tile to tile). How can I realize it? I tried it, but it renders nothing. private void drawObject(boolean down) { final String objects = "objects"; for (MapObject obj : world.getMap().getLayers().get(objects).getObjects()) { if (!down) { if ((Integer) obj.getProperties().get("y") &gt; world.getPlayer().getBody().getPosition().y) { world.getTiledMapRenderer().renderObject(obj); } } } }
tagged with: java
has title: LibGDX: rendering tiled-maps from tile to tile
type: Question
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/22962647
score: 0
answer count: 1

regex
tags question: http://stackoverflow.com/q/22850354
tags question: http://stackoverflow.com/q/22876869
tags question: http://stackoverflow.com/q/22857015
tags question: http://stackoverflow.com/q/22889942
tags question: http://stackoverflow.com/q/22887763
tags question: http://stackoverflow.com/q/22823634
tags question: http://stackoverflow.com/q/22873584
tags question: http://stackoverflow.com/q/22852089
tags question: http://stackoverflow.com/q/22838011
tags question: http://stackoverflow.com/q/22931991
tags question: http://stackoverflow.com/q/22936009
tag name: regex
tags question: http://stackoverflow.com/q/22835472
tags question: http://stackoverflow.com/q/22835509
tags question: http://stackoverflow.com/q/22889457
tags question: http://stackoverflow.com/q/22964598
tags question: http://stackoverflow.com/q/22926674
tags question: http://stackoverflow.com/q/22888126
tags question: http://stackoverflow.com/q/22947561
tags question: http://stackoverflow.com/q/22897102
tags question: http://stackoverflow.com/q/22948583
tags question: http://stackoverflow.com/q/22860409
tags question: http://stackoverflow.com/q/22836861
tags question: http://stackoverflow.com/q/22873983
tags question: http://stackoverflow.com/q/22901462
tags question: http://stackoverflow.com/q/22831176
tags question: http://stackoverflow.com/q/22886187
tags question: http://stackoverflow.com/q/22826674
tags question: http://stackoverflow.com/q/22855155
tags question: http://stackoverflow.com/q/22888563
tags question: http://stackoverflow.com/q/22857817
tags question: http://stackoverflow.com/q/22834650
tags question: http://stackoverflow.com/q/22813743
tags question: http://stackoverflow.com/q/22928688
tags question: http://stackoverflow.com/q/22890653
tags question: http://stackoverflow.com/q/22838937
tags question: http://stackoverflow.com/q/22851220
tags question: http://stackoverflow.com/q/22961593
tags question: http://stackoverflow.com/q/22879625
tags question: http://stackoverflow.com/q/22873829
tags question: http://stackoverflow.com/q/22828868
tags question: http://stackoverflow.com/q/22882480
tags question: http://stackoverflow.com/q/22937065
tags question: http://stackoverflow.com/q/22832916
tags question: http://stackoverflow.com/q/22890046
tags question: http://stackoverflow.com/q/22855837
tags question: http://stackoverflow.com/q/22825838
tags question: http://stackoverflow.com/q/22951100
tags question: http://stackoverflow.com/q/22855131
tags question: http://stackoverflow.com/q/22950582
tags question: http://stackoverflow.com/q/22967107
tags question: http://stackoverflow.com/q/22849827
tags question: http://stackoverflow.com/q/22832935
tags question: http://stackoverflow.com/q/22846921
tags question: http://stackoverflow.com/q/22951558
tags question: http://stackoverflow.com/q/22877632
tags question: http://stackoverflow.com/q/22813510
tags question: http://stackoverflow.com/q/22925757
tags question: http://stackoverflow.com/q/22879781
tags question: http://stackoverflow.com/q/22811690
tags question: http://stackoverflow.com/q/22860792
tags question: http://stackoverflow.com/q/22898822
tags question: http://stackoverflow.com/q/22894301
tags question: http://stackoverflow.com/q/22924712
tags question: http://stackoverflow.com/q/22825305
tags question: http://stackoverflow.com/q/22831599
tags question: http://stackoverflow.com/q/22811932
tags question: http://stackoverflow.com/q/22861020
tags question: http://stackoverflow.com/q/22855749
tags question: http://stackoverflow.com/q/22897612
type: Tag
tags question: http://stackoverflow.com/q/22811601
tags question: http://stackoverflow.com/q/22926107
tags question: http://stackoverflow.com/q/22931148

http://stackoverflow.com/a/22919123
score: 1
has body: ArrayList.retainAll has a "smart" implementation that does the right thing to be linear time. You can just use list.retainAll(Arrays.asList("foo", "bar")) and you'll get the fast implementation in that one line.
downvote count: 0
answers question: http://stackoverflow.com/q/22918360
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34951388
score: 2
comment on: http://stackoverflow.com/q/22901743
type: Comment
type: QuestionComment
has text: And... the logcat... the error... ?

http://stackoverflow.com/comment/55923239
type: AnswerComment
comment on: http://stackoverflow.com/a/22910989
type: Comment
has text: @KelvinTrinh The OP didn't say anything about calling `ServerSocket.setSoTimeout().` `Socket.setSoTImeout()` on the other hand can be caled at either the server or the client, with the same effect in both cases: it sets a read timeout; and that is what the OP states he has done. The client doesn't need to complete sending the entire file within ten seconds: the read timeout restarts every time you call `read()`. There's nothing in your link that contradicts anything I've said here.
score: 0

http://stackoverflow.com/q/22893888
has comment: http://stackoverflow.com/comment/34975209
has comment: http://stackoverflow.com/comment/34975596
has body: I want know to how can I identifies if there is a date changes i.e. 23:59 to 00:00. I am using a servlet. I can do it using a static String type variable and assign it to "dd" part of below returned date stamp and comparing it on every request with the current "dd" date stamp. If both "dd" part do not match then it will be sign of date change. Actually there is one static int type variable that I want to reset to zero which increment till the day change. private static String getDate() { SimpleDateFormat customFormat = new SimpleDateFormat("HH:mm:ss dd-MM-yyyy"); return customFormat.format(new Date(System.currentTimeMillis())); } But how can I do it without comparing it, is there any better way to do it? Thanks.
score: 0
tagged with: datetime
type: UnansweredQuestion
answer count: 0
has title: How to identify day change in java
tagged with: java
has comment: http://stackoverflow.com/comment/34975888
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/q/22837423
has answer: http://stackoverflow.com/a/68715007
has body: In C, we are able to take input as character with the keyword char from keyboard as scanf("%c", &amp;ch); But In Java how to do this? I have tried this: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter a character: "); char c = scanner.next().charAt(0); System.out.println("You have entered: "+c); } }
tagged with: input
has answer: http://stackoverflow.com/a/42132653
has answer: http://stackoverflow.com/a/52136243
has answer: http://stackoverflow.com/a/22837724
type: AnsweredQuestion
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/22837826
has title: How to take character input in java
has comment: http://stackoverflow.com/comment/34834368
has answer: http://stackoverflow.com/a/54912004
has answer: http://stackoverflow.com/a/22837476
type: Question
has answer: http://stackoverflow.com/a/41662735
score: -1
possible better answer: http://stackoverflow.com/a/22837507
tagged with: char
has answer: http://stackoverflow.com/a/22837783
has answer: http://stackoverflow.com/a/22837507
has comment: http://stackoverflow.com/comment/34877967
answer count: 10
accepted answer: http://stackoverflow.com/a/22837476
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/22841836
accepted answer of: http://stackoverflow.com/q/22841656
answers question: http://stackoverflow.com/q/22841656
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: You would have to pass a reference to the game class into the constructor of commandReader. Game game; public commandReader(Game game) { this.game = game; } And then you can call game.player.moveUp();
type: Answer

http://stackoverflow.com/comment/34804637
type: Comment
has text: Can you clarify what you are askin?
type: QuestionComment
comment on: http://stackoverflow.com/q/22820036
score: 0

http://stackoverflow.com/comment/39484776
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/25327033
has text: mWebView.setInitialScale(150) that means 150%

http://stackoverflow.com/q/22869909
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34893751
has answer: http://stackoverflow.com/a/22871682
answer count: 3
has body: I am a beginner in spring. Here is my beans.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt; &lt;bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;property name="location" value="DB.properties" /&gt; &lt;/bean&gt; &lt;bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" &gt; &lt;property name="driverClassName" value="${driver}"/&gt; &lt;property name="url" value="${url}"/&gt; &lt;property name="username" value="${uname}"/&gt; &lt;property name="password" value="${pwd}"/&gt; &lt;/bean&gt; &lt;/beans&gt; And DB.properties is given below: #database connection propertiess driver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/Payment uname=root pwd=renu@193 I am getting this error given below: Apr 04, 2014 11:07:25 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [beans.xml] org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '${driver}' at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at com.student.spring.test.RunClass.main(RunClass.java:22) Caused by: java.lang.ClassNotFoundException: ${driver} at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.Cla…
has title: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '${driver}'
upvote count: 1
has comment: http://stackoverflow.com/comment/34893655
favorite count: 0
has answer: http://stackoverflow.com/a/22870360
has answer: http://stackoverflow.com/a/22870058
possible better answer: http://stackoverflow.com/a/22871682
accepted answer: http://stackoverflow.com/a/22870058
has comment: http://stackoverflow.com/comment/34893888
tagged with: spring
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/22960549
accepted answer of: http://stackoverflow.com/q/22959812
has comment: http://stackoverflow.com/comment/35090644
upvote count: 1
has body: You can use Apache commons exec library for this. Example : package testShellScript; import java.io.IOException; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.ExecuteException; public class TestScript { int iExitValue; String sCommandString; public void runScript(String command){ sCommandString = command; CommandLine oCmdLine = CommandLine.parse(sCommandString); DefaultExecutor oDefaultExecutor = new DefaultExecutor(); oDefaultExecutor.setExitValue(0); try { iExitValue = oDefaultExecutor.execute(oCmdLine); } catch (ExecuteException e) { // TODO Auto-generated catch block System.err.println("Execution failed."); e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block System.err.println("permission denied."); e.printStackTrace(); } } public static void main(String args[]){ TestScript testScript = new TestScript(); testScript.runScript("sh /root/Desktop/testScript.sh"); } }
type: AcceptedAnswer
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35088571
answers question: http://stackoverflow.com/q/22959812
score: 1

http://stackoverflow.com/comment/34902172
comment on: http://stackoverflow.com/q/22873501
score: 0
has text: @ljpv14 See [this](http://stackoverflow.com/questions/5242429/what-is-facade-design-pattern) question.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35061893
comment on: http://stackoverflow.com/a/22893041
score: 0
type: AnswerComment
has text: @weston you are probably right. Just felt wrong to use int and BigInteger normally does well enough ;-) The recursive calls could also be paralized (copy selection for each Thread!)
type: Comment

http://stackoverflow.com/q/22861546
accepted answer: http://stackoverflow.com/a/28847832
has comment: http://stackoverflow.com/comment/34880362
tagged with: spring
has comment: http://stackoverflow.com/comment/34877951
tagged with: jakarta-ee
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34877946
tagged with: java
has comment: http://stackoverflow.com/comment/34879062
linked to: http://stackoverflow.com/q/466521
type: Question
has comment: http://stackoverflow.com/comment/34878620
has answer: http://stackoverflow.com/a/28847832
has title: Structured HTML logging in Java
tagged with: slf4j
has comment: http://stackoverflow.com/comment/34877888
score: 0
has comment: http://stackoverflow.com/comment/34879319
has comment: http://stackoverflow.com/comment/35556346
answer count: 1
has comment: http://stackoverflow.com/comment/34878901
tagged with: log4j
has body: Text based logging has the disadvantage that they are hard to read and understand. Is there a library that would allow me to generate structured and visually aesthetic log file? For example, on issue following log statement: logger.log('Request received from gateway', request) The output could be something like this: Request received from gateway. Details So that the log file log.html shows: Thursday 14th March 04:8:13 - Request received from gateway. Details Here details could be an anchored hyperlink into another html file with the String dump of the request object. The advantage of this approach would be that the verbosity would be reduced. Instead of all the details being dumped onto the screen at once, we'd only see the overview. Details would appear in a popup window if and when we need to see it. How could I create more readable, structured logs in Java?
has comment: http://stackoverflow.com/comment/34878113
has comment: http://stackoverflow.com/comment/34878117

http://stackoverflow.com/q/22914270
has answer: http://stackoverflow.com/a/22914365
score: 0
tagged with: java
has title: Java multithreading, how to send messages to main class and handle them?
accepted answer: http://stackoverflow.com/a/22914365
tagged with: message-queue
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34974413
has body: I am trying to setup a workbench for testing parts of an Android app... (reading log file rather than handling sensors data directly) In the Android app, I am using Handler to send back messages to the main activity to perform user notification What's the best pattern in pure java app to mimic it, sending messages to the main class and handling them ? I guess I have to set up a message queue, and synchronize the send/receive methods on the queue, but in the main app, should I write a runnable thread to check for new messages ? Is there any existing implementation
type: Question
tagged with: multithreading
answer count: 1

http://stackoverflow.com/q/22863806
has title: Getting data from a website on to Google Glass
linked to: http://stackoverflow.com/q/309424
linked to: http://stackoverflow.com/q/6343166
score: 0
tagged with: google-glass
has answer: http://stackoverflow.com/a/22866617
has answer: http://stackoverflow.com/a/22866082
has answer: http://stackoverflow.com/a/22865915
tagged with: parsing
type: UnansweredQuestion
has body: I'm still learning how to extract data from a website and I really hope I'll get some nice answers adequate for a starter. Anyways, my goal here is to extract the data in the background of my app(without openning and showing it in my app). The idea is that data then would be stored for later use. The API I'm using has 2 GetMethods: GetProductJSON(which has JSON Response) and GetProduct(with a Comma Seperated Values(CSV) Response) Here is an example of the JSON Response website: {"0":{"productname":"Neutrogena Lips Stick 4.8g","imageurl":"http://ecx.images- amazon.com/images/I/31E1ct854gL._SL160_.jpg","producturl":"","price":"5.65","currency":"USD","saleprice":"","storename":"N/A"}} The Comma Seperated Values Response looks like this: "productname","imageurl","producturl","price","currency","saleprice","storename" "Neutrogena Lips Stick 4.8g","http://ecx.images-amazon.com/images/I/31E1ct854gL._SL160_.jpg","","5.65","USD","","N/A" Here is how I call the website: url = url.replace("{CODE}", codeValue); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); cardPresenter.setPendingIntent(createPendingIntent(getContext(), intent)); Any suggestions on how to make this a background task and how to actually get the data in java so that I can use them on a Livecard.
answer count: 4
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22868858
type: Question
has comment: http://stackoverflow.com/comment/34885688

http://stackoverflow.com/comment/35041821
comment on: http://stackoverflow.com/q/22951825
type: Comment
has text: "Write a method" , who is going to write?
score: 0
type: QuestionComment

http://stackoverflow.com/q/22929908
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/22930186
has comment: http://stackoverflow.com/comment/35003208
tagged with: treeview
score: 6
tagged with: checkbox
tagged with: expandablelistview
has answer: http://stackoverflow.com/a/22930186
has title: Create expandable listview with group and child checkbox
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/30211236
tagged with: java
has answer: http://stackoverflow.com/a/30211236
type: Question
answer count: 2
upvote count: 6
has body: I want to create an expandable listview with checkboxes present in the groups as well as the children. What I want is, the user may check the group in order to select all the children in the group, or the user may select a particular item under the expandable listview. This concept is running in our asp.net website as a tree view. I am attaching some screens of the running website: Treeview with groups unexpanded Treeview with full group selected Treeview with particular children selected under group The main class: public class MainActivity extends Activity { ExpandableListAdapter listAdapter; ExpandableListView expListView; List&lt;String&gt; listDataHeader; HashMap&lt;String, List&lt;String&gt;&gt; listDataChild; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // get the listview expListView = (ExpandableListView) findViewById(R.id.lvExp); // preparing list data prepareListData(); listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild); // setting list adapter expListView.setAdapter(listAdapter); // Listview Group click listener expListView.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { // Toast.makeText(getApplicationContext(), // "Group Clicked " + listDataHeader.get(groupPosition), // Toast.LENGTH_SHORT).show(); return false; } }); // Listview Group expanded listener expListView.setOnGroupExpandListener(new OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) { Toast.makeText(getApplicationContext(), listDataHeader.get(groupPosition) + " Expanded", Toast.LENGTH_SHORT).show(); } }); // Listview Group collasped listener expListView.setOnGroupCollapseListener(new OnGroupCollapseListener() { @Override public void onGroupCollapse(int groupPosition) { Toast.makeText(getApplicationContext(), listDataHeader.get(groupPositio…

http://stackoverflow.com/q/22950318
favorite count: 0
has answer: http://stackoverflow.com/a/22950567
tagged with: multithreading
upvote count: 1
accepted answer: http://stackoverflow.com/a/22970789
has comment: http://stackoverflow.com/comment/35040711
type: AnsweredQuestion
tagged with: java
has body: Alright, I've searched now for a whole day, but no result. Maybe someone can help it. I'm trying to generate a key "press and hold" situation in my java program, programmatically. Let me explain the situation: I listen constantly for an event. Consider 2 events 'A' and 'B'. If event A occurs, I want to press and hold down the keyboard key (X), and if event 'B' occurs, I want to release the key (X). Now the main thing is, this all has to be a side process, so even if A occurs, I can listen for event B. I've tried making a separate thread, making an infinite loop inside it, pressing the key using 'Robot' in java, but it turned out to be the most inefficient way of achieving this, as it consumes more than 60% of CPU. I've tried achieving this with a state changed, but don't seem to find a way to restrict the key press, to change only when I want it to. I would appreciate a solution without any infinite loop, if possible, as I am already using 1 to listen for event occurrences. (Suggestions are welcome) Here is my code for the thread: public class KeyPress implements Runnable { public String command; public void run() { try { Robot r = new Robot(); while (true) { //System.out.println(command); if (command.equals("up")) { r.keyPress(KeyEvent.VK_UP); r.delay(20); r.keyRelease(KeyEvent.VK_UP); } else if (command.equals("finish")) { break; } } } catch (Exception e) { System.out.println(e); } } } The instance of thread is created as usual, in my main class. Also, if someone can explain this - when I remove or comment out the System.out.println(command); statement (as you see in the code), This thread stops working. If I add this, it works. Although this problem is secondary, as it still is a non-feasible solution.
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35039235
has comment: http://stackoverflow.com/comment/35039483
has comment: http://stackoverflow.com/comment/35039720
has comment: http://stackoverflow.com/comment/35039243
has comment: http://stackoverflow.com/comment/35039526
has answer: http://stackoverflow.com/a/22970789
has comment: http://stackoverflow.com/comment/35040897
has title: Press and hold key programmatically java
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/22950567
has comment: http://stackoverflow.com/comment/35040167

http://stackoverflow.com/comment/34966035
score: 0
type: Comment
has text: @Anand: yes, though you may have to pass each part of the parameters separately (parameter type is String[])
type: AnswerComment
comment on: http://stackoverflow.com/a/22906243

http://stackoverflow.com/comment/34840143
type: AnswerComment
score: 0
type: Comment
has text: Works great! Last small question: How would I change your code if I had to delete columns that contain ONLY digits between 0 and 2? (Just realized now, I actually had to delete columns that contained only numbers in that range)
comment on: http://stackoverflow.com/a/22837392

http://stackoverflow.com/q/22895162
accepted answer: http://stackoverflow.com/a/22895395
has comment: http://stackoverflow.com/comment/34939120
has comment: http://stackoverflow.com/comment/34939565
has comment: http://stackoverflow.com/comment/34939477
has comment: http://stackoverflow.com/comment/34939327
has title: Syntax error, telling me it wants ; and several other things
favorite count: 0
has comment: http://stackoverflow.com/comment/34939135
has answer: http://stackoverflow.com/a/22895444
has body: Just trying to run through some code for an assignment I'm doing. It is probably simple but for the life of me I can't figure out why I get the above error at the first line (public WaterLog.......). Later I want to pass it this line: [ log = new WaterLog(8, damCapacity); ] Any help would be appreciated, I am new to this sorry. public class WaterLog(Integer windowSize, Integer maxEntry) { private Integer size = windowSize; private Integer max = maxEntry; private ArrayList theLog(int windowSize); private int counter = 0; public void addEntry(Integer newEntry) throws SimulationException { theLog.add(0, newEntry); counter++; } public Integer getEntry(Integer index) throws SimulationException { If (thelog.isEmpty() || thelog.size() &lt; index) { return null; } return thelog.get(index); } public Integer variation() throws SimulationException { int old, recent = 0; recent = thelog.get(0); old = thelog.get(thelog.size-1); return recent-old; } public Integer numEntries() { return counter; } }
downvote count: 2
possible better answer: http://stackoverflow.com/a/22895444
has answer: http://stackoverflow.com/a/22895395
has comment: http://stackoverflow.com/comment/34939661
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/34939410

http://stackoverflow.com/comment/35037329
has text: Not so much ugly. More non-functional.
comment on: http://stackoverflow.com/a/22949111
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/22874896
answers question: http://stackoverflow.com/q/22874849
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22874849
type: Answer
upvote count: 1
score: 1
has body: You can use URI templates. This library does exactly that. Example quoted from the README: # Substitution of a map of query parameters http://foo.bar.com/some/request{?queryparams*} # "queryparams" associative array: hello -&gt; world!, streetInGerman -&gt; Straße # result of expansion: http://foo.bar.com/some/request?hello=world%21&amp;streetInGerman=Stra%C3%9Fe The related RFCs are RFC 3986 (URI) and RFC 6570 (URI templates). For decomposition, it is a little harder; you can use the URI class to parse your URI, and then grab the query string. But you will still have to split the result by yourself.

http://stackoverflow.com/a/22940845
type: Answer
downvote count: 0
score: 1
has body: One issue with your code is that you should not inject EntityManagers into servlets. Servlets are usually singletons, so all servlets would use the same EntityManager. You should inject an EntityManagerFactory instead and get your EntityManagers from it. You also have to take care of transactions. Not sure if this has caused your issues, but something that should be fixed.
upvote count: 1
answers question: http://stackoverflow.com/q/22940608

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/22940909

http://stackoverflow.com/comment/34827014
type: QuestionComment
comment on: http://stackoverflow.com/q/22832042
has text: @user3492773 you dont need CustomTextWatcher you can implement TextWatcher in your Activity for example
score: 0
type: Comment

variables
tag name: variables
tags question: http://stackoverflow.com/q/22854282
tags question: http://stackoverflow.com/q/22870367
type: Tag
tags question: http://stackoverflow.com/q/22889619
tags question: http://stackoverflow.com/q/22876234
tags question: http://stackoverflow.com/q/22812104
tags question: http://stackoverflow.com/q/22850690
tags question: http://stackoverflow.com/q/22892556
tags question: http://stackoverflow.com/q/22850185
tags question: http://stackoverflow.com/q/22883748

http://stackoverflow.com/comment/34957115
type: Comment
has text: Sorry, I forgot to add that it crashes. What should it do when interrupted?
score: 0
comment on: http://stackoverflow.com/q/22904987
type: QuestionComment

http://stackoverflow.com/comment/34971774
has text: Yes, I have added a seperator @|@, Which is like **Value1**@|@**Value2**@|@**Value3**. My problem is that when user adds comma in **Value1** like **Val,ue1**, then the **Value1** is also splitting into two elements like **Val** and **ue1**
comment on: http://stackoverflow.com/a/22913150
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22904025
linked to: http://stackoverflow.com/q/4457830
tagged with: java
linked to: http://stackoverflow.com/q/4115526
has body: I would like to know which programming language is better for natural language processing. Java or Python? I have found lots of questions and answers regarding about it. But I am still lost in choosing which one to use. And I want to know which NLP library to use for Java since there are lots of libraries (LingPipe, GATE, OpenNLP, StandfordNLP). For Python, most programmers recommend NLTK. But if I am to do some text processing or information extraction from unstructured data (just free formed plain English text) to get some useful information, what is the best option? Java or Python? Suitable library? Updated What I want to do is to extract useful product information from unstructured data (E.g. users make different forms of advertisement about mobiles or laptops with not very standard English language)
upvote count: 123
linked to: http://stackoverflow.com/q/7455188
score: 119
answer count: 2
has comment: http://stackoverflow.com/comment/77984168
linked to: http://stackoverflow.com/q/11116390
linked to: http://stackoverflow.com/q/18558665
has answer: http://stackoverflow.com/a/22905260
favorite count: 0
linked to: http://stackoverflow.com/q/5833030
has comment: http://stackoverflow.com/comment/34956031
tagged with: python
linked to: http://stackoverflow.com/q/870460
tagged with: nlp
downvote count: 4
linked to: http://stackoverflow.com/q/2233435
has comment: http://stackoverflow.com/comment/64874048
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22904195
type: Question
linked to: http://stackoverflow.com/q/212219
has title: Java or Python for Natural Language Processing

http://stackoverflow.com/comment/35020910
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22934464
type: AnswerComment
has text: Please update your question to include the relevant beans.xml in the WAR, and each JAR file. Also, is your REST API class annotated @Stateless or @RequestScoped?

http://stackoverflow.com/a/22858793
has comment: http://stackoverflow.com/comment/34873636
has body: I am not a Java prof. but I would suggest you to loop throug your list and make string with comma seperated values. Like in PHP we do this with implode function. And hence your final string would be something like this 1,2,3,4,5 and then use it in your sql query I am not sure about my code but try this as I am not a Java programmar ( make the necessary changes if any syntax error) String intlist = ""; for (String temp : list) { intlist += ","+temp; } String Str = new String(intlist); String sqlstring = Str.substring(1);
answers question: http://stackoverflow.com/q/22858680
score: 0
type: Answer

http://stackoverflow.com/a/22861155
has comment: http://stackoverflow.com/comment/34882515
type: Answer
accepted answer of: http://stackoverflow.com/q/22860806
answers question: http://stackoverflow.com/q/22860806
has body: You need to create a listener for your data progress and have it update the progress bar. Right now it looks like this line: syncData.syncData(context, authToken); blocks and no updates are provided to your progress indicator until it is done. So, you need something like: MyListener listener = new MyListener(context); SyncData syncData = new syncData(listener); And in your listener have callback methods like myListener.downloadStarted() , myListener.updateProgressBar(int progress) and myListener.downloadCompleted() that your syncData class calls as the download progresses. For example: public abstract class SDScanAdapter implements SDScanListener { public void startScan() { } public void updateScanProgress(int scanItemsTotal, int scanItemsCompleted) { } public void scanComplete() { } } Then create a listener class: public class ScanListener extends SDScanAdapter { @Override public void scanComplete(String contactName, String action) { runOnUiThread(scanComplete); } @Override public void startScan() { runOnUiThread(startScan); } @Override public void updateScanProgress(int scanItemsTotal, int scanItemsCompleted) { if (scanCountTotal != scanItemsTotal) { scanCountTotal = scanItemsTotal; progressBar.setMax(scanCountTotal); } if (scanCountUpdate != scanItemsCompleted) { scanCountUpdate = scanItemsCompleted; runOnUiThread(updateScanProgress); } } } And then for this example you need Runnables (startScan, scanComplete and updateScanProgress) that perform UI tasks, like updating the progress bar. In your case, you may also want to load some of the results, etc. Then in your AsyncTask you do: ScanListener listener = new ScanListener(); SyncData syncData = new syncData(listener); Assuming the SDScanListener class and AsyncTask are all in your Activity. Also, your SyncData calss will need to have a SDScanListener variable that is set when it instantiates. Then, while it does its job, calls are made to the listener methods like: scanListener.startScan(); And while it progresse…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34877851
score: 0
has comment: http://stackoverflow.com/comment/34882873

http://stackoverflow.com/comment/34993081
has text: Perfect, but I must ask what is the difference of putting the ++ before the variable instead of after?
comment on: http://stackoverflow.com/a/22924621
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35038524
has text: Use getSingleResult method if you are expecting a single row.
type: QuestionComment
comment on: http://stackoverflow.com/q/22949086
score: 0
type: Comment

http://stackoverflow.com/q/22851645
has answer: http://stackoverflow.com/a/22854784
has title: LibGDX resolution independence
answer count: 2
downvote count: 0
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/27797924
type: UnansweredQuestion
tagged with: android
score: 2
tagged with: java
type: Question
has body: I've searched all around google and this website for infos about this problem, but cannot solve it.. I'm a newbie in game development and LibGDX, and cannot find a solution well explained on how to port my game to all the various screen sizes.. Would you kindly help me? Thanx
tagged with: libgdx

http://stackoverflow.com/q/22842340
has comment: http://stackoverflow.com/comment/34843494
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34843804
has body: I'm trying to code a game for school, for which I have to use a MouseListener. I am using the MouseListener for the main menu. I want the option "Spelregels" (which translates into rules) to create and show a new JFrame containing the rules for the game. import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JFrame; public class MouseInput implements MouseListener { Main mainMenu = new Main(); @Override public void mouseClicked(MouseEvent e) { int mx = e.getX(); int my = e.getY(); // public Rectangle startNieuwSpelButton = new Rectangle(100, 275, 250, 50); // public Rectangle hervatSpelButton = new Rectangle(100, 340, 250, 50); // public Rectangle spelregelsButton = new Rectangle(100, 405, 250, 50); // public Rectangle highscoresButton = new Rectangle(100, 470, 250, 50); // Start Nieuw Spel Button if(mx &gt;= 100 &amp;&amp; mx &lt;= 350) { if (my &gt;= 275 &amp;&amp; my &lt;= 325) { System.out.println("Je hebt op de startNieuwSpelButton geklikt."); } } // Hervat Spel Button if(mx &gt;= 100 &amp;&amp; mx &lt;= 350) { if (my &gt;= 340 &amp;&amp; my &lt;= 390) { System.out.println("Je hebt op de hervatSpelButton geklikt."); } } // Spelregels Button if(mx &gt;= 100 &amp;&amp; mx &lt;= 350) { if (my &gt;= 405 &amp;&amp; my &lt;= 455) { JFrame spelregelFrame = new JFrame("Lunar Lockout Spelregels"); spelregelFrame.setSize(450, 650); spelregelFrame.setLocation(800, 100); spelregelFrame.setVisible(true); } } // Highscore Button if(mx &gt;= 100 &amp;&amp; mx &lt;= 350) { if (my &gt;= 470 &amp;&amp; my &lt;= 520) { System.out.println("Je hebt op de highscoreButton geklikt."); } } } @Override public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } } That's the …
type: Question
has comment: http://stackoverflow.com/comment/34843435
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/34843920
has comment: http://stackoverflow.com/comment/34843947
has answer: http://stackoverflow.com/a/22842642
has comment: http://stackoverflow.com/comment/34843864
has title: Java mouseClicked shows JFrame between 5 ~ 10 times instead of 1
tagged with: jframe
tagged with: mouselistener
accepted answer: http://stackoverflow.com/a/22842642

http://stackoverflow.com/q/22917785
has answer: http://stackoverflow.com/a/22917844
tagged with: user-interface
has comment: http://stackoverflow.com/comment/34980255
has answer: http://stackoverflow.com/a/22918065
score: 0
has comment: http://stackoverflow.com/comment/34996272
answer count: 3
has title: add a function to JButton
possible better answer: http://stackoverflow.com/a/22918065
favorite count: 0
accepted answer: http://stackoverflow.com/a/22917844
tagged with: jframe
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/22918195
downvote count: 1
tagged with: jbutton
type: AnsweredQuestion
tagged with: java
has body: i have 2 JButtons on my JFrame and i would like to add a function to it when i click on them. I Would like the JButton calculator allow me to open another JFrame if thats possible and i would like the JButton Exit allow me to exit the current Frame. any help would be greatly appreciated import java.awt.*; import java.awt.event.*; import javax.swing.ImageIcon.*; import java.awt.Font.*; import javax.swing.*; //import java swing to use the Jframe etc public class MathQuiz extends JFrame implements ActionListener { JCheckBox answer1 = new JCheckBox(); //checkbozx for answer 1 JCheckBox answer2 = new JCheckBox(); //checkbozx for answer 2 JCheckBox answer3 = new JCheckBox(); //checkbozx for answer 3 JTextArea textArea = new JTextArea();//text area for question JButton exit = new JButton(); // button to exit quiz JButton calculator = new JButton(); // button to open calculator JLabel image = new JLabel(); //adds background image // Some names which will be associated with numbers. int answer; int questionnumber; /** * This bit of code starts the process of showing the window. **/ public MathQuiz() { // Drop down to the code labeled 'initComponents' below. try { initComponents(); } catch (Exception e) {} } /** * This bit of code is the first bit that's run. **/ static public void main(String[] args) { MathQuiz frame = new MathQuiz(); // // The following code puts the Window on your screen. frame.setVisible(true); //allows the jframe to be visible frame.showQuestion(1);//shows the first question frame.setSize(378, 383);//sets the size of the frame } /** * This bit of code sets up how the Window looks. **/ public void initComponents() throws Exception { //edits the checkboxes for the answers answer1.setSize(new Dimension(80, 20)); //set size of answer 1 checkbox answer1.setVisible(true); //sets visible to answer 1 checkbox answer1.setLocation(new Point(20, 180)); //set location answer 1 checkbox Font font1 = new Font("Verdana", Font.BOLD, 14); answer1.setFont(font1); answer1.…
type: Question
linked to: http://stackoverflow.com/q/9554636

http://stackoverflow.com/q/22944975
has comment: http://stackoverflow.com/comment/35030677
tagged with: ora-00600
has body: I got this while trying to execute File f = new File("file location"); FileInputStream fis = new FileInputStream(f); PreparedStatement ps = db.prepareStatement("INSERT INTO table (title,file,id) VALUES('title',?,7)"); ps.setBinaryStream(1, fis, (int)f.length()); ps.execute(); ps.close(); title - VARCHAR2 file - BLOB id - FK to another table Operations with another tables are working, everything is fine but this one. I tried to change statement, drop and recreate table. Without result
has comment: http://stackoverflow.com/comment/35030944
type: Question
upvote count: 1
tagged with: oracle-database
tagged with: sql
favorite count: 0
answer count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: java.sql.SQLException: ORA-00600: internal error code, arguments: [12811], [93233]

http://stackoverflow.com/comment/34964237
type: QuestionComment
has text: @JonK It's just a test sample. But you are right.
score: 0
comment on: http://stackoverflow.com/q/22909049
type: Comment

http://stackoverflow.com/comment/34857797
score: 0
type: AnswerComment
has text: Think about another what I said about the string always being an array of char's...maybe you can access its elements from the string variable directly without pushing it into a char array
type: Comment
comment on: http://stackoverflow.com/a/22849935

http://stackoverflow.com/a/25740453
answers question: http://stackoverflow.com/q/22849868
score: 0
has body: I wrote this blog to demonstrate how to make websphere 8.5 use mojarra not myfaces. http://mojarraonwebsphere.blogspot.com/2014/09/upgrading-mojarra-in-ibm-websphere-85.html
type: Answer

http://stackoverflow.com/a/22904103
score: 1
has body: You have a shadowing problem. You declare... private JButton findnext; private JButton replace; private JButton delete; private JButton upper; But in your constructor you do... JButton findnext = new JButton("FindNext"); //... JButton replace = new JButton("Replace"); //... JButton delete = new JButton("Delete"); //... JButton upper = new JButton("Upper"); Which is re-declaring those variables. This means that when you try and do... if (source == findnext) { It's always false You're also adding the ActionListener (this) to the findnext button four times...I think you mean to be adding it to each of the other buttons Beware, there is already a class called Window in AWT, which could cause confusion for people. It's also discouraged to extend directly from a top level container like JFrame and instead should start with a JPanel and the add it to an instance of JFrame (or what ever container you like)
answers question: http://stackoverflow.com/q/22904006
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/22886257
downvote count: 0
answers question: http://stackoverflow.com/q/22886103
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22886103
type: AcceptedAnswer
has body: To shorten the discussion in the comments, and as a simple illustration, you may try this modified version of your Calclulator. It should print the output in a nicely mixed fashion. class Calculator implements Runnable { private int number; public Calculator(int number) { this.number = number; } @Override public void run() { for (int i = 1; i &lt;= 10; i++) { System.out.printf("%s: %d * %d = %d\n", Thread.currentThread().getName(), number, i, i * number); someRandomDelay(); } } private static void someRandomDelay() { int ms = (int) (100 + Math.random() * 200); try { Thread.sleep(ms); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
type: Answer
score: 2

http://stackoverflow.com/comment/35031581
type: QuestionComment
comment on: http://stackoverflow.com/q/22946138
has text: did you try to read stderr?
score: 1
type: Comment

http://stackoverflow.com/comment/35039129
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22950403
has text: @brano: thanks but what is the difference between the two ?

http://stackoverflow.com/comment/34851963
type: QuestionComment
comment on: http://stackoverflow.com/q/22846448
has text: Custom painting should be done in the `paintComponent()` method. This method will only ever be invoked on realized components.
score: 2
type: Comment

http://stackoverflow.com/comment/41408558
has text: and Token is not importing too
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22897657

http://stackoverflow.com/q/22895518
possible better answer: http://stackoverflow.com/a/22895883
has comment: http://stackoverflow.com/comment/34940027
accepted answer: http://stackoverflow.com/a/22895786
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/34941165
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/34940248
score: 0
has title: Having an issue with method function
answer count: 2
has answer: http://stackoverflow.com/a/22895786
has answer: http://stackoverflow.com/a/22895883
type: AnsweredQuestion
has body: So the basic overall function of the code is to take in the the array and sort in ascending order. I get no errors within my code but I believe something is wrong. I have made some test cases and some have failed and I have a feeling in the recursivesort method I am doing something wrong. I have done multiple debugging walk through and just cant find where is the problem? public class RecursiveSorter { private int[] sortedArray; private int[] array; public RecursiveSorter() { array = new int[1]; } public RecursiveSorter(int[] a) { array = a; } public void setArray(int[] a) { array = a; } public int[] getSortedArray() { return sortedArray; } public int[] getOriginalArray() { return array; } public int[] sort() { sortedArray = array; recursiveSort(sortedArray.length - 1); return sortedArray; } public int[] recursiveSort(int endIndex) { if (endIndex &gt;= 0) { int m = getMaxIndex(endIndex, sortedArray); swap(m, endIndex, sortedArray); recursiveSort(endIndex-1); } return sortedArray; } public int getMaxIndex(int endIndex, int[] a) { int max = a[0]; int maxIndex = 0; for (int i = 1; i &lt; endIndex; i++) { if (a[i] &gt; max) { max = a[i]; maxIndex = i; } } return maxIndex; } public void swap(int src, int dest, int[] a) { int temp = a[dest]; a[dest] = src; a[src] = temp; } public String toString() { return "Original: " + prettyPrint(getOriginalArray()) + "\n" + "Sorted: " + prettyPrint(getSortedArray()); } private String prettyPrint(int[] a) { String s = ""; for (int i : a) s += i + " "; return s; } public static void main(String[] args) { // Automate running, but not testing int[] array = {5, 67, 12, 20}; RecursiveSorter s = new RecursiveSorter(array); s.sort(); System.out.println(s); // uses Sorter.toString } }
has comment: http://stackoverflow.com/comment/34939925
tagged with: java

http://stackoverflow.com/q/22892018
has answer: http://stackoverflow.com/a/22901617
accepted answer: http://stackoverflow.com/a/22901617
type: Question
type: AnsweredQuestion
has body: I have a DatePicker, from the javafx import. However i need it to contain a Calendar property, this is why i made a custom control that extends DatePicker. However every time the datepicker is changed it should call this property thats why i think i have to use the .notify method when an onAction event is performed. This throws an java.lang.IllegalMonitorStateException exception. This is the code i am using for this custom control: public class DatePickerControl extends DatePicker { private ObjectProperty&lt;Calendar&gt; calendar; public DatePickerControl() { super(); setValue(LocalDate.now()); } /** * Get the value of calendar * * @return the value of calendar */ public ObjectProperty&lt;Calendar&gt; calendarProperty() { Calendar calendar = new GregorianCalendar(); System.out.println("test"); calendar.set(getValue().getYear(), getValue().getMonthValue(), getValue().getDayOfMonth()); return new SimpleObjectProperty&lt;&gt;(calendar); } /** * Set the value of calendar * * @param calendar new value of calendar */ public void setCalendar(Calendar calendar) { this.calendar.set(calendar); LocalDate ld = LocalDate.now(); ld.withYear(calendar.get(Calendar.YEAR)); ld.withMonth(calendar.get(Calendar.MONTH)); ld.withDayOfMonth(calendar.get(Calendar.DAY_OF_MONTH)); setValue(ld); } public Calendar getCalendar() { return calendar.get(); } } and where i call the .notify(): dpAgendaRange.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent t) { t.notify(); } }); I am new to JavaFX so my apologies if the code is not very structural.
tagged with: java
tagged with: javafx
answer count: 1
score: 0
tagged with: datepicker
has title: Trying to make custom control, need to notify when a change was made to the value

http://stackoverflow.com/comment/35009781
comment on: http://stackoverflow.com/q/22933898
has text: @JonSkeet Also, how would the answer change if we are dealing with Class level variables?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22883557
accepted answer of: http://stackoverflow.com/q/22880571
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22880571
type: Answer
has body: There are some issues with the code. In general: NEVER call getGraphics on a Component! Apart from that, some minor things (don't extend JFrame, create the GUI on the EDT, and the naming conventions mentioned in the comments). The current structure of the code does not make it really easy to connect it to a GUI component. You should clearly think about how this connection should be established, and at which points in time you want the component to be updated. This example shows how this could basically be done. It is not a very nice and generic structure, but I did not want to completely re-write your MyArrayClass or generate a huge infrastructure of interfaces, timers, listeners etc. around it. It only shows a very simple and very pragmatic approach. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class GraphicalQuickSort { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().setLayout(new BorderLayout()); final MyArrayClass myArrayClass = new MyArrayClass(25); myArrayClass.NumberGenerator(); GraphicalQuickSortPanel panel = new GraphicalQuickSortPanel(myArrayClass); myArrayClass.graphicalQuickSortPanel = panel; JButton sortButton = new JButton("Sort"); sortButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { performSorting(myArrayClass); } }); f.getContentPane().add(sortButton, BorderLayout.NORTH); f.getContentPane().add(panel, BorderLayout.CENTER); f.setSize(400,400); f.setLocationRelativeTo(null); f.setVisible(true); } private static void performSorting(final MyArrayCla…

http://stackoverflow.com/comment/35024546
has text: @keithD - I'm not sure that I understand the question... Presumably, the code that you posted earlier is successfully determining what files need to be loaded (and where those files are located). The `writeBLOBPut` method just needs the fully qualified path to the file on the server.
type: AnswerComment
comment on: http://stackoverflow.com/a/22920759
score: 0
type: Comment

http://stackoverflow.com/comment/34858679
has text: Fetch the log of the shader (`Gdx.app.log("SHADER", program.getLog()`). The problem is as likely an issue with the GPU's shader compiler as GL/vs GL ES.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22833176
type: Comment

http://stackoverflow.com/q/22862309
score: 1
tagged with: java
type: Question
has body: I'm trying to make an Android app with Google Maps feature. I have setup everything, and imported all the required libraries, etc. But, I'm getting this annoying error, which I really don't understand what is wrong, I googled it but couldn't find any solution for this so I thought I should post here. I'm using Android Maps Utils https://github.com/googlemaps/android-maps-utils and I'm getting this error: The import com.google.maps.android.R cannot be resolved This error is coming in two files of Android Maps Utils. DefaultClusterRenderer.java (Package: com.google.maps.android.clustering.view) IconGenerator.java (Package: com.google.maps.android.ui) Any help to resolve this issue will be highly appreciated. Thanks!
has title: The import com.google.maps.android.R cannot be resolved
answer count: 2
tagged with: google-maps
upvote count: 1
has answer: http://stackoverflow.com/a/27255275
tagged with: google-maps-api-3
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/28434362
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/q/22901848
type: Question
has comment: http://stackoverflow.com/comment/34952278
has comment: http://stackoverflow.com/comment/34951968
has body: I'm a Java noob so please bear with me. I'm having an issue with a java project I have to complete. We have to sort a list of 10,000 customer transactions, pick the top three customers that spent the most, then give five random customers gift cards, five of them starting at $20 and ending at $100, increasing in $20 increments. So far I have the following: public static void main(String[] args) throws IOException { BufferedReader inputStream = new BufferedReader (new FileReader("Transactions.txt")); BufferedWriter outputStream = new BufferedWriter (new FileWriter("output.txt")); Scanner trans = null; try { trans = new Scanner(new BufferedReader(new FileReader("Transactions.txt"))); trans.useDelimiter("s*"); while (trans.hasNext()) { System.out.println(trans.next()); } } finally { if (trans !=null) { trans.close(); I'm confused as to how I would put this information into an OrderedList so it'll sort them in ascending order according to the amount they spent. EDIT: Here are some lines from the transaction.txt file: Order # Date First name Middle Initial Last name Address City State Zip Email Transaction Amount 1 8/26/2012 Kristina H Chung 947 Martin Ave. Muncie CA 46489 khchung@business.com $593 2 11/16/2012 Paige H Chen 15 MainWay Rd. Dallas HI 47281 phchen@business.com $516 3 11/10/2012 Sherri E Melton 808 Washington Way Brazil CA 47880 semelton@business.com $80 4 9/20/2012 Gretchen I Hill 56 Washington Dr. Atlanta FL 47215 gihill@business.com $989 5 3/11/2012 Karen U Puckett 652 Maplewood Ct. Brazil FL 46627 kupuckett@business.com $826 My apologies, but I have no idea how to make this look neat.
has comment: http://stackoverflow.com/comment/34951761
score: 0
has comment: http://stackoverflow.com/comment/34951811
has comment: http://stackoverflow.com/comment/34951945
has comment: http://stackoverflow.com/comment/34951923
has title: storing transactions in an OrderedList
has comment: http://stackoverflow.com/comment/34951633
has comment: http://stackoverflow.com/comment/34951599
has comment: http://stackoverflow.com/comment/34951998
has comment: http://stackoverflow.com/comment/34951821
has comment: http://stackoverflow.com/comment/34951673
has comment: http://stackoverflow.com/comment/34951837
has comment: http://stackoverflow.com/comment/34951701
answer count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/22854296
has comment: http://stackoverflow.com/comment/34865584
type: Answer
has comment: http://stackoverflow.com/comment/34865477
answers question: http://stackoverflow.com/q/22854186
score: 0
has body: TRY @Override public void onBackPressed() { android.os.Process.killProcess(android.os.Process.myPid()); } this is the best solution I've tried. And This is the same as above in that it instantly terminates the Linux process and all threads for the app: @Override public void onBackPressed() { System.exit(0); }

http://stackoverflow.com/q/22821402
tagged with: java
upvote count: 1
answer count: 1
downvote count: 0
has title: Set up a topic without auto acknowlege and hand acknowledge upon receipt
favorite count: 0
tagged with: sockets
tagged with: jms
type: AnsweredQuestion
tagged with: activemq-classic
tagged with: spring
has answer: http://stackoverflow.com/a/22887307
accepted answer: http://stackoverflow.com/a/22887307
has body: The JMS docs for Spring 4 here: http://docs.spring.io/spring/docs/4.0.0.RELEASE/spring-framework-reference/htmlsingle/#jms-receiving don't seem to cover this. I have multiple clients connecting with sockets to a socket server. They send messages to my server and receive messages back, all of which are being routed through an active MQ queue. Some messages get a response message back. The problem happens when a client sends a message A that gets a response B to send back to the client. After sending A to the server, the box with the open socket drops due to an error. Message B comes back and waits in the queue and nothing ever picks up the result. As I understand it, you can set up JMS queues for durable topics with no auto acknowledge. This way if the server drops, the message comes back and broadcasts to all boxes. If one of the boxes is currently connected to that client, it will process the message. If not, it will sit in the queue until a new server connects and then it will do it again. Once the message is sent, it will be marked as acknowledged and dropped from the queue. Since this seems doable with active MQ, how do I implement with Spring 4?
type: Question
score: 1

http://stackoverflow.com/q/22909537
tagged with: java
tagged with: printing
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34964969
has title: Get total number of pages to be printed using java.awt.Desktop?
has comment: http://stackoverflow.com/comment/34966951
has body: I wish to get the total number of pages to be printed in my program. I'm using java.awt.Desktop class. Here is my code for the printing part- public class PrintJob { public static void print(String str) { try { Desktop desktop = null; if (Desktop.isDesktopSupported()) { desktop = Desktop.getDesktop(); } desktop.print(new File(str)); } catch (IOException ioe) { //ioe.printStackTrace(); JOptionPane.showMessageDialog(null, "Invalid file type."); } } } I wish to get the total number of pages to be printed. How can i do it?
linked to: http://stackoverflow.com/q/3701644
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34964990
score: 1

http://stackoverflow.com/comment/35778258
type: Comment
has text: @kakabali I've added an example of a controller for you. Check your requst header in the debugger you should have the referer
type: AnswerComment
comment on: http://stackoverflow.com/a/23017200
score: 0

http://stackoverflow.com/q/22938748
tagged with: email
type: UnansweredQuestion
tagged with: properties
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22938892
tagged with: session
has answer: http://stackoverflow.com/a/22938916
has title: setup email connection in java
score: 0
has body: I am trying to make connection to the email server using property files and session store value. and all the parameters are given dynamically. this is what i'm trying Properties props = System.getProperties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", emailHost); props.put("mail.smtp.port", "2525"); Session sessions = Session.getDefaultInstance(props); Store store = sessions.getStore(emailAccType); store.connect(emailHost, emailId, emailPwd); Even if i am giving the correct email and password, the connection is not setting up. please do the needful help. Thanks in advance.

http://stackoverflow.com/comment/34969361
type: QuestionComment
comment on: http://stackoverflow.com/q/22911929
score: 0
has text: @duffymo Please review the details I provided showing the location of PortServer from my current directory and the -cp parameter to match up to it. If these are incorrect, please give me a reason why.
type: Comment

http://stackoverflow.com/q/22939426
tagged with: java
has body: I googled this problem a lot but can't find any answers. I have legacy system with three JFrame objects. They were created in one chain: first JFrame is parent for second one, second is parent for third. The problem is after I close third window, the first window receive focus and the second one is going behind the first. And its wrong. I expect that after closing third JFrame focus will go to the second window. What could be the problem and how to fix this wrong behaviour? Code looks something like this: Frame first = new JFrame(null, "first"); JDialog second = new JDialog(first, "second"); JFrame third = new JFrame(second, "third"); third.addWindowListener(new WindowAdapter() { // request focus in second window when focus lost in third });
has comment: http://stackoverflow.com/comment/35020398
has comment: http://stackoverflow.com/comment/35052119
linked to: http://stackoverflow.com/q/9554636
has title: JFrame hided after closing his child
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/35019227
has answer: http://stackoverflow.com/a/22939524
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
type: Question

http://stackoverflow.com/comment/35008562
type: Comment
has text: as an exmaplen to that code lets say, we require COMBO OFFER, WIN THE DREAM and CRICKET in the second list if GSM is selected in the 1st selection list
comment on: http://stackoverflow.com/a/22933353
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34844898
type: AnswerComment
type: Comment
has text: thx. that is definitely another route that I can take instead of completely esc everything. (y)
comment on: http://stackoverflow.com/a/22823838
score: 0

http://stackoverflow.com/q/22873886
tagged with: jakarta-mail
score: 0
answer count: 1
tagged with: imap
has body: I am developing a email application and I am holding message classes as files. However, I have some questions about the operation on emails. For example, There is a message being held its class as a file but when user want to delete it if I got message class from file and I setted flag as DELETED after that I invoked folder.expunge() method. Would it be successfull? Or, Do I have to take a instance of that message from Folder class by matching Message-ID header and do delete process?
has answer: http://stackoverflow.com/a/22874598
has title: Javamail: Deleting mail whose class is held as a file
tagged with: android
accepted answer: http://stackoverflow.com/a/22874598
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22894761
accepted answer: http://stackoverflow.com/a/23027511
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23027511
tagged with: geocoding
has body: I am very new to GeoNames API and I need a hierarchical results say If I select Continent it will show all the countries and If I select a country I need to fetch all the states and so on. Continent --> Country --> State --> Districts/Cities --> Towns --> Villages. I need to build the above hierarchy. With the using of GeoNames API I was able to fetch till Districts/Cities but I was unable to fetch the Towns and Villages for particular District/City. Is the GeoNames API doesn't have that database or is there any way to follow for getting Towns and Villages...??? Or else is there any separate API to achieve my task. I am fetching the records for a Country "INDIA". Can any one help me on this. I stuck over here. Thanq in advance
tagged with: geonames
has title: Fetch all towns/villages names using geonames api
answer count: 1

http://stackoverflow.com/a/22956928
has comment: http://stackoverflow.com/comment/35050832
score: 0
has body: You can use the following pattern to define compareTo with more and more specific conditions: @Override public int compareTo(Movie other) { int result = Integer.compare( this._time, other._time ); if (result == 0) { result = this._title.compareTo( other._title ); } if (result == 0) { // result = compare even more specific field } return result; }
type: Answer
answers question: http://stackoverflow.com/q/22956562

http://stackoverflow.com/comment/34905505
comment on: http://stackoverflow.com/q/22876161
score: 0
type: Comment
type: QuestionComment
has text: When I output the x and y coordinates in command prompt, it just suddenly becomes NaN.

http://stackoverflow.com/a/22994758
answers question: http://stackoverflow.com/q/22910268
has body: OK, so I finally have found a solution. You need to get rid of dependencies to modules and copy the resources using maven-resources-plugin: example-html/pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.example example-parent 1.0 example-html war com.example example-core ${project.version} com.example example-core ${project.version} sources org.codehaus.mojo gwt-maven-plugin ${gwt.version} prepare-package compile org.apache.maven.plugins maven-resources-plugin copy-assets-core process-resources copy-resources ${project.build.directory}/${project.artifactId}-${project.version}/ExampleProject/ ${project.parent.basedir}/assets-core/src/main/resources/assets org.apache.maven.plugins maven-war-plugin false en org.apache.maven.plugins maven-resources-plugin copy-assets-en process-resources copy-resources true ${project.build.directory}/${project.artifactId}-${project.version}/ExampleProject/ ${project.parent.basedir}/assets-en/src/main/resources/assets
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22910268
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34934906
type: QuestionComment
type: Comment
has text: Is BaseActivity Serializable?
comment on: http://stackoverflow.com/q/22892647
score: 0

http://stackoverflow.com/q/22868629
has title: Pong game - AI paddle flickering
type: Question
tagged with: game-physics
has comment: http://stackoverflow.com/comment/34891659
accepted answer: http://stackoverflow.com/a/22869343
has comment: http://stackoverflow.com/comment/34891266
has comment: http://stackoverflow.com/comment/34890950
score: 0
has body: I need to make the game impossible to win, so I used this code to move AI paddle. My code may be slightly unreadable at first, so here's the theory behind it: the paddle always hits the ball with the middle point, unless the ball is closer to the edge than half of the paddle length, then the paddle stops to move with one of its ends touching top or bottom window frame. if (ball.getY() &lt; getHeight() - HEIGHT / 2 &amp;&amp; ball.getY() &gt; HEIGHT / 2) { paddleRight.setLocation(getWidth() - 3 * WIDTH, ball.getY() - HEIGHT / 2); image2.setLocation(getWidth() - 3 * WIDTH, ball.getY() - HEIGHT / 2); image2.sendToFront(); } else if (ball.getY() &lt; HEIGHT / 2) { paddleRight.setLocation(getWidth() - 3 * WIDTH, 0); image2.setLocation(getWidth() - 3 * WIDTH, 0); image2.sendToFront(); } else { paddleRight.setLocation(getWidth() - 3 * WIDTH, getHeight() - HEIGHT); image2.setLocation(getWidth() - 3 * WIDTH, getHeight() - HEIGHT); image2.sendToFront(); } My ball also speeds up randomly during the game: boolean bool = rand.nextBoolean(); if (bool) if (dx &gt; 0) dx += 1; else dx -= 1; else if (dy &gt; 0) dy += 0.5; else dy -= 0.5; ball movement consist of X and Y axis movement And at some specific speed, if the paddle gets to one of the corners it starts to blink back and forth between top and bottom corner. I can't find the reason for that in my code. Full code here
answer count: 1
has answer: http://stackoverflow.com/a/22869343
has comment: http://stackoverflow.com/comment/34891315
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34891121
tagged with: java

http://stackoverflow.com/comment/34852879
comment on: http://stackoverflow.com/a/22822901
score: 0
type: AnswerComment
has text: Both the files are in the same package? Post the exact error that you are getting.
type: Comment

http://stackoverflow.com/comment/34949903
score: 0
type: QuestionComment
type: Comment
has text: I have posted (at least) two factual errors in the last 24 hours. It happens to all of us. Don't give it another thought.
comment on: http://stackoverflow.com/q/22900706

http://stackoverflow.com/q/22892738
has comment: http://stackoverflow.com/comment/51696794
score: 3
tagged with: java
has title: Mac OS and Java bluetooth
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/39855765
answer count: 1
favorite count: 0
tagged with: bluetooth
has body: After searching for hours, I decided to ask this question here. For JSR-82 (bluetooth), there is an implementation called bluecove. However, the Mac OS version relies on a 32 bit VM (the last time the library was updated was back in 2008). The problem is that newer JDK versions for the Mac do not support 32 bit anymore (the -d32 argument just gives me an error). So is there a possibility to get a 32 bit JVM for Mac OS? Or are there other implementations for bluetooth that support 64 bit VMs?
tagged with: macos
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/a/22832565
answers question: http://stackoverflow.com/q/22832346
has body: You get the LazyInitializationException when trying to access a lazy fetched atttribute on an entity detached from the persistence context. It usually means that your hibernate session ( / JPA entityManager) have been already closed when you access the lazy attribute. see Struggling to understand EntityManager proper use
score: 0
type: Answer

http://stackoverflow.com/comment/135637776
type: Comment
has text: This does not print the PQ in priority order. Please read the question. Printing in order is what the question is about. *Ergo* you haven't answered it. Being too lazy to check is no excuse. I did.
score: 0
comment on: http://stackoverflow.com/a/56245705
type: AnswerComment

http://stackoverflow.com/a/22890624
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: A way using split: String s = "[1][1][4][2][6][d][][][][a][8]"; String[] tok = s.split("(?&lt;=\\[)(?=[0-9a-f]\\])|(?&lt;=\\[[0-9a-f])(?=\\])"); String result = ""; for (int i=0; i&lt;tok.length; i++) { if (i%2==1) { result += getColor(tok[i]); } else { result += tok[i]; } }
answers question: http://stackoverflow.com/q/22890046

http://stackoverflow.com/q/22825426
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/34813686
has comment: http://stackoverflow.com/comment/34813636
answer count: 1
favorite count: 0
has body: I'm asked to make a constructor for a Decision Tree class, but I have no idea how to approach it. The question asks: Write a constructor for the Decision Tree class, which takes in a sorted array of instances, and constructs recursively a tree that splits the data until all leaves are pure. . Here is the Decision Tree class I have to program: package DecisionTree; public class DecisionTree { public DecisionTree(Instance[] instances) { // code goes here } public void prune() { // code goes here } public boolean classify(double input) { // code goes here } public void print() { // code goes here } } I am also provided with these methods: First: package DecisionTree; public class DTNode { Instance[] a; double testValue; DTNode left, right; // code goes here } Second: package DecisionTree; public class Instance { double attribute; boolean label; public Instance(double a, boolean c) { attribute = a; label = c; } public double getAttribute() { return attribute; } public void setAttribute(double a) { attribute = a; } public boolean getLabel() { return label; } public void setLabel(boolean c) { label = c; } }
has answer: http://stackoverflow.com/a/22825493
has title: How to create a Decision Tree from a Collection of decisions?
accepted answer: http://stackoverflow.com/a/22825493
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34813710
downvote count: 3
upvote count: 1
type: Question
tagged with: tree
tagged with: algorithm

http://stackoverflow.com/q/22955770
answer count: 2
has comment: http://stackoverflow.com/comment/35048505
tagged with: adapter
has comment: http://stackoverflow.com/comment/35048457
favorite count: 0
tagged with: listener
has body: i have develop one java desktop application which monitor the work of the user . now i want to count the number of key press and number of mouse click anywhere in system. that means when ever my application is running and user typing something in browser or open any folder then mouse click and key press count is increment. can i use below code KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher() if yes then how it is possible? and if i cannot use that then please say me fast how it is possible. i am beginner in java
tagged with: windows
has answer: http://stackoverflow.com/a/23448119
has title: how to find key listener on any where in window
has answer: http://stackoverflow.com/a/22955862
has comment: http://stackoverflow.com/comment/35048694
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22955862
tagged with: java
tagged with: swing
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23448119
upvote count: 5
score: 4
has comment: http://stackoverflow.com/comment/35048420

http://stackoverflow.com/comment/34784073
has text: what do you mean by "check if they exist in a set of pairs of integers"?
comment on: http://stackoverflow.com/q/22809215
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22928720
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/22928688
downvote count: 0
has body: Use capture groups, your regex would be: \\.([^.]*)$
has comment: http://stackoverflow.com/comment/35000339
has comment: http://stackoverflow.com/comment/35000369
has comment: http://stackoverflow.com/comment/35000475
has comment: http://stackoverflow.com/comment/35000420
has comment: http://stackoverflow.com/comment/35000454
has comment: http://stackoverflow.com/comment/35000520
score: 5

http://stackoverflow.com/comment/34980963
score: 0
comment on: http://stackoverflow.com/q/22917749
type: QuestionComment
type: Comment
has text: Yes, it works with timer, but i don't need timer. I put here Thread.sleep only for simulating real long-time staff, what is processing in every iteration(get data from internet, modify, save new data, (here repaint frame!), go to next iteration). So it always takes random time, so timer is useless here. How can i manage with this problem?

http://stackoverflow.com/comment/34791097
type: Comment
has text: Thanks for that. Can there be a logic where I can make use of single cookie only.
type: QuestionComment
comment on: http://stackoverflow.com/q/22812572
score: 0

http://stackoverflow.com/q/22877059
has comment: http://stackoverflow.com/comment/34907008
type: Question
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34907109
has body: In my table i have used sequence to create id automatically How to Insert into this table using Netbeans I tried a code to insert values and got the following error [Microsoft] [ODBC driver for Oracle] [Oracle]ORA-00913:too many values the code is: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try { String sql=("insert into customer values(seq_user.nextval,?,?,?,?,?,?,?)"); pstmt=con.prepareStatement(sql); pstmt.setString(1,lname.getText()); pstmt.setString(2,fname.getText()); pstmt.setString(3,email.getText()); pstmt.setString(4,password.getText()); pstmt.setString(5,address1.getText()); pstmt.setString(6,address2.getText()); pstmt.setString(7,city.getText()); pstmt.executeUpdate(); } catch(SQLException ex){ JOptionPane.showMessageDialog(this,ex.getMessage()); }
downvote count: 0
answer count: 0
type: UnansweredQuestion
has title: ora-00913 too many values while using sequence
has comment: http://stackoverflow.com/comment/34907814
tagged with: oracle-database
tagged with: jdbc
score: 1
favorite count: 0

http://stackoverflow.com/comment/34996804
type: Comment
score: 0
has text: Don't do this. MySQL already has a facility for scheduled backups. Use it. You don't need to write Java code for this purpose.
type: QuestionComment
comment on: http://stackoverflow.com/q/22926676

http://stackoverflow.com/q/22898808
type: AnsweredQuestion
tagged with: swing
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22899329
score: 0
has comment: http://stackoverflow.com/comment/34945980
tagged with: jscrollpane
has body: I'm currently writing a Java GUI application using NetbeansIDE 7.4 and have encountered the following problem: I have a jPannel enclosed in a jScrollPane of initial dimension 300,160 Every time i click on a jButton at runtime, I resize the jPannel as follows: jPanel3.setPreferredSize(new Dimension(300, (count + 3) * 30)); jPanel3.repaint(); if the count variable is larger than 3, the Vertical Scrollbar adapts to the jPannel every time I resize it. But if count is less than 3, the vertical scrollbar dissapears, and when I resize the jPannel again ( lets say, count = 10), the Scrollbar doesn't show up anymore. Is this normal? How can i fix it?
tagged with: user-interface
answer count: 1
tagged with: netbeans-7
has answer: http://stackoverflow.com/a/22899329
has title: jScrollPane Scroll dissapears after jPanel resize

http://stackoverflow.com/q/22902840
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/22902853
has answer: http://stackoverflow.com/a/22902866
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/34953849
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34953351
possible better answer: http://stackoverflow.com/a/22902866
has comment: http://stackoverflow.com/comment/34953375
has answer: http://stackoverflow.com/a/22902883
type: AnsweredQuestion
has title: Accessing a private variable in a separate class?
accepted answer: http://stackoverflow.com/a/22902853
score: 1
tagged with: java
has body: This is homework, so I don't expect you to do it for me. I have a program that sorts students by their student ID numbers. The problem is that the student class that creates the students (provided by my teacher, can't change) has the ID's set as private, so I can't access them in the calling function. This is the student class: public class StudentQ { private String name; private int id; private double avg; StudentQ(String sname, int sid, double average){ name=sname; id=sid; avg=average; } // Note this uses the String static method format to produce a string // in the same way that System.out.printf does public String toString(){ return String.format("%15s [%6d]:%7.2f", name,id,avg); } public String getName(){ return name; } public int getID(){ return id; } public double getAverage(){ return avg; } public void setAverage(double newavg){ avg=newavg; } } and this is my sorting class: static void sortByID(StudentQ[] students) { for (int lastPlace = students.length-1; lastPlace &gt; 0; lastPlace--) { int maxLoc = 0; for (int j = 1; j &lt;= lastPlace; j++) { if (students[j].getID() &gt; students[maxLoc].getID()) { maxLoc = j; } } int temp = students[maxLoc].getID(); *students[maxLoc].id = students[lastPlace].id; students[lastPlace].id= temp;* } } The way it is now, it gives me and error saying that the field StudentQ.id is not visable, and I can't use .getID() because that is trying to assign a value to a method. Thank you.
upvote count: 1

awk
tag name: awk
type: Tag
tags question: http://stackoverflow.com/q/22955772

http://stackoverflow.com/q/22941423
has answer: http://stackoverflow.com/a/22942244
has answer: http://stackoverflow.com/a/56705174
tagged with: jagged-arrays
has comment: http://stackoverflow.com/comment/35023747
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/35023075
favorite count: 0
has answer: http://stackoverflow.com/a/22942319
has title: Filling a ragged array with a loop in java
type: UnansweredQuestion
has body: I was wondering how it was possible to fill a ragged array with a loop in Java. In my example I want to put Pascals Triangle in the Array. When I try to do it ragged, ( // int [][] hako = new int [n][]; -> as I understand it; it gives a java.lang.NullPointerException. Thanks int n = 12, r = 1; int [][] hako = new int [n][]; for(int i = 0; i &lt; n; i++){ for(int j = 0; j &lt; r; j++){ hako[i][j] = newton(i, j); } r++; } static int factorial(int n){ int k = 1; if(n == 0) return 1; while(n&gt;1){ k*=n; n--; } return k; } static int newton(int i, int j){ return factorial(i)/((factorial(j))*(factorial(i-j))); }
downvote count: 2
type: Question
score: -2
tagged with: java

http://stackoverflow.com/a/22963470
has body: Before using the JRadius library, a JRadius dictionary should be loaded as below. AttributeFactory.loadAttributeDictionary("net.jradius.dictionary.AttributeDictionaryImpl"); Also, ensure you have added JRadius Dictionary (jradius-dictionary-.jar) to you class path.
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22863893

http://stackoverflow.com/comment/35039350
type: QuestionComment
type: Comment
has text: Be specific and explicit. What is the problem?
score: 0
comment on: http://stackoverflow.com/q/22950515

http://stackoverflow.com/comment/34868353
type: Comment
type: QuestionComment
has text: War file size is 31MB and I tried setting it in control panel ->administrative tools -->services -->apache tomcat console -->start parameters
comment on: http://stackoverflow.com/q/22847935
score: 0

http://stackoverflow.com/a/22940854
score: 2
has body: I would first try something like the following: <step id="step1" parent="s1" next="step2"/> <step id="step2" parent="s2"/> <step id="step3" parent="s3"/> <step id="step6" parent="s6"/> <step id="step7" parent="s7"/> <step id="step8" parent="s8"/> <step id="step4" parent="s4"/> <step id="step5" parent="s5"/> <step id="step9" parent="s9"/> <step id="step10" parent="s10"/> <step id="step11" parent="s11"/> but making sure the Spring Batch version is after 2.1.5.
accepted answer of: http://stackoverflow.com/q/22933613
has comment: http://stackoverflow.com/comment/35045224
has comment: http://stackoverflow.com/comment/35026622
answers question: http://stackoverflow.com/q/22933613
has comment: http://stackoverflow.com/comment/35045130
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35044928
type: Answer
has comment: http://stackoverflow.com/comment/35026209
has comment: http://stackoverflow.com/comment/35046326

http://stackoverflow.com/q/22929551
tagged with: string-formatting
has body: I have a edittext, and if I enter input number as 100000, the result must be 100.000, and if I enter input as 1000000, the result must be 1.000.000. After every 3 characters from the last to beginning must have a "." Here is my code: tambah = (EditText)rootView.findViewById(R.id.total); tambah.setOnFocusChangeListener(new OnFocusChangeListener(){ public void onFocusChange(View v, boolean hasFocus) { // ... }
tagged with: android
has answer: http://stackoverflow.com/a/22930836
has answer: http://stackoverflow.com/a/22929630
type: AnsweredQuestion
tagged with: android-edittext
accepted answer: http://stackoverflow.com/a/22929643
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22929849
tagged with: format
answer count: 6
has answer: http://stackoverflow.com/a/22930351
has answer: http://stackoverflow.com/a/22929603
has answer: http://stackoverflow.com/a/22929643
downvote count: 0
has title: Android edittext: Formatting number
favorite count: 0
possible better answer: http://stackoverflow.com/a/22929603

http://stackoverflow.com/comment/35070603
type: Comment
comment on: http://stackoverflow.com/a/22967976
has text: Is there a better way to convert an arraylist like this ` public ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>(); ` to a json string with objects?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34888120
type: Comment
has text: Can you provide the code used to time this method running, so that we can confirm any proposed solutions are an improvement or not.
score: 0
comment on: http://stackoverflow.com/q/22867038
type: QuestionComment

http://stackoverflow.com/q/22902880
has answer: http://stackoverflow.com/a/22902893
accepted answer: http://stackoverflow.com/a/22902893
has title: Trying to display created output file
has body: So i passed a file into filewriter and then passed to printwriter. However, upon my assignments instructions im supposed to print these variables i pass to printwriter using a toString method in my superclass. This is for an assignment so thats why the rules are very clear as to how instructors wants the output to be. System.out.print("Please enter a file name: "); fileName = input.next(); File fw = new File(fileName + ".txt"); AccountWithException acctException = new AccountWithException(fullName, balance, id, RATE); System.out.println(acctException.toString()); &lt;---This works // pass object to printwriter and pw to write to the file pw = new PrintWriter(fw); // print to created file pw.println(firstName); pw.println(lastName); pw.println(balance); pw.println(id); pw.println(RATE); System.out.println(pw.toString()); &lt;---Doesn't work. Only prints location and im supposed to somehow use the overloaded toString method to output the data within the file (i guess after its written)
tagged with: printwriter
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/53921906
answers question: http://stackoverflow.com/q/22880287
type: Answer
has body: boolean method (int a, int b, int c) { return ( a*3==a+b+c || b*3==a+b+c || c*3==a+b+c ); } // if spaces are even, one of given ints is an average of their sum.
score: 0

http://stackoverflow.com/q/22894007
answer count: 1
has answer: http://stackoverflow.com/a/22894191
tagged with: java
has title: Get buttons in frame
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/22894191
favorite count: 0
has comment: http://stackoverflow.com/comment/34937114
type: Question
score: -2
has body: I need to add a listener to each button like this: for(i = 0; i &lt; 10; i++) buttons[i].addActionListener(actionListener); The buttons already exist, and I need to get list of buttons in my frame.
has comment: http://stackoverflow.com/comment/34937355
downvote count: 2
tagged with: swing

http://stackoverflow.com/a/22825047
type: Answer
accepted answer of: http://stackoverflow.com/q/22824041
upvote count: 6
answers question: http://stackoverflow.com/q/22824041
has comment: http://stackoverflow.com/comment/34871098
has body: I think one (main) part of the problem is that you are computing the radius of the bulge effect in pixels. Although I have not read all anwers in the threads that you linked, it seems like they are referring to texture coordinates - that is, to values between 0 and 1. Apart from that: With the current approach, you will have a sampling problem. Imagine that one pixel at the center of the input image will be "stretched" so that it covers an area of, say, 10x10 pixels in the output image. But still, you are only computing one new position for this pixel. Imagine it like you are taking pixels from the input image, and move them to a new position in the output image - but you have to do it the other way around: You have to check each pixel in the output image, and compute which pixel of the input image was moved there. I created a small example: It allows moving a "magnifying glass" over the image with the mouse. With the mouse wheel, you can change the strength of the distortion. With SHIFT+MouseWheel, you can change the size of the magnifying glass. import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.event.InputEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.awt.image.BufferedImage; import java.beans.Transient; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class ImageBulgeTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new GridLayout(1, 1)); frame.getContentPane().add(new ImageBulgePanel()); frame.pack(); frame.setLocationR…
has comment: http://stackoverflow.com/comment/34861288
has comment: http://stackoverflow.com/comment/34856574
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34854513
score: 6

http://stackoverflow.com/a/22846123
accepted answer of: http://stackoverflow.com/q/22844853
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22844853
has body: View.GONE will only hide the view and make sure it is not rendered nor occupies any space in the Layout. Think of it as CSS visibility:hidden vs display:none. It will not actually stop the object from being processed, only from being drawn on the layout pass.
type: Answer

http://stackoverflow.com/a/22863387
answers question: http://stackoverflow.com/q/22810331
has body: Here a summarizing answer on base of my comments: Does the remote side have a second JodaTime version? Maybe an older one before version 2.0 where the Comparable-handling changed a little bit (see generified interface ReadableInstant)? Pre 2.0 the method in question had the signature compareTo(Object) while in 2.0 and later the new signature compareTo(ReadableInstant), see also the release notes. This situation of two joda-jars and a connected classloading-issue would explain following exception message: Method "compareTo" with signature "(Lorg/joda/time/ReadableInstant;)I" is not applicable on this object with the target object being class org.joda.time.DateTime. (Your question was tricky and has deserved even more upvotes. Glad to hear that you found the reason in JRuby-library containing an older JodaTime-version.)
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22810331
type: Answer

http://stackoverflow.com/a/22874175
has comment: http://stackoverflow.com/comment/34975998
has comment: http://stackoverflow.com/comment/34926917
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/93277898
has body: Author of the maven-jaxb2-plugin as well as jaxb2-basics here. My recommendation would be to add your dependency as plugin into configuration rather that as dependency to the maven plugin. See this test project: org.jvnet.jaxb2.maven2 maven-jaxb2-plugin true -Xannotate org.jvnet.jaxb2_commons jaxb2-basics-annotate org.jvnet.jaxb2_commons jaxb2-basics-test-annox-annotations I believe this to be better than dependencies of the Maven plugin. First, I think the normal repo will used for the artifact resolution in this case. Next, at least in the times of Maven 2.x, Maven created just one instance of each maven plugin. So the first one in the build order defines the dependencies/classpath of the plugin. Providing the dependency artifact in the configuration does not have this problem.
answers question: http://stackoverflow.com/q/22814573
has comment: http://stackoverflow.com/comment/93424418

http://stackoverflow.com/comment/34865693
comment on: http://stackoverflow.com/q/22854419
type: Comment
score: 1
has text: print your stacktrace....
type: QuestionComment

http://stackoverflow.com/a/22871292
score: 4
has comment: http://stackoverflow.com/comment/34896432
has comment: http://stackoverflow.com/comment/34977125
has comment: http://stackoverflow.com/comment/34896804
has comment: http://stackoverflow.com/comment/34906785
has body: Use <from uri="jms:queue:Q.activemq1" /> /Customer/Order/id/text() Order with ${body} has been queued <log message="${body}"/> This prints Order with 123 has been queued
upvote count: 4
has comment: http://stackoverflow.com/comment/34985048
has comment: http://stackoverflow.com/comment/34896167
downvote count: 0
answers question: http://stackoverflow.com/q/22870755
has comment: http://stackoverflow.com/comment/34897598
type: Answer
has comment: http://stackoverflow.com/comment/34898945

http://stackoverflow.com/q/22954566
tagged with: testng
tagged with: selenium-webdriver
type: AnsweredQuestion
has title: Automated testing whith parallel users and captha in login (with selenium webdriver)
has answer: http://stackoverflow.com/a/22956332
accepted answer: http://stackoverflow.com/a/22956332
type: Question
tagged with: java
tagged with: selenium-grid
score: 0
has body: What I need to do is write automated test which tests whether or not web system works enough fast. (steps are not longer than 1s). and there should be ~100 parallel system users. To achieve the goal, I use Selenium Webdriver and I learned how to write simple tests (in Java) but there are 2 main problems: 1) How can I add parallel users? If I create 100 instances then PC will crash. I read something about selenium grid and TestNG but still not convinced what I really need. 2) There is a captcha in login page. I suppose there are better solution for sleeping all threads while I'm making manual login?
tagged with: automated-tests
answer count: 1

http://stackoverflow.com/comment/34920386
score: 0
type: Comment
type: QuestionComment
has text: It's sent with the file name in the "send("FILE_"+buffer.length+"_\t"+file.getName());" instruction.
comment on: http://stackoverflow.com/q/22882430

http://stackoverflow.com/a/26516048
upvote count: 1
score: 1
has body: From developer.android.com: Caution: A service runs in the main thread of its hosting process—the service does not create its own thread and does not run in a separate process (unless you specify otherwise). This means that, if your service is going to do any CPU intensive work or blocking operations (such as MP3 playback or networking), you should create a new thread within the service to do that work. By using a separate thread, you will reduce the risk of Application Not Responding (ANR) errors and the application's main thread can remain dedicated to user interaction with your activities. I think you need to create and run a worker thread on your service code. Take a look at "Extending the Service class" section in following url http://developer.android.com/guide/components/services.html
accepted answer of: http://stackoverflow.com/q/22809940
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22809940
type: Answer

maven-eclipse-plugin
tag name: maven-eclipse-plugin
type: Tag
tags question: http://stackoverflow.com/q/22840845
tags question: http://stackoverflow.com/q/22839590

http://stackoverflow.com/q/22836757
has title: can not create CoreContainer in solrj and embeddedsolrserver in java
has body: This is my Code, I am very tired to create CoreContainer File home = new File( "C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/solr" ); //home directory File f = new File(home, "solr.xml" ); CoreContainer container = new CoreContainer(); container.load( "C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/solr", f ); EmbeddedSolrServer server = new EmbeddedSolrServer( container, "collection1" ); SolrQuery query = new SolrQuery("*:*"); QueryResponse rsp = server.query(query); SolrDocumentList docs = rsp.getResults(); Iterator<SolrDocument> i = docs.iterator(); while (i.hasNext()) { System.out.println(i.next().toString()); } my solr.xml file is below. ${host:} ${jetty.port:9000} ${hostContext:solr} ${zkClientTimeout:30000} ${genericCoreNodeNames:true} ${socketTimeout:0} ${connTimeout:0} solrconfig.xml file is same as default When I'm run this I get SolrServerException like, and also not create EmbeddedSolrServer INFO: New CoreContainer: solrHome=solr/ instance=6751353 Apr 03, 2014 4:46:05 PM org.apache.solr.core.SolrResourceLoader <init> INFO: Solr home set to 'C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/solr\' org.apache.solr.client.solrj.SolrServerException: Error executing query at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:95) at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:118) at com.hl.model.em.main(em.java:101) Caused by: org.apache.solr.common.SolrException: No such core: collection1 at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:104) at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89) ... 2 more
tagged with: lucene
has answer: http://stackoverflow.com/a/65910070
answer count: 3
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22837160
accepted answer: http://stackoverflow.com/a/22837132
tagged with: solrj
has answer: http://stackoverflow.com/a/22837132
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: solr
possible better answer: http://stackoverflow.com/a/22837160
type: Question

http://stackoverflow.com/comment/34966505
comment on: http://stackoverflow.com/q/22903002
type: Comment
type: QuestionComment
score: 0
has text: Ah right yes sorry, In my tired state I left out some information which to me seemed somewhat irrelevant, however for continuity I should have included the code that receives the request object on the PC side. The app acquires the request object prior to this exchange, through another medium. You seem to have hit the nail on the head though with the flush() calls inside loops. It seems to work now. Thank you.

http://stackoverflow.com/comment/34991806
has text: @DavidHofmann: Sorry, I can't tell you that. Honestly, I would never write such code as long as I am not absolutely sure it is required to be fast enough. I recommend doing a benchmark.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22923536

http://stackoverflow.com/comment/35070257
comment on: http://stackoverflow.com/a/22967826
score: 0
has text: Thanks for the answer Vivin! So before that happens, do you know of any workarounds without having to make subpackage classes public? Would having one 'facade' public class in the subpackage be sane at all (or it is a complete overstretch which does not really hide anything)?
type: Comment
type: AnswerComment

http://stackoverflow.com/q/22885231
score: 0
tagged with: arrays
answer count: 1
tagged with: url
has answer: http://stackoverflow.com/a/22885433
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22885433
has comment: http://stackoverflow.com/comment/34921639
has comment: http://stackoverflow.com/comment/34921732
type: Question
has title: Get all the src (or SRC) URLs Java
tagged with: java
tagged with: web-crawler
has body: I am trying to get all the src (or SRC) URLs that appear in an array of bytes, however, I do not know how to implement the byte array. The code I have now extracts all parts of the HTML that begin with src= or SRC= and pulls out the correct items. However, how would the byte array play a role in this? The byte array is a sequence of chars that might contain src (or SRC) URLs, initialized from the contents of a URL. Furthermore, the string of vectors that is at the end of this function is supposed to contain all the src attributes found in data. I have a saveResource function that saves a resource in a file, as well as in a byte array which is also shown below. How do I store the src urls that my program is pulling out into the byte array?

http://stackoverflow.com/comment/34932824
type: QuestionComment
has text: @amaleemuer - I will post soon a `O(N)` solution.
comment on: http://stackoverflow.com/q/22891441
score: 0
type: Comment

http://stackoverflow.com/q/22918207
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34981552
downvote count: 0
has answer: http://stackoverflow.com/a/22918393
has title: Java 8 stream IllegalStateException
score: 1
possible better answer: http://stackoverflow.com/a/25377686
favorite count: 0
has answer: http://stackoverflow.com/a/25377686
accepted answer: http://stackoverflow.com/a/22918393
upvote count: 1
tagged with: java-8
has body: I am trying to compute Prime numbers with Java8 streams, but I get into an IllegalStateException : stream has already been operated upon or closed. This is my code : package experimentations.chapter02; import java.util.stream.Stream; public class PrimesStream { public static void main(String[] args) { Stream.iterate(0, e-&gt; e+1).filter(PrimesStream::isPrime).limit(10).forEach(System.out::println); } public static boolean isPrime(int i){ if (i &lt; 2) return false; Stream&lt;Integer&gt; stream = Stream.iterate(2, e -&gt; e+1); stream.limit(i - 2); return !stream.anyMatch(divisor -&gt; i%divisor == 0); } } And this is the stacktrace : Exception in thread "main" java.lang.IllegalStateException: stream has already been operated upon or closed at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:229) at java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:449) at experimentations.chapter02.PrimesStream.isPrime(PrimesStream.java:14) at experimentations.chapter02.PrimesStream$$Lambda$2/918221580.test(Unknown Source) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:529) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:516) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at experimentations.chapter02.PrimesStream.main(PrimesStream.java:7) I have the feeling that this is because I am trying to apply a stream call into an…
type: AnsweredQuestion
tagged with: java-stream

http://stackoverflow.com/q/22815023
score: 38
has body: Is it feasible to say that generic wildcard types should not be used in return parameters of a method? In other words, does make sense to declare an interface like the following: interface Foo&lt;T&gt; { Collection&lt;? extends T&gt; next(); } Additionally, is it ok to say that generic wildcard types does make sense only at method's parameter declaration?
answer count: 3
linked to: http://stackoverflow.com/q/30543400
has comment: http://stackoverflow.com/comment/91518378
upvote count: 38
downvote count: 0
tagged with: generics
favorite count: 0
has title: Generic wildcard types should not be used in return parameters
accepted answer: http://stackoverflow.com/a/22815270
possible better answer: http://stackoverflow.com/a/22815425
has answer: http://stackoverflow.com/a/22815425
has answer: http://stackoverflow.com/a/54998652
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/49169468
has answer: http://stackoverflow.com/a/22815270

http://stackoverflow.com/a/24262342
downvote count: 0
type: Answer
score: 15
answers question: http://stackoverflow.com/q/22920131
upvote count: 15
has body: To sum up what I found on this topic here and there : Here is the final code if you want to get the modulus for example : import java.io.FileReader; import java.security.Security; import java.security.KeyFactory import org.bouncycastle.jce.provider.BouncyCastleProvider; // Note that you need to add 'pkix' package. e.g. 'org.bouncycastle:bcpkix-jdk15on' import org.bouncycastle.openssl.PEMEncryptedKeyPair; import org.bouncycastle.openssl.PEMParser; import org.bouncycastle.openssl.PEMDecryptorProvider; import org.bouncycastle.openssl.PEMKeyPair; import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; import org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder; // For JcaPEMKeyConverter().setProvider("BC") Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); // Using bcpkix-jdk14-1.48 PEMParser pemParser = new PEMParser(new FileReader(file)); Object object = pemParser.readObject(); JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider("BC"); KeyPair kp; if (object instanceof PEMEncryptedKeyPair) { // Encrypted key - we will use provided password PEMEncryptedKeyPair ckp = (PEMEncryptedKeyPair) object; PEMDecryptorProvider decProv = new JcePEMDecryptorProviderBuilder().build(password.toCharArray()); kp = converter.getKeyPair(ckp.decryptKeyPair(decProv)); } else { // Unencrypted key - no password needed PEMKeyPair ukp = (PEMKeyPair) object; kp = converter.getKeyPair(ukp); } // RSA KeyFactory keyFac = KeyFactory.getInstance("RSA"); RSAPrivateCrtKeySpec privateKey = keyFac.getKeySpec(kp.getPrivate(), RSAPrivateCrtKeySpec.class); return privateKey; And then you can call for example : privateKey.getModulus();
has comment: http://stackoverflow.com/comment/71160501

http://stackoverflow.com/comment/34787952
comment on: http://stackoverflow.com/a/22810351
has text: Well, then I suppose you have some other problem with either your application or server itself. Are you able to access some part of your application or it doesn't even deploy successfully?
type: AnswerComment
score: 0
type: Comment

gson
tags question: http://stackoverflow.com/q/22895065
tags question: http://stackoverflow.com/q/22954110
tags question: http://stackoverflow.com/q/22939266
tags question: http://stackoverflow.com/q/22827546
tags question: http://stackoverflow.com/q/22831578
tags question: http://stackoverflow.com/q/22963859
tag name: gson
tags question: http://stackoverflow.com/q/22818973
tags question: http://stackoverflow.com/q/22816326
tags question: http://stackoverflow.com/q/22944556
tags question: http://stackoverflow.com/q/22829633
tags question: http://stackoverflow.com/q/22813214
tags question: http://stackoverflow.com/q/22821145
tags question: http://stackoverflow.com/q/22953533
tags question: http://stackoverflow.com/q/22841306
type: Tag

http://stackoverflow.com/a/22928031
downvote count: 0
score: 6
type: Answer
upvote count: 6
has body: You could use System.format(): System.out.format("Equation is: %dx %+dy %+dz %+d = 0\n", aa, bb, cc, gg); ^ ^ ^ Specifying the + flag would include the sign whether positive or negative. You can find more information about formatting numeric output here.
accepted answer of: http://stackoverflow.com/q/22927920
answers question: http://stackoverflow.com/q/22927920
type: AcceptedAnswer

http://stackoverflow.com/comment/34870633
type: Comment
comment on: http://stackoverflow.com/a/22844408
score: 0
type: AnswerComment
has text: Thanks for that. May I ask you why I have such a `NullPointerException` (in my first example)? There is no useful information provided. I cannot even catch this Exception (I tried but failed).

http://stackoverflow.com/comment/34982048
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22904665
has text: I could, but I wondered why LiteDeviceDelegatingViewResolver wouldn't support such a basic thing about View Resolution in Spring. Thought I would ask around and see if there's another way Spring could prioritize View Resolvers, but so far yeah extending seems to be the way to go. Thanks.
score: 0

http://stackoverflow.com/a/22841388
type: Answer
has body: Using Jsoup: String firstT1 = Jsoup.parse(xml).getElementsByTag("t1").first().outerHtml();
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34841888
has comment: http://stackoverflow.com/comment/34841814
has comment: http://stackoverflow.com/comment/34841993
answers question: http://stackoverflow.com/q/22841175
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22841175

http://stackoverflow.com/q/22851085
upvote count: 1
tagged with: android
has answer: http://stackoverflow.com/a/22851136
tagged with: sqlite
favorite count: 0
downvote count: 0
has title: Android: Prevent EditText in Alert from being blank
tagged with: android-alertdialog
has comment: http://stackoverflow.com/comment/34860318
type: AnsweredQuestion
tagged with: android-edittext
score: 1
tagged with: java
type: Question
answer count: 2
has body: I currently have an alert dialog with an editText. The idea is that a person will enter their pin and if the pin is correct with the one in the database do something, however if it is blank it crashes the program. So I need some help to prevent the user from leaving the EditText blank. I have my current alert code: AlertDialog alert = new AlertDialog.Builder(MainActivity.this).create(); alert.setTitle("Welcome!"); alert.setMessage("Please select on of the following options:"); // Set an EditText view to get user input final EditText input = new EditText(this); alert.setView(input); pindb = pin; statuses = status; lockerNumbers = lockerNumber; if (statuses != 0) { input.setInputType(InputType.TYPE_CLASS_NUMBER); alert.setMessage("Enter your pin"); InputFilter[] FilterArray = new InputFilter[1]; FilterArray[0] = new InputFilter.LengthFilter(4); input.setFilters(FilterArray); alert.setButton("Leave", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub String value = input.getText().toString(); // Do something with value! pins = Integer.parseInt(value); if (pins != pindb) { Toast.makeText(MainActivity.this, "wrong", Toast.LENGTH_LONG).show(); } else { Toast.makeText(MainActivity.this, "correct", Toast.LENGTH_LONG).show(); ourDb.open(); ourDb.removePin(lockerNumbers, pins, 0); ourDb.close(); } loadListView(); } }); alert.setButton2("Access", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub String value = input.getText().toString(); // Do something with value! pins = Integer.parseInt(value); if (pins != pindb) { Toast.makeText(MainActivity.this, "wrong", Toast.LENGTH_LONG).show(); } else { Toast.makeText(MainActivity.this, "correct", Toast.LENGTH_LONG).show(); } } }); } else { input.setInputType(InputType.TYPE_CLASS_NUMBER); alert.setMessage("Enter a new 4 digit pin"); alert.setButton3("Ok", …
has answer: http://stackoverflow.com/a/22851489
accepted answer: http://stackoverflow.com/a/22851489
possible better answer: http://stackoverflow.com/a/22851136

http://stackoverflow.com/comment/34952897
type: AnswerComment
score: 0
type: Comment
has text: NQueens nq = new NQueens(); nq.count(n); at count(int) method doesn't take n as input
comment on: http://stackoverflow.com/a/22902397

http://stackoverflow.com/comment/34872807
comment on: http://stackoverflow.com/q/22858329
score: 0
has text: I want to set the background color of a layout element. In my case I want to set the color "WHITE" to the FrameLayout's background. The FrameLayout is in a LinearLayout as shown above. After calling the Java code, the FrameLayout is painted in grey and not in white. How cand I be more specific?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34799423
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22815568
has text: Semantics. What I am saying is that if you take an array of 6 null objects (which is what I was trying to say - call it `newArray`) and assign it to `array`, that is what the OP wants to do. Not iterate and create 2147483647 `Object`s
score: 0

http://stackoverflow.com/comment/35067630
comment on: http://stackoverflow.com/q/22965667
score: 0
type: Comment
type: QuestionComment
has text: It's not programming related, it seems a problem of the router configuration. It would be a better fit for Server Fault.

http://stackoverflow.com/a/22944125
has body: To avoid the UI blocking, you have to put long-running tasks into a separated thread. BUTTON.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { new Thread(new Runnable() { @Override public void run() { MAINFRAME.DOWNLOAD(); } }).start(); } catch (Exception e1) { e1.printStackTrace(); } } }); You can also use a SwingWorker. Here is an answered question about it.
accepted answer of: http://stackoverflow.com/q/22943928
type: Answer
answers question: http://stackoverflow.com/q/22943928
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34822680
type: AnswerComment
comment on: http://stackoverflow.com/a/22830454
type: Comment
has text: But when applet is executed the details wont be stored...Any idea how to store details ??
score: 0

http://stackoverflow.com/q/22872627
upvote count: 2
has answer: http://stackoverflow.com/a/22873187
tagged with: set
has comment: http://stackoverflow.com/comment/34898995
has comment: http://stackoverflow.com/comment/34898748
type: Question
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/34898949
possible better answer: http://stackoverflow.com/a/22873187
downvote count: 0
has comment: http://stackoverflow.com/comment/34898806
favorite count: 0
has answer: http://stackoverflow.com/a/22872679
has answer: http://stackoverflow.com/a/22872973
has comment: http://stackoverflow.com/comment/34899357
accepted answer: http://stackoverflow.com/a/22872973
has comment: http://stackoverflow.com/comment/34898779
has comment: http://stackoverflow.com/comment/34899727
has body: I already have a List&lt;T&gt;, which may or may not contain duplicates. I am going to build a Set&lt;String&gt; based on some result of computation using them, because two different Ts can produce the same String under some circumstances. Some of the elements in the List&lt;T&gt; have undesirable attributes, so I need to filter them out. I filter like this: List&lt;T&gt; myList = myCoolListGetter(); Iterator&lt;T&gt; it = myList.iterator(); T curr; while (it.hasNext()) { curr = it.next(); if (curr.shouldNotBeInResult()) { myList.remove(curr); } } I then pass this List&lt;T&gt; to another method which performs those computations I mentioned, adding them to a Set&lt;String&gt;. I'm thinking perhaps I could save some time by inserting the elements which should be in the result rather into a Set&lt;T&gt; rather than removing them from the List&lt;T&gt;. Since I am already iterating over the List&lt;T&gt; here, and have to construct a Set&lt;String&gt; later anyway, would I actually be saving time by doing that?
linked to: http://stackoverflow.com/q/504103
has comment: http://stackoverflow.com/comment/35025280
has title: What's faster, creating a Set or removing from a List?
score: 2
type: AnsweredQuestion
tagged with: list

http://stackoverflow.com/comment/81471427
type: Comment
comment on: http://stackoverflow.com/a/25540353
has text: They are limited for a reason. A generic 8-params function with 8 generic parameters is almost guaranteed to confuse whoever runs into that code.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35025030
comment on: http://stackoverflow.com/a/22942558
score: 0
type: AnswerComment
has text: It was already set, but in the same screen I clicked the reindex button and worked. Thanks.
type: Comment

http://stackoverflow.com/q/22934713
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22935306
has comment: http://stackoverflow.com/comment/35010708
has answer: http://stackoverflow.com/a/22934920
has title: Compare two time stamp in custom class list android
has body: I want to compare two time stamps using comparator, ex.. i need to compare this two time 08:30 AM and 11:00 PM in my object list for sorting objects by time. Can anybody please suggest me, how i will do this task. Thanks!
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35010573
type: Question
tagged with: java

http://stackoverflow.com/comment/34939411
comment on: http://stackoverflow.com/q/22895091
score: 0
has text: If OP wants to do then there are lots of ways but OP is looking just for ready made code.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22876902
has comment: http://stackoverflow.com/comment/34911679
type: Answer
has comment: http://stackoverflow.com/comment/34906753
downvote count: 1
has body: You may resolve the problem by using sleep() inside the while loop in run(). while (running == true){ // System.out.println("Running..."+ x); try{Thread.sleep(50);}catch(Exception e){} update(); render(); x = x + 1; } Adding sleep() will allow other threads to work along with your program, therefore not causing your computer to stop responding. Though, I think that sleep() is not very accurate. For accurate timing you may have to use some other method.
answers question: http://stackoverflow.com/q/22876814
score: -1
has comment: http://stackoverflow.com/comment/34910515
upvote count: 0
has comment: http://stackoverflow.com/comment/34906828

http://stackoverflow.com/comment/34864956
has text: 1) Why code an applet? If it is due to spec. by teacher, please refer them to [Why CS teachers should stop teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). 2) Why AWT rather than Swing? See my answer on [Swing extras over AWT](http://stackoverflow.com/a/6255978/418556) for many good reasons to abandon using AWT components.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22831382
score: 0

http://stackoverflow.com/comment/34881489
has text: @Duncan Yeah I use it
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22860812
type: QuestionComment

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/22902624
type: Tag

http://stackoverflow.com/comment/34966428
type: AnswerComment
comment on: http://stackoverflow.com/a/22904509
type: Comment
has text: So in other words, I can ignore the opened connections, because MongoDB will take care of it and will close some of them when needed?
score: 0

http://stackoverflow.com/q/22937109
has comment: http://stackoverflow.com/comment/35017472
tagged with: postgresql
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35014984
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35015284
has comment: http://stackoverflow.com/comment/35016978
has comment: http://stackoverflow.com/comment/35014970
tagged with: spring
has comment: http://stackoverflow.com/comment/35015220
has comment: http://stackoverflow.com/comment/35018875
has answer: http://stackoverflow.com/a/22963875
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35042504
has title: id is autoincremented in database but is not set in the entity in hibernate
has body: I have an id field which is autogenerated: @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="id") private long id; In my entity, I define the sequence generation as: @Entity @SequenceGenerator(name = "sequence", sequenceName = "pes_id_seq") @Table(name = "pes") Now, when I save the entity using: repository.save(entity); And try to get id of the newly inserted row like this: System.out.println(entity.getId()); It always displays 1. However, in database, id(serial field) is incremented as expected.
has comment: http://stackoverflow.com/comment/35042541
type: Question

http://stackoverflow.com/q/22854282
tagged with: variables
has answer: http://stackoverflow.com/a/22854811
tagged with: binary
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34865433
type: Question
tagged with: java
tagged with: eclipse
score: 0
has body: I am writing a code about finding the parent for a specified node (in BST). I wrote it but it doesn't work! I use Eclipse using Java,and i get this error: "parent" cannot be resolved to a variable. i wonder how to solve this problem? (i am kinda new to java, thanks in advance) There is my code: public TreeNode&lt;E&gt; getParent(TreeNode&lt;E&gt; node) { TreeNode&lt;E&gt; parent = null; TreeNode&lt;E&gt; current = root; while (current != null) { if (((Comparable&lt;E&gt;)node).compareTo((E)current) &lt; 0) { parent = current; current = current.left; } else if (((Comparable&lt;E&gt;) node).compareTo((E)current) &gt; 0) { parent = current; current = current.right; } else { break; } } size++; return parent; }
has title: why i got this message[“Variable name” cannot be resolved to a variable]?
answer count: 1

http://stackoverflow.com/a/22866163
accepted answer of: http://stackoverflow.com/q/22866058
has comment: http://stackoverflow.com/comment/34886503
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34886559
has body: It would be easier to divide up your search space among the Threads when you initialize them so you have no overlap. No clunky synchronization needed. Something like this. public class PrimeFinder implements Runnable { private int rangeStart; private int rangeEnd; public PrimeFinder(int start, int end) { rangeStart = start; rangeEnd = end; } public void run() { //check for primes where rangeStart &lt;= x &lt;= rangeEnd } } ... then in main... public static void main(String[] args) { new Thread(new PrimeFinder(0, 25)).start(); new Thread(new PrimeFinder(26, 50)).start(); //and so on } As a side note, synchronized-ing the run method of your Threads is useless. Each Thread gets its own run method, so nothing else ever competes for that particular lock. In response to your comment: If you're forced to do it this way and don't want duplicate numbers added to your list, you can synchronize a wrapper method to add the primes: public static synchronized void addPrime(int prime) { if(!primos.contains(prime)) { primos.add(prime); } } This will ensure that you get no duplicates. Then in your Thread you would have: if(esPrimo(numero)) { addPrime(numero); }
answers question: http://stackoverflow.com/q/22866058
has comment: http://stackoverflow.com/comment/34886628
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/22962879
has comment: http://stackoverflow.com/comment/35075470
type: Answer
has comment: http://stackoverflow.com/comment/35076744
has comment: http://stackoverflow.com/comment/35076512
has body: You've instantiated your driver, now you just need to have the entry point. First you need to navigate to the URL to test. In your @Before method (or in your individual tests), you need: driver.get(baseUrl); // or driver.navigate().to(baseUrl); To use Chrome, simply change your instantiation to: driver = new ChromeDriver(); As you hadn't really elaborated on if you are receiving errors, if you DO receive an error mentioning something about chromedriver must be set by webdriver.chrome.driver then you need to set some environment variables, or pass in the variables through your run configuration. -Dwebdriver.chrome.driver=/absolute/path/to/chromedriver
answers question: http://stackoverflow.com/q/22962721
score: 0

http://stackoverflow.com/comment/34871862
comment on: http://stackoverflow.com/a/22848975
type: AnswerComment
score: 0
has text: If you try to poll when it's empty you'll get a null object. See my edited question for an example.
type: Comment

http://stackoverflow.com/comment/34800589
score: 0
comment on: http://stackoverflow.com/q/22817730
type: Comment
type: QuestionComment
has text: @user3270407 the only way to tell if your code is being JIT'ed is to profile it with a profiler like JProfiler or jvisualvm (free and included with oracle jdk). The JVM is incredibly smart and has arguably the best optimizing compiler built in. It may realize your code is simple and short, and not attempt any further optimizations... only a profile will tell.

http://stackoverflow.com/a/22930648
downvote count: 0
type: Answer
has body: You can pass one parameter as context, like this public static void show (Context context){ Toast.makeText(context, "testing toast", Toast.LENGTH_LONG).show(); }
answers question: http://stackoverflow.com/q/22930503
upvote count: 2
score: 2

parcelable
tags question: http://stackoverflow.com/q/22952654
tags question: http://stackoverflow.com/q/22926054
type: Tag
tag name: parcelable

http://stackoverflow.com/q/22852347
score: 0
answer count: 1
has title: NumberFormatException mistake
has comment: http://stackoverflow.com/comment/34862252
has comment: http://stackoverflow.com/comment/34862126
has comment: http://stackoverflow.com/comment/34862182
tagged with: java
type: UnansweredQuestion
has body: So I am trying to calculate the average for data in a set. Here is what I have int total = 0; for(int i = 1; i &lt; field.length; i++) { total += Integer.parseInt(field[i]); } double avg = (double)total/(field.length-1); System.out.println("average score: " + avg); The data is like 2007,Alabama,252 2008,Alabama,232 2004,Alabama,172 for example I want to calculate (252+172+232)/3 and I get that error Help please
has comment: http://stackoverflow.com/comment/34862199
has answer: http://stackoverflow.com/a/22852402
has comment: http://stackoverflow.com/comment/34862423
type: Question
has comment: http://stackoverflow.com/comment/34862257
has comment: http://stackoverflow.com/comment/34862287

lombok
type: Tag
tags question: http://stackoverflow.com/q/22942608
tag name: lombok

http://stackoverflow.com/comment/34937902
comment on: http://stackoverflow.com/a/22894371
score: 0
type: AnswerComment
type: Comment
has text: i dont understand it though, I have an ImageButton on my "Playlist.xml", and when I click it, i want it to open "about.xml" :s I dont understand what you explained sorry v.v

http://stackoverflow.com/comment/35260015
comment on: http://stackoverflow.com/a/22952778
score: 0
type: Comment
has text: Sure, feel free to modify the post or post what changes you did her so that I can update the post above. Thanks :)
type: AnswerComment

http://stackoverflow.com/q/22870755
has body: I have a simple flow that reads from an activemq1 and parses an id from the message and sends the id across to another activemq2. Here is an example of message that gets written to activemq1: <Customer> 123 <Customer> I need to parse out the id from the above message body and send the below message to activemq2: "Order with id{123} has been queued" This is the flow that I cameup with, but it writes the complete request xml to the queue, but not the message that I am looking for: <from uri="jms:queue:Q.activemq1"/> "/Customer/Order/id/@value/text()" <to uri="jms:queue:Q.activemq2"/> Anything wrong in the above or any corrections
score: 3
tagged with: java
tagged with: apache-camel
type: Question
answer count: 1
tagged with: jms
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/22871292
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has title: Camel..using xpath to parse xml in message body
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34909434
comment on: http://stackoverflow.com/q/22878501
score: 1
type: Comment
has text: You don't really need `lastIndex`.
type: QuestionComment

http://stackoverflow.com/a/22833283
upvote count: 2
has comment: http://stackoverflow.com/comment/34828681
score: 2
has body: If you don't want to allow ]] before the first |, you can use a negative lookahead assertion to achieve this: \[\[((?:(?!]])[^|\r\n])*)\|.*?]] Explanation: \[\[ # Match ( # Match and capture in group 1... (?: # (Start of non-capturing group) (?!) # ... (unless the text "]]" is directly ahead) [^|\r\n] # ... any character except pipes or newlines )* # repeat as necessary (lazy evaluation is not needed here) ) # End of capturing group \| # Match a pipe .*? # and any number of characters until ]] # the next instance of ]] See it live on regex101.com.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22832935
type: Answer
answers question: http://stackoverflow.com/q/22832935

http://stackoverflow.com/comment/34909870
comment on: http://stackoverflow.com/a/22876455
has text: @KorayTugay - your example assumes these are not Strings, but some other kind of object - something that has a "name" property. In that case, you'll get "Nexus44", because two references to the same object appear in the lists (one reference in each list), and you've changed the name of that one object that both references refer to.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34964432
comment on: http://stackoverflow.com/q/22909261
has text: okay sure, let me edit it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22949622
has comment: http://stackoverflow.com/comment/35038412
has body: for(int i=0; i&lt; strings.length;i++){ // Pick a string for(int j=i+1; j&lt;strings.length;j++){ // Loop on all strings starting from i+1 if(strings[i].equals(strings[j])) // check if the two strings are equal System.out.println("The two strings are the same"); // SOP } } }
has comment: http://stackoverflow.com/comment/35038250
has comment: http://stackoverflow.com/comment/35038326
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/35038441
answers question: http://stackoverflow.com/q/22949576
has comment: http://stackoverflow.com/comment/35037813
upvote count: 1

http://stackoverflow.com/comment/34941134
type: AnswerComment
comment on: http://stackoverflow.com/a/22896062
score: 0
type: Comment
has text: @Mik378 You're right. Copy/paste errors, the bane of coders everywhere! Edited.

http://stackoverflow.com/q/22923813
has body: I am working on internationalizing the database. My task is internationalize database fields with least amount of changes possible. My question is- how can I set properties to a thread from controller method and access that property from my aspect. System.setProperties() is obviously not thread safe. class Title { ... private String description; ... } @Entity Class Language { ... private String name; ... public static String fingLanguageByName(String name) { ... return l; } } @Entity Class InternationalizedTitle { ... private Title title; private String description; private Language language; ... public static String findDescriptionByTitleAndDate(Title t, Language l) { ... return d; } ... } @Controller class TitleController { ... public TitleResponse getTitle(HttpServletRequest request, HttpServletResponse response) { if (request.isComingFromFrance()){ ***System.setProperty("language", "French");*** } return titleService.getTitleResponse(request); } ... } @Aspect InternationalizationAspect { ... @Around("execution(* com.*.*.*.Title.getDescription(..))") public String getInternationalizedTitleDescription(ProceedingJoinPoint joinPoint) throws Throwable { ***String language = System.getProperty("language");*** if (language == null) { return joinPoint.proceed(); } else { Title t = (Title) joinPoint.getTarget(); return InternationalizedTitle.findDescriptionByTitleAndDate(t,Language.findLanguageByName(name)) } } ... }
tagged with: aop
tagged with: aspectj
answer count: 1
has answer: http://stackoverflow.com/a/22924658
tagged with: spring
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: thread-safety
has title: set "systems" property in controller and access that in an aspect
type: Question
accepted answer: http://stackoverflow.com/a/22924658

http://stackoverflow.com/a/22955590
has comment: http://stackoverflow.com/comment/35048335
has comment: http://stackoverflow.com/comment/35048362
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22955543
has comment: http://stackoverflow.com/comment/35048432
has comment: http://stackoverflow.com/comment/35048236
has comment: http://stackoverflow.com/comment/35048568
accepted answer of: http://stackoverflow.com/q/22955543
has comment: http://stackoverflow.com/comment/35047978
has body: Yes, public methods are inherited, so CustomManu1 and CustomManu2 will inherit the @Bean annotated method car(). and let spring create 2 Beans of type Car here? This depends how you load your @Configuration classes.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35048193
has comment: http://stackoverflow.com/comment/35048011

http://stackoverflow.com/comment/35059383
type: QuestionComment
score: 0
has text: Where do you actually convert it? The parsing works fine for me, prints the correct date (`Tue Apr 15 00:00:00 CEST 2014`). After adding `System.out.println(tr.format(d1));` in your try-catch it prints the correct result: `2014-04-15`.
comment on: http://stackoverflow.com/q/22961939
type: Comment

http://stackoverflow.com/comment/140015672
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/39666237
has text: Works like a charm with PostgreSQL 17. @pstobiecki maybe you could try using testcontainers instead of H2, if you have that problem only with your tests.

http://stackoverflow.com/comment/35039940
type: Comment
comment on: http://stackoverflow.com/q/22950778
score: 0
has text: Ohhh thanks! It printed the file this time but it wasn't alphabetical how it was when I tested it, any ideas why this might be?
type: QuestionComment

http://stackoverflow.com/a/22862407
score: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22843417
has body: Well, the images to our "eyes" are equal (well not exactly equal as you can see some foggy pixels) but Android internally does lower the image quality making it not match the original image. Therefore the unit test fails.
upvote count: 1
answers question: http://stackoverflow.com/q/22843417
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/22911192
has comment: http://stackoverflow.com/comment/34980416
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35000894
type: Answer
has comment: http://stackoverflow.com/comment/34969956
has comment: http://stackoverflow.com/comment/34970056
has comment: http://stackoverflow.com/comment/34969611
score: 1
has body: The attachment url doesn't seem to be a BLOB. I think it's a string. So just get the string and create a File object. If the file exists, you can copy it to your folder. File files = new File("E:\\Directory1\\" + m_jiraNumber); if (!files.exists()) { if (files.mkdirs()) { System.out.println("Multiple directories are created!"); if (files.exists()) { System.out.println("Directory exists"); if (files.canWrite()) { String attachment = resultSet.getString("attachment_url").replace("\\", File.separator); Path sourcePath = Paths.get(attachment); Path destPath = Paths.get(files.getAbsolutePath() + File.separator + sourcePath.getFileName().toString()); Files.copy(sourcePath, destPath); } else { System.out.println("Access denied !!!"); } } } else { System.out.println("Failed to create multiple directories!"); } }
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22910949
has comment: http://stackoverflow.com/comment/34970035
answers question: http://stackoverflow.com/q/22910949

http://stackoverflow.com/comment/42992051
score: 0
type: Comment
has text: @nosid Thank you for your correction. When I use code completion in Eclipse it (and toInstance) isn't present as an option. But if I type it in full it seems to be accepted. I had wrongly concluded it wasn't a method because of this fact and that I didn't see it on the Javadoc for ZonedDateTime, as it is listed as an inherited method, as you say. Sorry, please accept an upclick :)
comment on: http://stackoverflow.com/a/22929435
type: AnswerComment

http://stackoverflow.com/comment/35021133
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22938813
score: 0
has text: @Phylogenesis yes that is correct, my application does some complex calculations but it all comes down to a function (double, double) - >double

http://stackoverflow.com/comment/34998856
score: 0
has text: I want to process the data further. The protocol that I follow uses mixed text and binary data.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22927817

http://stackoverflow.com/comment/104296738
comment on: http://stackoverflow.com/q/22855195
type: QuestionComment
has text: am also facing the same issue. I couldn't find a solution for this
score: 0
type: Comment

http://stackoverflow.com/comment/34969451
score: 1
has text: Of course multiple threads can call memcpy simultaneously to write to the same destination, but the disastrous results are not the fault of memcpy, but the result of the caller doing something stupid. On the other hand, strtok is _not_ thread safe, even when two callers do completely unrelated things. And that is caused by the design of the interface, so it is _inherently_ not thread safe.
type: AnswerComment
comment on: http://stackoverflow.com/a/22908629
type: Comment

http://stackoverflow.com/q/22945397
has comment: http://stackoverflow.com/comment/35030045
favorite count: 0
has title: Bad Operand Types between 2 classes
possible better answer: http://stackoverflow.com/a/22945442
has comment: http://stackoverflow.com/comment/35031052
has comment: http://stackoverflow.com/comment/35029979
has answer: http://stackoverflow.com/a/22945517
accepted answer: http://stackoverflow.com/a/22945517
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22945497
upvote count: 0
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22945442
has body: I'm trying to code this so it can give me a certain discount based on how many points the client has, when i try to compile, i get the bad operand types error, First type: Purchase second type: Double, i can't understand why it doesn't work, because "price" from the class purchase, is a also a double, if you could help me it would help a lot!! Thanks public void makeAPurchase(Purchase price){ if (points &gt; 2000) price = price - (price * 0.05); } a part of purchase class: public class Purchase{ private double price;
score: -1
has comment: http://stackoverflow.com/comment/35029921
answer count: 3

ant
tags question: http://stackoverflow.com/q/22965338
tags question: http://stackoverflow.com/q/22913723
tags question: http://stackoverflow.com/q/22864675
tags question: http://stackoverflow.com/q/22827037
tags question: http://stackoverflow.com/q/22865579
type: Tag
tags question: http://stackoverflow.com/q/22966538
tags question: http://stackoverflow.com/q/22825452
tags question: http://stackoverflow.com/q/22870664
tags question: http://stackoverflow.com/q/22853882
tag name: ant
tags question: http://stackoverflow.com/q/22951201
tags question: http://stackoverflow.com/q/22950850
tags question: http://stackoverflow.com/q/22859078
tags question: http://stackoverflow.com/q/22923861
tags question: http://stackoverflow.com/q/22842971
tags question: http://stackoverflow.com/q/22890803

http://stackoverflow.com/comment/34998696
score: 0
type: Comment
type: QuestionComment
has text: @jhadesdev To find the leaked loader I take a snapshot before redeploy, redeploy, force a GC and take another snapshot. Then I compare the two snapshots to see which one was present in both snapshots. I replaced the image to show expanded paths, and while doing so got another confusion between "Paths to loader" and "Paths from GC roots"... Please note that solving my problem would be nice, but what I am really looking at is understanding these features and get a generic methodology.
comment on: http://stackoverflow.com/q/22832251

http://stackoverflow.com/comment/34915541
comment on: http://stackoverflow.com/q/22881937
has text: Change the size after you call `.pack()`, then you'll have your fixed size.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/34956355
score: 0
comment on: http://stackoverflow.com/q/22896243
type: QuestionComment
has text: Did you follow installation instructions for slf4j?
type: Comment

http://stackoverflow.com/comment/34964016
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22908963
type: Comment
has text: How will you give MICR input to JAVA ?

http://stackoverflow.com/q/22826334
has comment: http://stackoverflow.com/comment/34815264
accepted answer: http://stackoverflow.com/a/22826508
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22826638
type: Question
has comment: http://stackoverflow.com/comment/34815315
possible better answer: http://stackoverflow.com/a/22826638
has title: Beginner Java loop/array homework
has comment: http://stackoverflow.com/comment/34815210
has comment: http://stackoverflow.com/comment/34815202
has comment: http://stackoverflow.com/comment/34815125
has answer: http://stackoverflow.com/a/22826508
answer count: 2
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/34815122
has body: Hi I have a homework question that needs some clarifications, 1. public int f (int n) { if (n &lt; 0) return 2; else return f (n - 1) + f (n - 3); } what is the value when the recall is f(3) I know that this loops so f(3) = f(2)+2 = f(1)+2+2 = f(0)+2+2+2 = 8 but I'm not sure if Java considers 0 less than 0.
favorite count: 0
has comment: http://stackoverflow.com/comment/34815164
has comment: http://stackoverflow.com/comment/34815128
has comment: http://stackoverflow.com/comment/34815429

http://stackoverflow.com/a/22829167
type: Answer
answers question: http://stackoverflow.com/q/22816817
score: 40
upvote count: 40
has comment: http://stackoverflow.com/comment/34840178
has comment: http://stackoverflow.com/comment/36772925
downvote count: 0
has body: I use JPA 2.1 with Hibernate 4.3 and PostgreSQL 9.3. I have no problems with indexes hibernate-commons-annotations-4.0.4.Final.jar hibernate-core-4.3.1.Final.jar hibernate-jpa-2.1-api-1.0.0.Final.jar jandex-1.1.0.Final.jar javassist-3.18.1-GA.jar jboss-transaction-api_1.2_spec-1.0.0.Final.jar Though my config has &lt;property name="hibernate.hbm2ddl.auto" value="update"/&gt; And that's my entity mapping import javax.persistence.Entity; import javax.persistence.Index; import javax.persistence.Table; @Entity @Table(name = "users", indexes = { @Index(columnList = "id", name = "user_id_hidx"), @Index(columnList = "current_city", name = "cbplayer_current_city_hidx") }) PS. In fact, I have some problems with that annotations. I cannot specify tablespace for index and must create indecies for subclasses in parent class for SINGLE_TABLE hierarchy.

http://stackoverflow.com/q/22961939
duplicate of: http://stackoverflow.com/q/14039062
has answer: http://stackoverflow.com/a/22962061
score: 0
has comment: http://stackoverflow.com/comment/35059209
possible better answer: http://stackoverflow.com/a/22962015
has answer: http://stackoverflow.com/a/22962092
favorite count: 0
has comment: http://stackoverflow.com/comment/35059383
has answer: http://stackoverflow.com/a/22962015
answer count: 5
has answer: http://stackoverflow.com/a/22962028
tagged with: date-format
has comment: http://stackoverflow.com/comment/35059194
tagged with: date-parsing
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22962028
linked to: http://stackoverflow.com/q/14039062
has answer: http://stackoverflow.com/a/22962140
has body: So I have this String: "Tue Apr 15 00:00:00 IDT 2014" or "Apr 15 2014" after I change it by split it. And I want to convert it to this format: "yyyy-MM-dd" but when I i get this message: java.text.ParseException: Unparseable date: "Apr 15 2014" Here is my full code: DateFormat or=new SimpleDateFormat("MMM d yyyy"); DateFormat tr=new SimpleDateFormat("yyyy-MM-dd"); String str="Apr 15 2014"; System.out.println(str); //String strs[]=str.split(" "); //String newDay=strs[1]+" "+strs[2]+" "+strs[5]; //System.out.println(newDay); try { Date d1=or.parse(str); System.out.println(d1); } catch (ParseException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Thanks to helpers :)
tagged with: simpledateformat
has title: How to convert date formats?
tagged with: date

http://stackoverflow.com/a/22876013
has comment: http://stackoverflow.com/comment/34905233
answers question: http://stackoverflow.com/q/22875993
type: Answer
has body: Both those names aren't good: the name of your variable should reflect its contents. I already know it's a variable and I already know it's a list. What is in the list? For example: if it's the bag of puppies I just bought at the pet store: List&lt;Puppy&gt; puppies = new ArrayList&lt;&gt;() Notice how I omitted the type: that is possible since Java 7 and is exactly the same as List&lt;Puppy&gt; puppies = new ArrayList&lt;Puppy&gt;()
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/34961394
has text: I will intorduce in the following an example: "AUTHENTIFICATION" concept is a kind of "VALIDATION" concept and "ENCRYPTION" is kind of "CRYPTOGRAPHY". In this case, I have two domains AUTHENTIFICATION and ENCRYPTION" and two ranges VALIDATION and CRYPTOGRAPHY. Therefore, The OWLObjectProperty:"#kind of" has two domains and two ranges but when I check the .owl file I can't know which range is for which domains.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22899539

http://stackoverflow.com/comment/35012082
type: QuestionComment
has text: Have you tried to enter the absolute path for myDir?
score: 0
comment on: http://stackoverflow.com/q/22935589
type: Comment

http://stackoverflow.com/q/22909160
tagged with: http://stackoverflow.com/tag/xml
has title: What does getTextContent() and item(0) return in Java DOM API?
has answer: http://stackoverflow.com/a/22909447
has body: Please explain the meaning of the following line of the code which is used in reading XML file using java. NodeList lastNameList = firstPersonElement.getElementsByTagName("last"); long NameElement = (long)lastNameList.item(0).getTextContent(); What is the use of getTextContent() and what is item(0)?
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: dom
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/22909427
has answer: http://stackoverflow.com/a/22909542
accepted answer: http://stackoverflow.com/a/22909542
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/22909427

http://stackoverflow.com/a/22903008
has body: try this: // create new buffered reader BufferedReader br = new BufferedReader(new FileReader("file.txt")); // reads and prints BufferedReader System.out.println((char)br.read()); System.out.println((char)br.read()); // mark invoked at this position br.mark(26); System.out.println("mark() invoked"); System.out.println((char)br.read()); System.out.println((char)br.read()); // reset() repositioned the stream to the mark br.reset(); System.out.println("reset() invoked"); System.out.println((char)br.read()); System.out.println((char)br.read());
answers question: http://stackoverflow.com/q/22902904
type: Answer
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22902904

http://stackoverflow.com/a/22957399
has body: Yes. You have no guarantee when the thread will next execute. Just that it will happen sometime after the sleep time Things like the ScheduledExecutorService mitigate this with scheduleAtFixedRate but they still cannot guarantee that it will run exactly at that time. To avoid this you need a Real Time Operating System. However in practice most computers are fast enough that this just isn't an issue unless you are doing something that is incredibly time-critical. The thread will execute within miliseconds of your desired time most of the time.
type: Answer
score: 3
downvote count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/35051094
accepted answer of: http://stackoverflow.com/q/22957338
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22957338

http://stackoverflow.com/q/22965309
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22965416
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/35065314
has answer: http://stackoverflow.com/a/22965426
accepted answer: http://stackoverflow.com/a/22965426
type: Question
has title: Emulate goto in Java
has body: I have code (simplified hypothetical example): public String handleEditRequest(...) { if (isBadArg()) { ... req.getSession().setAttribute("errorMessage", "..."); return "redirect:/product/edit" + id + "/.htm"; } if (isEntityNotInDataBase()) { ... req.getSession().setAttribute("errorMessage", "..."); return "redirect:/error.htm"; } ... return "redirect:/product/show" + id + "/.htm"; } Now I have task to add SLA timing calculation to this code. If I have only one return statement I just wrap method body in: public String handleEditRequest(...) { Timer timer = new Timer().start(); // ... CODE ... slaService.send(timer.stop()); return "redirect:/product/show" + id + "/.htm"; } But error handling code block such solution. There are many possibilities. For example add: timer.stop(); slaService.send(timer); before any return statement. But this lead to code duplication. Or use try {} catch () {} (inspired to me by Emacs Elisp experience): private static class GotoError extends Throwable {} public String handleEditRequest(...) { Timer timer = new Timer().start(); String redirectUrl = "redirect:/product/show" + id + "/.htm"; try { if (isBadArg()) { ... req.getSession().setAttribute("errorMessage", "..."); redirectUrl = "redirect:/product/edit" + id + "/.htm"; throw new GotoError(); } if (isEntityNotInDataBase()) { ... req.getSession().setAttribute("errorMessage", "..."); redirectUrl = "redirect:/error.htm"; throw new GotoError(); } ... } catch (GotoError e) { } slaService.send(timer.stop()); return redirectUrl; } But today I rethink and use do { ... break; ... } while (false); paradigm (after googling I found while (true) {if () {break} .... break;} example, but I hate final break statement!!): public String handleEditRequest(...) { Timer timer = new Timer().start(); String redirectUrl = "redirect:/product/show" + id + "/.htm"; do { if (isBadArg()) { ... req.getSession().setAttribute("errorMessage", "..."); redirectUrl = "redirect:/product/edit" + id + "/.htm"; break; } if (…
possible better answer: http://stackoverflow.com/a/22965416
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35065464

http://stackoverflow.com/q/22816297
answer count: 1
accepted answer: http://stackoverflow.com/a/22817374
has title: Creating Queries From User Input & Known Fields
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22817374
has comment: http://stackoverflow.com/comment/34830182
has comment: http://stackoverflow.com/comment/34828011
has comment: http://stackoverflow.com/comment/34797513
tagged with: lucene
has body: I'm trying to generate a query in Java to search a Lucene index. The records in question have a recordState field so I'm starting my query with the following: BooleanQuery booleanQuery = new BooleanQuery(); booleanQuery.add(new TermQuery(new Term("recordState", "DRAFT")), Occur.MUST); The trouble comes when I want to add a filter supplied by the user. I had tried changing the code to: String userQuery = ""; // This will be whatever the user types in QueryParser queryParser = new QueryParser(Version.LUCENE_29, "", new StandardAnalyzer(Version.LUCENE_29, new HashSet&lt;String&gt;())); BooleanQuery booleanQuery = new BooleanQuery(); booleanQuery.add(new TermQuery(new Term("recordState", "DRAFT")), Occur.MUST); booleanQuery.add(queryParser.parse(userQuery), Occur.MUST); If the user enters record_id:123 as their query, the query I end up with will be +recordState:DRAFT +record_id:123 - great. If the user enters +record_id:123, the final query is +recordState:DRAFT +(+record_id:123) - not ideal but it works. But if a user enters -record_id:123, the final query is +recordState:DRAFT +(-record_id:123) which looks invalid &amp; doesn't make much sense! Is there a better way to combine the two query parts? I can't append the user's query as plain text as if they don't start the character with +/-, the query would end up as +recordState:DRAFT record_id:123 (record state = draft or record ID). I'm thinking the only thing I can do is to test if the user query only contains one term &amp; if so, remove any preceeding +/-. But I would like to do this without any String manipulation &amp; sticking to the Lucene API.
score: 0

http://stackoverflow.com/a/22938825
upvote count: 2
answers question: http://stackoverflow.com/q/22938700
downvote count: 0
has body: It is correct that it does not know which constructor to pick, your call is: Route(String, null, UserType) This can surely not refer to the top two constructors. It can however refer to Route(String, UserType), as the null could be of type UserType. It could also refer to Route(String, String, UserType), as the null could be of type String. There is your conflict.
type: Answer
score: 2

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/22817343
type: Tag

http://stackoverflow.com/comment/34945421
type: Comment
has text: Thanks! i just checked online how its done! but thanks again!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22898270

http://stackoverflow.com/comment/35045472
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22954175
type: Comment
has text: Thanks for suggestion. But suppose if I don't need any POJO in my use case. I just need to extract only that `highDepth` value - How would I do that then?

http://stackoverflow.com/comment/34912288
score: 0
type: Comment
has text: please suggest i am really new in web service . i understand fetch web service now i want insert data in web service
comment on: http://stackoverflow.com/a/22880215
type: AnswerComment

http://stackoverflow.com/q/22877830
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23040650
has comment: http://stackoverflow.com/comment/35107966
tagged with: codenameone
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23040650
favorite count: 0
type: AnsweredQuestion
tagged with: netbeans
tagged with: javafx
upvote count: 1
tagged with: swing
has title: javafxpackager installs applications one on top of the other on Windows
has comment: http://stackoverflow.com/comment/35108664
has body: I've used the NetBeans tool to wrap Swing applications with a native installer. However, all applications seem to install to the same destination folder on Windows and it isn't clear to me where to configure this. I'm assuming the installer accepts a universal unique identifier for potential upgrades to the application that might change its name and that identifier is identical between both installers. I can't seem to find where such an identifier is defined though?
type: Question

http://stackoverflow.com/comment/34794608
type: Comment
score: 1
type: AnswerComment
has text: You really should elaborate on how to do each of these binary searches in the answer itself.
comment on: http://stackoverflow.com/a/22814864

http://stackoverflow.com/a/22896584
accepted answer of: http://stackoverflow.com/q/22896441
downvote count: 0
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has body: In your main, you have writer1 = new PoplFormative(1); which invokes the constructor public PoplFormative(int writer) { this.writerId = writer; if (writerId == 1) { this.otherWriter = PoplFormative.writer7; } else if (writerId == 7) { this.otherWriter = PoplFormative.writer1; } else { System.out.println("Big nasty error occurred"); while (true) { } } } in which case, this code is executed if (writerId == 1) { this.otherWriter = PoplFormative.writer7; } but PoplFormative.writer7 is null, as it hasn't been initialized yet, so otherWriter also becomes null. If you need these circular references, consider using setters.
answers question: http://stackoverflow.com/q/22896441

http://stackoverflow.com/q/22882584
tagged with: database
score: 0
has comment: http://stackoverflow.com/comment/34917414
answer count: 1
has body: We have two identical database (say A and B), and wonder if its possible to use liquibase to migrate selective data from A to B. A is a read/write database and B is read-only. We have written a system where users make changes to A and then 'copy' only selective changes made to B. I was wondering if it was possible/good idea to use liquibase to do this. The idea is to either; Insert new records in B if they don't exist and Update records if they do Delete all the data in all the tables in B and repopulate them with the ones from A We already use liquibase to manage database changes to our database structure. Thanks, Jack.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22914840
has title: using liquibase to migrate data
tagged with: java
tagged with: liquibase
has comment: http://stackoverflow.com/comment/34984678
type: Question

http://stackoverflow.com/q/22810921
tagged with: java-8
has answer: http://stackoverflow.com/a/22811053
upvote count: 13
type: AnsweredQuestion
tagged with: default-method
has answer: http://stackoverflow.com/a/22811057
tagged with: java
has comment: http://stackoverflow.com/comment/34787049
has comment: http://stackoverflow.com/comment/34787024
type: Question
has title: is there a way to add a default constructor to an interface
accepted answer: http://stackoverflow.com/a/22811100
downvote count: 0
has comment: http://stackoverflow.com/comment/34787110
favorite count: 0
has comment: http://stackoverflow.com/comment/34787056
has body: With default methods now added to Java 8, is there any way to create a default constructor? I've tried: public interface KadContent&lt;T&gt; { public default KadContent() { } ... Getting the error &lt;identifier&gt; expected from Netbeans Why Needed? I'm using Gson to serialize the objects and getting the "unable to invoke no-args constructor .." error and I do know that I can resolve this problem using Gson's InstanceCreator. But is there a way to create a default Constructor? Update I've found the problem with my own code. I was using gson.fromJson(new String(data), InterfaceName.class); instead of gson.fromJson(new String(data), ClassName.class); So even though the subclass had default constructors, the deserialization code was incorrect. But the question of default constructor still stands.
answer count: 5
has comment: http://stackoverflow.com/comment/104241655
has comment: http://stackoverflow.com/comment/34786993
has answer: http://stackoverflow.com/a/22811204
tagged with: generics
has answer: http://stackoverflow.com/a/53767809
has comment: http://stackoverflow.com/comment/104241726
score: 13
has answer: http://stackoverflow.com/a/22811100
possible better answer: http://stackoverflow.com/a/22811053

http://stackoverflow.com/q/22949664
has title: I cant view a BufferedImage image on a JPanel
type: UnansweredQuestion
upvote count: 1
has body: I am having a problem with the code below. If I load the image directly into the JPanel I can see it. But when I try to draw it first to the BufferedImage before drawing the BufferedImage on the JPanel the image is not visible. What am I doing wrong? import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import javax.swing.JFrame; import java.awt.*; import javax.swing.JPanel; /** * * @author Duafeb */ public class RTester { BufferedImage backBuffer; Graphics2D g2; Pane pain; Image img; public RTester(){ JFrame frame=new JFrame("Sprite Tester"); frame.setSize(1200, 700); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); backBuffer= new BufferedImage(1200,700,BufferedImage.TYPE_INT_RGB); g2=backBuffer.createGraphics(); pain=new Pane(); frame.add(pain); Toolkit tk=Toolkit.getDefaultToolkit(); img=tk.getImage(this.getClass().getResource("running.png")); frame.setVisible(true); } public class Pane extends JPanel{ @Override public void paintComponent(Graphics g){ Graphics2D g3=(Graphics2D)g; g3.drawImage(backBuffer, 0, 0, this); } } public void display(){ g2.setColor(Color.yellow); g2.fillRect(0, 0, pain.getWidth(), pain.getHeight()); g2.drawImage(img, 0, 0, pain); pain.repaint(); } public static void main(String[] args){ RTester test=new RTester(); test.display(); } }
tagged with: swing
tagged with: bufferedimage
type: Question
has comment: http://stackoverflow.com/comment/35039534
score: 1
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/22950724
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35039741

http://stackoverflow.com/comment/34805157
has text: what does `randomize ArrayList.add` mean?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22820743

http://stackoverflow.com/comment/34876329
score: 0
type: Comment
type: QuestionComment
has text: so rather than writing 10000 I should just try 10000.0 this is it @devnull ?
comment on: http://stackoverflow.com/q/22860598

aop
tags question: http://stackoverflow.com/q/22961244
tags question: http://stackoverflow.com/q/22862310
tags question: http://stackoverflow.com/q/22907538
tags question: http://stackoverflow.com/q/22848738
tags question: http://stackoverflow.com/q/22923813
tag name: aop
tags question: http://stackoverflow.com/q/22852657
tags question: http://stackoverflow.com/q/22851919
type: Tag
tags question: http://stackoverflow.com/q/22826526
tags question: http://stackoverflow.com/q/22830516

http://stackoverflow.com/a/29463487
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22921933
has body: Too late answer. But I've found you need org.apache.commons.lang3.text.translate.JavaUnicodeEscaper class instead UnicodeEscaper. Using it, it prints: Unicode surrogate here-&gt; \uD83D\uDCF1&lt;--here And the unescaping works well.

http://stackoverflow.com/q/22907483
has answer: http://stackoverflow.com/a/22916449
answer count: 2
has comment: http://stackoverflow.com/comment/35170422
has title: Liquibase execution order of changeset files when using includeAll with classpath*:
downvote count: 0
has answer: http://stackoverflow.com/a/22984944
favorite count: 0
has comment: http://stackoverflow.com/comment/35077764
type: UnansweredQuestion
tagged with: spring
score: 3
upvote count: 3
tagged with: java
tagged with: liquibase
has body: I am using liquibase (3.1.1) in a spring environment (3.2.x) and load the changesets via the inlcudeAll tag in a master file. There I use the "classpath*:/package/to/changesets" as path. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"&gt; &lt;includeAll path="classpath*:/package/to/changesets"/&gt;... I use a naming strategy like "nnn_changesetname.xml" to keep ordering. But when I look into the changeset table this ordering via the filenames are not kept. Is this only working, if the changeset files are contained in a directory and not on the classpath? Update Hi, I found out that the below suggested solution is not enough. I think it lies in the implementation how liquibase resolves the includAll attribute. In my case it first resolves all "folders" and then looks into each folder for changeset xmls. This will break the ordering of the xml files in all classpath*:/changes locations, because there are now several "changes" folders in different locations. What I would suspect in such a case is a merge of all contents of this "virtual" classpath folders and loading of all resources in one enumeration. Or we could allow some resouce pattern in the inlcudeAll tag like resources="classpath*:/changes/*.xml" to directly select all needed files (tried it out with the path attribute, but did not work, because it checks for a folder)? Update I made a hack to check if the ordering in the returned enumeration is preserved with the anwser from below. To achive this I checked for the given package name and if it matches my pattern I added an additional "*.xml" to it. With this extension I get all changeset as needed. @Override public Enumeration&lt;URL&gt; getResources(String packageName) throws IOException { if(packageName.equal…
type: Question
has comment: http://stackoverflow.com/comment/35192012
has comment: http://stackoverflow.com/comment/35062654

http://stackoverflow.com/comment/34979487
type: QuestionComment
comment on: http://stackoverflow.com/q/22917486
score: 1
has text: I'm pretty sure even the loopback adapter will respond to a network down event caused by the network adapter being disabled, or the wire being pulled from the card. Even though your not physically going out over the network, the adapters still have to respond to catastrophic events. Have you tried setting the connection up using named pipes? jdbc:jtds:sqlserver://localhost/dbname;networkProtocol=namedpipes
type: Comment

http://stackoverflow.com/q/22902696
linked to: http://stackoverflow.com/q/590747
upvote count: 2
downvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34953128
has comment: http://stackoverflow.com/comment/34953127
tagged with: java
has answer: http://stackoverflow.com/a/22902782
type: Question
accepted answer: http://stackoverflow.com/a/22902782
has comment: http://stackoverflow.com/comment/34953162
has body: I got this String s="&lt;tr&gt;&lt;td&gt;Myval"; I want to replace all Strings that is before "&lt;td&gt;" &amp; include "&lt;td&gt;" to ""; s=replaceAll("*.&lt;td&gt;",s); So the result should be s="Myval" But it got Runtime error. 12:39:31.035 [ERROR] Uncaught exception escaped java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0 *.&lt;td&gt; How to fix?
has comment: http://stackoverflow.com/comment/34953109
score: 0
has comment: http://stackoverflow.com/comment/34953191
answer count: 1
has title: Why replaceAll("*. "," Myval"); got error?
favorite count: 0

http://stackoverflow.com/comment/34953526
comment on: http://stackoverflow.com/a/22902893
type: Comment
has text: @javaaaaaa "I'm supposed to print these variables i pass to printwriter using a toString method"; if it's in a super-class somehow then call `super.toString(pw);` or similar.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34983294
type: QuestionComment
has text: If you really want help you'll update your post to show the ***unredacted*** stack trace showing the real class name that wasn't found, and tell us the library and version you're using.
comment on: http://stackoverflow.com/q/22919206
score: 0
type: Comment

http://stackoverflow.com/q/22917358
has title: String split with delimiter as *** in Java
has answer: http://stackoverflow.com/a/22917384
has answer: http://stackoverflow.com/a/22917460
has answer: http://stackoverflow.com/a/22917420
tagged with: spring
answer count: 4
type: UnansweredQuestion
score: 0
type: Question
tagged with: java
has body: public class TestStringSplit { public static void main(String[] args) { String bal = "IND|TEST|***|Cricket|***"; String[] patterns = org.springframework.util.StringUtils.split(bal, "***"); System.out.println("SPRING Framework String Split"); for (String pt : patterns) { System.out.println("Pattern " + pt); } System.out.println("************************"); patterns = org.apache.commons.lang.StringUtils.split(bal, "***"); System.out.println("Apache Commons Lang String Split"); for (String pt : patterns) { System.out.println("Pattern " + pt); } System.out.println("************************"); patterns = bal.split("***"); System.out.println("JDK String Split"); for (String pt : patterns) { System.out.println("Pattern " + pt); } } } Result for the above is SPRING Framework String Split Pattern IND|TEST| Pattern |Cricket|*** Apache Commons Lang String Split Pattern IND|TEST| Pattern |Cricket| Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0 *** ^ Why is that the default JDK doesnt give me the required result but rather the exception..and what should be the pattern for getting the values Regards
has answer: http://stackoverflow.com/a/22917445
tagged with: string

http://stackoverflow.com/comment/34917589
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22882887
has text: okkey fine, thanks for the right direction. :)
score: 0

http://stackoverflow.com/comment/34900547
has text: They using GSON and JSR 353.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22873521

http://stackoverflow.com/comment/35007946
type: QuestionComment
has text: You could always throw the exception further by putting `throw t;` in your catch clause. Alternatively you could save the information that an exception or error occurred, say in a boolean. Or am I missing the point?
score: 0
comment on: http://stackoverflow.com/q/22933218
type: Comment

http://stackoverflow.com/comment/34869663
type: Comment
has text: issue must be in rest of your code
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22856643

http://stackoverflow.com/comment/34951467
type: QuestionComment
has text: True, but OP hasn't shown us how the queue is being created. Presumably though, they are not providing a `Comparator` - otherwise they would have shown it here. So I take back my remarks. This `compareTo` is what matters.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22901322

http://stackoverflow.com/q/22905514
linked to: http://stackoverflow.com/q/17462706
has title: MySQL Workbench 6.0 error could not acquire managemant access for the administrator?
has answer: http://stackoverflow.com/a/37262646
answer count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/53236494
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/69768076
score: 3
tagged with: mysql-workbench
has answer: http://stackoverflow.com/a/22935059
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/116408426
tagged with: mysql
type: Question
has body: I am using MySQL Workbench 6.0 over here. When I select the server status, I am getting this error Regarding this, I tried looking for solutions on Google and StackOverflow (e.g. this result) But here in MySQL Workbench 6.0, I don't know where is Server Administration of Mysql's and Workbench Central. Can anyone help me regarding this issue in MySQL Workbench 6.0?
has answer: http://stackoverflow.com/a/32273868
downvote count: 0
tagged with: .net

http://stackoverflow.com/a/22930375
has body: Use methods for each operation. Each method will have its own switch: private String getDaySuffix(int day) { switch(day) { case 1: return "st"; // ... } } private String getActivity(int day) { switch(day) { case 1: return "One downhill sprint"; // ... } } for (int i = 0; i &lt; day; i++) { String s = "On the " + day + getDaySuffix(day) + " day of holidays, I did " + getActivity(day); } That way, you improve cohesion: each method does what it is supposed to do, and nothing else.
downvote count: 0
answers question: http://stackoverflow.com/q/22930129
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/22924621
score: 1
answers question: http://stackoverflow.com/q/22924571
upvote count: 1
has body: Something like this: public void processLine(String line){ System.out.println(lineNumber + " " + line + "-" + line.length()); ++lineNumber; } I haven't tested it, so if it isn't 100% correct, I'll leave it as an exercise for you to complete, but it should put you on the right track. Good luck.
has comment: http://stackoverflow.com/comment/34993081
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22924571
type: Answer
has comment: http://stackoverflow.com/comment/34994219

http://stackoverflow.com/q/22901043
favorite count: 0
has comment: http://stackoverflow.com/comment/34950255
has comment: http://stackoverflow.com/comment/34950173
tagged with: spring
linked to: http://stackoverflow.com/q/19896870
tagged with: inversion-of-control
has title: Yet Another ApplicationContext is Null
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/19896870
score: 1
has body: I'm having trouble autowiring a Spring bean in my application. This is something I've done before in other applications with success, but for some reason I'm getting stumped. I've googled around, and have found many folks having the same troubles, and the warnings that go along with using the getApplicationContext() approach but no answers that helped me. I understand the warnings and still have a case where I want to do it this way, then maybe I'll get it working using AspectJ and compile time weaving. Here is my setup: applicationContext.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"&gt; &lt;context:property-placeholder location="classpath:widgetClient.properties"/&gt; &lt;context:component-scan base-package="com.myCompany.widget.domain" /&gt; &lt;context:component-scan base-package="com.myCompany.widget.services" /&gt; &lt;context:annotation-config /&gt; &lt;bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"&gt; &lt;property name="basename" value="messages" /&gt; &lt;/bean&gt; &lt;bean id="heartbeat" class="com.company.widget.domain.Ch…
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22901186
has comment: http://stackoverflow.com/comment/34950352
has comment: http://stackoverflow.com/comment/34950247
answer count: 1
downvote count: 0
tagged with: applicationcontext

http://stackoverflow.com/a/70505577
upvote count: 1
has body: The purpose of dependency-reduced-pom.xml is to show you what is the final dependency set of the artifact that you are preparing. Let's say artifact X depends on A and B. By embedding B dependency with maven-shade-plugin we create an artifact that depends only on A and this is what dependency-reduced-pom.xml will tell you (B dependency will not be in that file). This is the file that will be installed in Maven repository instead of original pom.xml. It will be used where calculating dependency set of artifact X, so if any other module depends on X it will not depend on B.
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22904573

http://stackoverflow.com/a/22917307
type: Answer
answers question: http://stackoverflow.com/q/22916476
score: 0
has body: protoc(1) --java_out=src/main/java(2) -I../src(3) ../src/google/protobuf/descriptor.proto(4) protoc: main program --java_out=OUT_DIR: Generate Java source files in OUT_DIR path (must exists). -I (--proto_path) optional: Specify the directory in which to search for imports. May be specified multiple times; directories will be searched in order. If not given, the current working directory is used. Your .proto descriptor file. But you can simplify the command line with protoc --java_out=src/main/java /path/to/my/proto/myproto.proto

file-io
tags question: http://stackoverflow.com/q/22920105
tags question: http://stackoverflow.com/q/22920343
tags question: http://stackoverflow.com/q/22824523
tags question: http://stackoverflow.com/q/22844098
tags question: http://stackoverflow.com/q/22943791
tags question: http://stackoverflow.com/q/22891398
tags question: http://stackoverflow.com/q/22892801
tags question: http://stackoverflow.com/q/22892760
type: Tag
tags question: http://stackoverflow.com/q/22918928
tags question: http://stackoverflow.com/q/22887594
tags question: http://stackoverflow.com/q/22926386
tags question: http://stackoverflow.com/q/22854878
tags question: http://stackoverflow.com/q/22912009
tags question: http://stackoverflow.com/q/22918630
tags question: http://stackoverflow.com/q/22852159
tags question: http://stackoverflow.com/q/22851809
tags question: http://stackoverflow.com/q/22910949
tags question: http://stackoverflow.com/q/22944511
tags question: http://stackoverflow.com/q/22951278
tags question: http://stackoverflow.com/q/22824027
tags question: http://stackoverflow.com/q/22838512
tags question: http://stackoverflow.com/q/22864095
tags question: http://stackoverflow.com/q/22853167
tags question: http://stackoverflow.com/q/22946769
tags question: http://stackoverflow.com/q/22856888
tags question: http://stackoverflow.com/q/22871599
tags question: http://stackoverflow.com/q/22819507
tags question: http://stackoverflow.com/q/22824969
tag name: file-io
tags question: http://stackoverflow.com/q/22940300
tags question: http://stackoverflow.com/q/22907653
tags question: http://stackoverflow.com/q/22832563
tags question: http://stackoverflow.com/q/22817312
tags question: http://stackoverflow.com/q/22888513
tags question: http://stackoverflow.com/q/22880136
tags question: http://stackoverflow.com/q/22865420
tags question: http://stackoverflow.com/q/22907730

http://stackoverflow.com/comment/34903641
type: Comment
type: QuestionComment
has text: Yes, see what @Matt has pointed to, but also I've found that Java works with forward-slash `/` separators on every system I've tried - Unix, Mac, Windows, even VMS where paths look like `volName:[topdir.subdir.otherdir]filename.txt`
score: 0
comment on: http://stackoverflow.com/q/22875020

http://stackoverflow.com/comment/34933758
type: Comment
comment on: http://stackoverflow.com/a/22892060
has text: What kind of borders? You mean the bar at the top with the minimise, maximise and exit button?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34796005
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22814196
has text: When you say you are "not able to delete", what do you mean ? Do you get an error message or is there nothing happening ?
score: 0

http://stackoverflow.com/q/22915840
upvote count: 14
has answer: http://stackoverflow.com/a/22917891
tagged with: java
possible better answer: http://stackoverflow.com/a/23132762
has answer: http://stackoverflow.com/a/23132762
has body: I'm currently using the Datastax Cassandra driver for Cassandra 2 to execute cql3. This works correctly. I started using PreparedStatement's: Session session = sessionProvider.getSession(); try { PreparedStatement ps = session.prepare(cql); ResultSet rs = session.execute(ps.bind(objects)); if (irsr != null) { irsr.read(rs); } } Sometimes I get a warning from the driver in my log: Re-preparing already prepared query . Please note that preparing the same query more than once is generally an anti-pattern and will likely affect performance. Consider preparing the statement only once. This warning makes sense, but i'm not sure how i should reuse the PreparedStatement? Should I just create all my PreparedStatement in a constructor/init method and than simply use them? But does this go well when multiple threads use the same PreparedStatement at the same time (especially calling PreparedStatement.bind() to bind objects)
tagged with: datastax-java-driver
accepted answer: http://stackoverflow.com/a/22917891
score: 14
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/31724904
tagged with: cassandra
type: Question
has title: Re-using PreparedStatement when using Datastax Cassandra Driver?
has answer: http://stackoverflow.com/a/43180691
answer count: 4

http://stackoverflow.com/q/22923822
has answer: http://stackoverflow.com/a/22929640
has title: How does Spring Data jpa know properties changed?
possible better answer: http://stackoverflow.com/a/22924760
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34991725
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22924760
accepted answer: http://stackoverflow.com/a/22929640
has body: So say I lookup an object from the repository. If I save this object immediately after lookup, Spring Data is smart enough not to update the database. If I change a property within this object and then save, spring data does an update. How does it know it needs to do an update or not?
score: 0
tagged with: spring-data-jpa

http://stackoverflow.com/a/23077318
has comment: http://stackoverflow.com/comment/53099101
score: 55
type: AcceptedAnswer
has body: To be clear, natural order is not insertion order, except in the case of capped collections. You will need another criteria to sort by. Assuming you are using the default ObjectID, you can use this as a metric for insertion as the default value starts with the insertion time (to the millisecond) and is always unique. You should also use a find, rather than a findOne. Try the following: db.market.find({}).sort({_id:-1}).limit(1)
has comment: http://stackoverflow.com/comment/95121549
accepted answer of: http://stackoverflow.com/q/22965106
answers question: http://stackoverflow.com/q/22965106
type: Answer
upvote count: 55
downvote count: 0
has comment: http://stackoverflow.com/comment/53136693

http://stackoverflow.com/q/22869750
tagged with: android-custom-view
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34925591
tagged with: android
has title: Android Custom View always getting 0 width when calling onMeasure
has body: I'm fairly new to android dev and am trying to learn ropes. In order to do that I've been messing around Custom Views in android. I am trying to build an alarm clock app and I want to make a nice spinner to select the times from. Similar to say this: http://i47.tinypic.com/aymyjc.jpg I have created an AndroidScollSpinner class that looks like this: public class AndroidScrollSpinner extends View { public AndroidScrollSpinner(Context context) { super(context); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); drawBackground(canvas); drawSomeText(canvas); canvas.restore(); } private void drawSomeText(Canvas canvas) { Paint titlePaint = new Paint(); titlePaint.setColor(Color.BLUE); canvas.drawTextOnPath("Bert", new Path(), 0.0f,0.0f, titlePaint); } private void drawBackground(Canvas canvas) { Paint backgroundPaint = new Paint(); backgroundPaint.setColor(getResources().getColor(R.color.bluegrass)); backgroundPaint.setStyle(Paint.Style.FILL); Bitmap background = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888); canvas.drawBitmap(background, 0, 0, backgroundPaint); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int minw = getPaddingLeft() + getPaddingRight() + getSuggestedMinimumWidth(); int w = Math.max(minw, MeasureSpec.getSize(widthMeasureSpec)); int h = MeasureSpec.getSize(heightMeasureSpec); setMeasuredDimension(w, h); } } The issue I am having is in the onMeasure The MeasureSpec.getSize(widthMeasureSpec) always returns 0. Does anyone know why? Or what I am missing here? Here's my layout file as well. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height=…
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34944946
tagged with: java
has answer: http://stackoverflow.com/a/22870172
type: Question

http://stackoverflow.com/q/22898909
tagged with: swing
has comment: http://stackoverflow.com/comment/34946258
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34946345
has answer: http://stackoverflow.com/a/22899045
answer count: 2
has comment: http://stackoverflow.com/comment/34946499
tagged with: alignment
has title: How to alignment right to left in JFrame/java?
has comment: http://stackoverflow.com/comment/34946356
tagged with: vertical-alignment
has body: I wrote this code, but I'm having a problem with making it align from right to left. I tried several things, but none of them works. I know it can be done by playing with the coordinates, but I want a way that I wouldn't need to do that for every word. How am I supposed to do it the right way? code: import java.util.*; import javax.swing.*; import java.awt.*; public class GUI { //messages public static final String ConnectC_MSG = "התחבר" ; public static final String DisconnectC_MSG = "התנתק" ; public static final String ServerLBL_MSG = "שרת יעד:" ; public static final String UsernameLBL_MSG = ":שם משתמש"; public static final String PasswordLBL_MSG = ":סיסמא" ; public static final String PortLBL_MSG = ":פתחה" ; //sizes public static final int SreverTxtfield_Width = 10; public static final int UsernameTxtfield_width = 10; public static final int PasswordTxtfield_width = 10; public static final int PortTxtfield_width = 5 ; public static final int WINDOW_WIDTH = 800; public static final int WINDOW_HEIGHT = 200; static JFrame frame1; static Container pane; static JButton btnConnect = new JButton(ConnectC_MSG), btiDiscinnect = new JButton(DisconnectC_MSG); static JLabel lblServer = new JLabel(ServerLBL_MSG), lblUsername = new JLabel(UsernameLBL_MSG), lblPassword = new JLabel(PasswordLBL_MSG), lblPort = new JLabel(PortLBL_MSG); static JTextField txtServer = new JTextField(SreverTxtfield_Width), txtUsername = new JTextField(UsernameTxtfield_width), txtPort = new JTextField(PortTxtfield_width); static JPasswordField txtPassword = new JPasswordField(PasswordTxtfield_width); static Insets insets; public static void main(String[] args) { frame1 = new JFrame ("הדגמה"); frame1.setSize(WINDOW_WIDTH,WINDOW_HEIGHT); frame1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); pane = frame1.getContentPane(); pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); insets = pane.getInsets(); pane.setLayout(null); pane.add(lblServer); pane.add(lblUsername); pane.add(lbl…
tagged with: jframe
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34946481
has answer: http://stackoverflow.com/a/22899110

http://stackoverflow.com/q/22945827
tagged with: java
type: Question
tagged with: jdbc-odbc
answer count: 1
tagged with: database
has answer: http://stackoverflow.com/a/22980721
score: 0
tagged with: myeclipse
has title: Unable to run an Eclipse project in a local web browser, access the database, and run the project
type: UnansweredQuestion
has body: I am currently doing a web application project in Eclipse. I understand that the project done in eclipse runs on a local web browser (i.e. in my eclipse web browser). What I don't understand, if how we can execute or run that project in my local browser, such as Google Chrome, or Firefox etc., In order to do this, I tried to copy the web url address from eclipse and pasting it into Chrome. The user interface is working fine. That said, it was not supporting the database when i tried to login. Logging in gave me the message "login failed". Can some please help explain where to store my database and how to run my project in a web browser that is built in eclipse.

http://stackoverflow.com/q/22879781
tagged with: android
tagged with: regex
has answer: http://stackoverflow.com/a/22879840
tagged with: java
has comment: http://stackoverflow.com/comment/34911590
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22880352
score: 0
has title: Unable to match Pattern
has body: I have a long string to text that I have to regex to find just one short string of text. For example, I have to get the website content from http://www.hltv.org/match/2290951-uumlberholverbot-legendbots-bot-tournament-2014. After getting the content, I just need to match a string in the website's source, where this.content is the retrieved website's source and I need to match date:"1396706400000", htmlTemplate:. The regex works well, just that it always returns error. public String getCountdown() { Pattern countdownPattern = Pattern.compile("date:\"(.*?)\", htmlTemplate"); Matcher m = countdownPattern.matcher(this.content); if (m.find()) { String time = m.group(1).trim(); return time; } else { return "ERROR"; } Thank you!
type: UnansweredQuestion

http://stackoverflow.com/a/22918195
has comment: http://stackoverflow.com/comment/34998452
score: 0
answers question: http://stackoverflow.com/q/22917785
has body: I have updated the code. It was having few errors. Check the following corrected one. Hope this is what is expected. import java.awt.*; import java.awt.event.*; import javax.swing.ImageIcon.*; import java.awt.Font.*; import javax.swing.*; //import java swing to use the Jframe etc class MathQuiz extends JFrame implements ActionListener { JCheckBox answer1 = new JCheckBox(); //checkbozx for answer 1 JCheckBox answer2 = new JCheckBox(); //checkbozx for answer 2 JCheckBox answer3 = new JCheckBox(); //checkbozx for answer 3 JTextArea textArea = new JTextArea();//text area for question JButton exit = new JButton(); // button to exit quiz JButton calculator = new JButton(); // button to open calculator JLabel image = new JLabel(); //adds background image // Some names which will be associated with numbers. int answer; int questionnumber; /** * This bit of code starts the process of showing the window. **/ public MathQuiz() { // Drop down to the code labeled 'initComponents' below. try { initComponents(); } catch (Exception e) {} } /** * This bit of code is the first bit that's run. **/ static public void main(String[] args) { MathQuiz frame = new MathQuiz(); // // The following code puts the Window on your screen. frame.setVisible(true); //allows the jframe to be visible frame.showQuestion(1);//shows the first question frame.setSize(378, 383);//sets the size of the frame } /** * This bit of code sets up how the Window looks. **/ public void initComponents() throws Exception { //edits the checkboxes for the answers answer1.setSize(new Dimension(80, 20)); //set size of answer 1 checkbox answer1.setVisible(true); //sets visible to answer 1 checkbox answer1.setLocation(new Point(20, 180)); //set location answer 1 checkbox Font font1 = new Font("Verdana", Font.BOLD, 14); answer1.setFont(font1); answer1.setForeground(Color.RED); answer2.setSize(new Dimension(80, 20)); //set size of answer 2 checkbox answer2.setVisible(true);//sets visible to answer 2 checkbox answer2.setLocation…
type: Answer
has comment: http://stackoverflow.com/comment/34980902
has comment: http://stackoverflow.com/comment/34998418

http://stackoverflow.com/comment/35062570
score: 0
type: Comment
has text: Thanks for the solution Alexey Malev. The problem was exactly what you stated above.
comment on: http://stackoverflow.com/a/22962709
type: AnswerComment

http://stackoverflow.com/q/22967941
tagged with: dicom
answer count: 1
tagged with: pixelmed
has answer: http://stackoverflow.com/a/22973014
has body: I'm trying to read data attribute from its tag in Java with the library pixelmed. the code that I had is : public static void main(String args[]) throws IOException, DicomException { DicomInputStream my_image = new DicomInputStream(new File("/Volumes/CDP/20130212101717421/20130212101636203")); AttributeList list = new AttributeList(); SpecificCharacterSet sc=new SpecificCharacterSet(list); PersonNameAttribute pna=new PersonNameAttribute(TagFromName.PatientName,1000,my_image,sc); System.out.println(pna.getDelimitedStringValuesOrEmptyString()); } With this code i get data of all attributes : ���UL�Æ�����OB��������UI�1.2.840.10008.5.1.4.1.1.4���UI6�1.2.840.113619.2.244.6945.224850.21460.1360606914.740���UI�1.2.840.10008.1.2.1���UI�1.2.376.99999.1.1.20041017��SH�CDP_V3��AE�MRS��CS �ISO_IR ... etc etc But I just want to get the information on the tag (0x0010,0x0010).
has title: Read and Write on DICOM attribute with pixelmed
accepted answer: http://stackoverflow.com/a/22973014
type: AnsweredQuestion
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/34833792
score: 0
has text: I added a lot of sleep time during each step before clicking the Submit, since that was the only corrective action i could take. After that of course i have no control.
type: Comment
comment on: http://stackoverflow.com/a/22836940
type: AnswerComment

http://stackoverflow.com/comment/34924844
score: 0
has text: A way to do such a thing is to use a list of objects but this is a workaround. I think you don't have realised what is the problem you are trying to solve or at least you don't give enough info.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22886942

http://stackoverflow.com/a/22809970
answers question: http://stackoverflow.com/q/22809629
downvote count: 1
has body: if(name!=null ){ if(!name.isEmpty()){ //body } }
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/34785337
type: Answer

http://stackoverflow.com/q/22839116
tagged with: java
has comment: http://stackoverflow.com/comment/34838771
type: Question
has answer: http://stackoverflow.com/a/22843162
has body: I'm currently using Spring MVC with Freemarker as a view technology (template engine). However including several template files causes output to no longer be nicely formatted. My current HTML output might look like this: Title .. For ease of visual debugging I would like to manually format the output with some HTML/XML formatter. However in Spring I have no control over the output after the model is passed to the view technology (in my case Freemarker). How would I go about this? My guess is to create a servlet filter and to register it to be executed after template execution. How would I do this in pure Spring Java Config?
has comment: http://stackoverflow.com/comment/34837775
tagged with: servlets
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22843162
has title: Process output after template engine in Spring MVC
tagged with: servlet-filters
tagged with: spring
has comment: http://stackoverflow.com/comment/34838627
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/34900236
comment on: http://stackoverflow.com/q/22870365
score: 0
has text: If you're using JOptinPane, you shouldn't have to, as it will be added automatically. You could do a quick test and change the background color of the panel
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34820736
score: 0
has text: It should work just add index.jsp it should work not WEB-INF is needed just index.jsp or /index.jsp will work
type: AnswerComment
comment on: http://stackoverflow.com/a/22829348
type: Comment

http://stackoverflow.com/q/22867069
has comment: http://stackoverflow.com/comment/34888611
type: Question
has comment: http://stackoverflow.com/comment/34889367
tagged with: jpa-2.1
has body: Accidently works or not and always keep saying even if the error is TOTAL other problem: Parameter number 2 is not an OUT parameter Even if the stored procedure is does not exist, like: Java call: StoredProcedureQuery storedProcedure = entityManager.createStoredProcedureQuery("`sequence`.next_totally_not_existed_valsafafasf"); Exception: Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Parameter number 2 is not an OUT parameter Error Code: 0 Call: { CALL `sequence`.next_totally_not_existed_valsafafasf(?, ?) } bind =&gt; [belso_ugy_iktato_szam_sequence, =&gt; 2] MySql Code: DELIMITER $$ CREATE PROCEDURE `sequence`.nextval (IN seq_name varchar(100), OUT cur_val BIGINT) BEGIN SELECT cur_value INTO cur_val FROM sequence WHERE name = seq_name; IF cur_val IS NOT NULL THEN UPDATE sequence SET cur_value = IF ( (cur_value + increment) &gt; max_value OR (cur_value + increment) &lt; min_value, IF ( cycle = TRUE, IF ( (cur_value + increment) &gt; max_value, min_value, max_value ), NULL ), cur_value + increment ) WHERE name = seq_name; END IF; END $$ Java Code: entityManager.getTransaction().begin(); StoredProcedureQuery storedProcedure = entityManager.createStoredProcedureQuery("`sequence`.nextval); // set parameters storedProcedure.registerStoredProcedureParameter("seq_name", String.class, ParameterMode.IN); storedProcedure.registerStoredProcedureParameter("cur_val", String.class, ParameterMode.OUT); storedProcedure.setParameter("seq_name", sequence_name); // execute SP storedProcedure.execute(); // get result Long result = null; try { result = Long.valueOf((String) storedProcedure.getOutputParameterValue("cur_val")); } catch (NumberFormatException ne) { return 0; } entityManager.getTransaction().commit(); entityManager.close(); Is anybody experienced the same? Or am i missing so…
tagged with: jpa
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34889314
has comment: http://stackoverflow.com/comment/34888792
has title: JPA 2.1 StoredProcedureCall seems buggy for me
answer count: 0
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/34957273
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22904511
has text: @Pradheep: **and vice-versa**. That's the key part. If map2 has all the keys of map1, **but also other keys**, then they're not equal. To be equal, the maps must have the same keys, because if map1.equals(map2) is true, then map2.equals(map1) must also be true.

http://stackoverflow.com/a/54362255
downvote count: 0
score: 5
type: Answer
has body: #Use Interface Another way to deal with this situation is by using an Interface. I will describe the advantage of this approach but first, let's see how it's done. Follow these steps: 1) Create an interface public interface MyBroadcastListener{ public void doSomething(String result); } 2) Initialize the listener in BroadCastReceiver public class NotifAlarm extends BroadcastReceiver { private MyBroadcastListener listener; @Override public void onReceive(Context context, Intent intent) { listener = (MyBroadcastListener)context; // other things done here like notification // NUPDATE TEXTV1 IN MAINACTIVITY HERE listener.doSomething("Some Result"); } } 3) Implement the interface in Activity and override the method public YourActivity extends AppCompatActivity implements MyBroadcastListener{ // Your Activity code public void updateTheTextView(String t) { TextView textV1 = (TextView) findViewById(R.id.textV1); textV1.setText(t); } @Override public void doSomething(String result){ updateTheTextView(result); // Calling method from Interface } } ##Advantages of using the interface? When you have BroadcastReceiver in a different file Decoupled BroadcastReceiver Using an interface makes BroadcastReceiver independent of any Activity. Let's say in future you want to use this BroadCastReceiver with another Activity which takes the result from BroadcastReceiver and start a DetailActivity. This is completely a different task but you will use the same BroadcastReceiver without even a single code change inside BroadcastReceiver. How to do that? Implement the interface in the Activity and Override the method. That's it! public ListActivity extends AppCompatActivity implements MyBroadcastListener{ // Your Activity code public void startDetailActivity(String title) { Intent i = new Intent(ListActivity,this, DetailActivity.class); i.putExtra("Title", title); startActivity(i); } @Override public void doSomething(String result){ startDetailActivity(String title); // Calling method from Inte…
answers question: http://stackoverflow.com/q/22869928
upvote count: 5

http://stackoverflow.com/a/22928965
answers question: http://stackoverflow.com/q/22928733
score: 0
has body: your method is wrong checkout this one. public int withdraw(double amount) { AccountBalance = this.AccountBalance - amount; if (0 &gt; AccountBalance) { // testing if 0 is greater than Account balance return (int)AccountBalance + (int)amount; } else{ return (int)AccountBalance; } }
type: Answer

http://stackoverflow.com/a/52929630
answers question: http://stackoverflow.com/q/22815199
has body: Just make sure you follow the below things : "package com.kevin.corejava;" It should be a valid path. Your package path must be executed by JDK, and JRE must access its class file. (Make Sure your JDK and JRE paths are right to access this file). The class name must be same as the file name as the main method is in your Employee class. Your project's Build path is right. If you use Eclipse or other IDE, just right click and configure your build path.
score: 0
type: Answer

http://stackoverflow.com/a/22888608
has comment: http://stackoverflow.com/comment/34927690
answers question: http://stackoverflow.com/q/22888350
type: Answer
score: 3
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22888350
type: AcceptedAnswer
has body: If done right, there should be minimal delay in your change of tiles, but I'm not sure that your code and explanation can currently tell us where you're stuck. For example, run this code (my minimal example program) to see tiles changing color with minimal delay and no artifacts. import java.awt.Color; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.util.Random; import javax.swing.*; public class SquareGridTest extends JPanel { public static final Color[] COLORS = { Color.blue, Color.red, Color.yellow, Color.orange, Color.green, Color.cyan, Color.lightGray, Color.magenta, Color.white, Color.black }; private static final Icon[] ICONS = new Icon[COLORS.length]; private static final int ROWS = 20; private static final int COLS = 30; private static final int BI_WIDTH = 20; private static final int BI_HEIGHT = BI_WIDTH; private static final int TIMER_DELAY = 15; protected static final int NUMBER_TO_SWAP = 15; private JLabel[][] grid = new JLabel[ROWS][COLS]; private Random random = new Random(); static { for (int i = 0; i &lt; ICONS.length; i++) { BufferedImage img = new BufferedImage(BI_WIDTH, BI_HEIGHT, BufferedImage.TYPE_INT_ARGB); Graphics g = img.getGraphics(); g.setColor(COLORS[i]); g.fillRect(0, 0, BI_WIDTH, BI_HEIGHT); g.dispose(); ICONS[i] = new ImageIcon(img); } } public SquareGridTest() { setLayout(new GridLayout(ROWS, COLS)); for (int row = 0; row &lt; grid.length; row++) { for (int col = 0; col &lt; grid[row].length; col++) { JLabel label = new JLabel(); int index = random.nextInt(COLORS.length); label.setIcon(ICONS[index]); add(label); grid[row][col] = label; } } new Timer(TIMER_DELAY, new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { for (int i = 0; i &lt; NUMBER_TO_SWAP; i++) { int row = random.nextInt(ROWS); int col = random.nextInt(COLS); int iconIndex = random.nextInt(ICONS.length); grid[row][col]…

http://stackoverflow.com/a/23113207
answers question: http://stackoverflow.com/q/22905919
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: In general, I think OpenNLP will be better (performance-wise) than rule-based segmenters like Stanford segmenter or implementing a regular expression to solve the task. Rule based segmenters are bound to miss some exceptions. Like, for example, the German sentence, "Ich wurde am 17. Dezember geboren" (I was born on 17th December) will be mistakenly broken into 2 sentences after 17. by a lot of rule-based segmenters, especially if they are built on English rules and not German. Sentences like these will occur even if your text quality is really great as they constitute grammatically correct German. It is very important therefore to check which language-model the segmenter you want to use, is modelled upon. PS: Amongst OpenNLP, BreakIterator segmenter and Stanford segmenter, OpenNLP worked best for me.

http://stackoverflow.com/a/62017886
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: I tried the solution albciff suggested in this thread and it turns out that Eclipse Moxy handles this much better than the reference implementation (org.glassfish.jaxb). Here's info on how to switch to the Moxy implemenation of JAXB: https://wiki.eclipse.org/EclipseLink/Examples/MOXy/JAXB/SpecifyRuntime The documentation doesn't specify it but you can also change the jaxb implemenation with just a single configuration file instead of a jaxb.properties in each package where your jaxb annotated classes exists. Just create a file META-INF/services/javax.xml.bind.JAXBContext (yep unconventional filename) with the contents: org.eclipse.persistence.jaxb.JAXBContextFactory This makes the jaxb ContextFinder use the Eclipse Moxy implementation for all jaxb marshalling in the jvm. Another option is to use a system property -Djavax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory Disclaimer though: The namespaces declaration aren't minimized/optimized for the current payload, but at least it doesn't include ALL namespaces that are part of the jaxb grammar. The integration I'm working on went from a staggering 700+ declared namespaces (about 60KB worth of useless overhead per sent message) to at best 3 declarations in a message. Though for messages which have a lot of different types in them, all of the namespaces which are valid in that particular message is declared. That means in some case I still get ~30 declared namespaces when only one would suffice for the current payload. I guess that SOAP isn't the way to go if you need to optimize on bandwidth.
answers question: http://stackoverflow.com/q/22941466

http://stackoverflow.com/comment/34876449
comment on: http://stackoverflow.com/q/22860682
type: Comment
type: QuestionComment
has text: Check any recursion code.
score: 1

http://stackoverflow.com/q/22835770
has comment: http://stackoverflow.com/comment/34831910
has comment: http://stackoverflow.com/comment/34832317
has answer: http://stackoverflow.com/a/22835920
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
tagged with: object
score: -1
has comment: http://stackoverflow.com/comment/34832137
tagged with: arraylist
answer count: 2
tagged with: for-loop
upvote count: 0
has comment: http://stackoverflow.com/comment/34833130
has title: Java arraylist add data an transform to .txt
favorite count: 0
has answer: http://stackoverflow.com/a/22835815
has comment: http://stackoverflow.com/comment/34833193
has body: This is my code in which I try to write data(Ime-name, Pasma-breed, Starost-age, Teza-weight) in to arraylist an then from array list to .txt file. It has to be done for 5 Dogs(Pes) so I have used for i was hoping if someone could check it and give me a feedback to this. I have got problems with writing to array list and then to .txt file. Thanks :) import java.io.File; import java.io.FileWriter; import java.util.ArrayList; import java.util.Scanner; class Pes { private String Ime; private String Pasma; private int Starost; private double Teza; public void setIme(String Ime) { this.Ime = Ime; } public String getIme() { return Ime; } public void setPasma(String Pasma) { this.Pasma = Pasma; } public String getPasma() { return Pasma; } public void setStarost(int Starost) { this.Starost = Starost; } public int getStarost() { return Starost; } public void setTeza(double Teza) { this.Teza = Teza; } public double getTeza() { return Teza; } Pes() { Ime = ""; Pasma = ""; Starost = 0; Teza = 0; } } public class Aplikacija { public static void main(String[] args) { new File("Psi.txt"); Scanner input = new Scanner(System.in); for (int i = 0; i &lt;= 5; i++) { System.out.println("Vpišite ime!"); String Ime = input.nextLine(); System.out.println("Vpišite pasmo!"); String Pasma = input.nextLine(); System.out.println("Izberite starost!"); int Starost = input.nextInt(); System.out.println("Izberite tezo!"); double Teza = input.nextDouble(); Pes Pes1 = new Pes(); Pes1.setIme(Ime); Pes1.setPasma(Pasma); Pes1.setStarost(Starost); Pes1.setTeza(Teza); new ArrayList&lt;Pes&gt;(); Pes1.add(new Pes(Ime, Pasma, Starost, Teza)); input.close(); } FileWriter writer = new FileWriter("Psi.txt"); for (String str : arr) { writer.write(str); } writer.close(); } }

http://stackoverflow.com/q/22823061
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/38944730
has comment: http://stackoverflow.com/comment/90550133
has answer: http://stackoverflow.com/a/25059625
upvote count: 1
tagged with: jpa
answer count: 1
tagged with: persistence
has comment: http://stackoverflow.com/comment/38871250
favorite count: 0
type: UnansweredQuestion
tagged with: ebean
has title: Gradle EBean Enhancement - Entity not enhanced
has body: I've been Googling for hours, maybe I don't understand enough about it to truly describe it, maybe my Googling talents have declined over the past day. I've upgrade to EbeanORM 3.2.5 from 2.8.1 finally realizing they kept up but just changed the artifact name. That being said, I'm getting the enhancement error. Caused by: javax.persistence.PersistenceException: Entity type class com.bloomhealthco.fixtures.entities.ProductFamilyProductGroupRelationEntity is not an enhanced entity bean. Subclassing is not longer supported in Ebean I'm working with Gradle, so the Maven fix doesn't suit me. I found the avaje-agentloader and tried to implement that: buildscript{ repositories { jcenter() } dependencies { classpath "org.avaje:avaje-agentloader:1.1.1" } } import org.avaje.agentloader.AgentLoader task fixturesTests(type: Test) { description "Executes all fixtures tests." AgentLoader.loadAgentFromClasspath("avaje-ebeanorm-agent","debug=1"); outputs.upToDateWhen { false } } I have also tried putting it in my test setup. Currently I'm just testing the entities work as expected. import org.avaje.agentloader.AgentLoader class EntitySpec extends Specification { setupSpec() { AgentLoader.loadAgentFromClasspath("avaje-ebeanorm-agent","debug=1"); } ......... ......... ......... } Am I not creating the reference to the agentloader correctly or am I not even on the right page? I also don't really understand what enhancement is.
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/22951968
accepted answer of: http://stackoverflow.com/q/22950226
answers question: http://stackoverflow.com/q/22950226
upvote count: 2
has comment: http://stackoverflow.com/comment/35072736
has comment: http://stackoverflow.com/comment/35070276
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35209977
has comment: http://stackoverflow.com/comment/35166098
has comment: http://stackoverflow.com/comment/35164342
has comment: http://stackoverflow.com/comment/35068941
has comment: http://stackoverflow.com/comment/35075138
type: Answer
has body: It sounds like you need to use an HTTPS URL connection to connect with a server which requires client authentication. You'll need to do two things to get there from where you are. First, you'll need to create a Java style keystore from your private key and public certificate. Detailed instructions can be found in the answers to this question: importing an existing x509 certificate and private key in Java keystore to use in ssl You'll also need to import the server's certificate into the keystore. Second, you'll need to write your Java code to use your newly created keystore. Do this by creating an SSLContext using your keystore, and setting your HTTPS URL connection to use a socket factory from this context - something along the lines of this: SSLContext sslContext = SSLConnections.getSSLContext(keyStoreFile, keyStoreFilePassword); httpsURLConnection.setSSLSocketFactory(sslContext.getSocketFactory()); This should be done after the HttpsURLConnection is created, but before it is connected - that is, before you read from or write to it, or call connect() on it.
score: 2
downvote count: 0

http://stackoverflow.com/comment/34940608
type: AnswerComment
type: Comment
has text: User: I changed your code and add try/catch onPostExcute. Thank you!
score: 0
comment on: http://stackoverflow.com/a/22893648

http://stackoverflow.com/q/22827974
has answer: http://stackoverflow.com/a/22828313
upvote count: 0
type: UnansweredQuestion
score: -3
has body: My Requirement is if there is a table in that table there are certain rows and columns. 1) suppose there is a column named as Estimated hours. 2) If the Estimated Hours is less than 30 Hours then that particular row should visible in Red color. can anyone please help me out ?
has comment: http://stackoverflow.com/comment/34818028
has comment: http://stackoverflow.com/comment/34817998
tagged with: java
has title: Jquery Event function
type: Question
linked to: http://stackoverflow.com/q/13547616
answer count: 2
tagged with: javascript
tagged with: jquery
downvote count: 3
has answer: http://stackoverflow.com/a/22828278
has comment: http://stackoverflow.com/comment/34817922
favorite count: 0

http://stackoverflow.com/q/22929925
type: UnansweredQuestion
downvote count: 0
answer count: 0
has title: Specify DB2 driver properties in persitence.xml
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35002851
type: Question
tagged with: db2
tagged with: persistence.xml
has body: I have a question regarding driver specific properties in the persistence.xml. DB2 has some secific properties that need to be set on the DataSource see: com.ibm.db2.jcc.DB2SimpleDataSource ds = new com.ibm.db2.jcc.DB2SimpleDataSource(); ds.setDriverType(4); // Set driver type ds.setDatabaseName("******"); // Set location ds.setServerName("******"); // Set server name ds.setPortNumber(******); // Set port number ds.setUser("*******"); // Set user ID ds.setPassword("*******"); // Set password ds.setDriverType(4); ds.setSecurityMechanism(com.ibm.db2.jcc.DB2BaseDataSource.ENCRYPTED_USER_AND_PASSWORD_SECURITY); ds.setEncryptionAlgorithm(2); ds.setClientAccountingInformation("********"); When I create the connection in Netbeans it generates following persistence.xml file: <?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="javax.persistence.jdbc.url" value="jdbc:db2://********:********/********"/> <property name="javax.persistence.jdbc.password" value="********"/> <property name="javax.persistence.jdbc.driver" value="com.ibm.db2.jcc.DB2Driver"/> <property name="javax.persistence.jdbc.user" value="********"/> Now my question is how to include the missing properties like "DriverType" or "EncryptionAlgorithm" in the persistence.xml. Is there any way to do this or do I need to add them after I got the connection?
upvote count: 1
has comment: http://stackoverflow.com/comment/35002700
tagged with: jpa
favorite count: 0

http://stackoverflow.com/comment/34863460
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22853065
has text: You can set your application to receive `ACTION_VIEW` intents, that way, when you choose to download your attachment on GMail, you application will show up in the list of application to handle the attachment. You can use `getData()` to fetch the file. Take a look at [this answer](http://stackoverflow.com/questions/4648096/if-my-app-was-started-via-action-view-how-do-i-retrieve-the-attached-data)

http://stackoverflow.com/a/22879857
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34918726
has comment: http://stackoverflow.com/comment/34918670
type: Answer
has comment: http://stackoverflow.com/comment/34918156
answers question: http://stackoverflow.com/q/22879751
has comment: http://stackoverflow.com/comment/34918772
score: 1
accepted answer of: http://stackoverflow.com/q/22879751
upvote count: 1
has comment: http://stackoverflow.com/comment/34918284
has comment: http://stackoverflow.com/comment/34922177
has body: Please do not show "50+ notifications". Please show one Notification, updated perhaps to reflect 50+ events. This is covered: in the design guidelines (see "Stack your notifications") in the API guide in the Android Wear documentation (as people with Android Wear devices will get severely pissed at you for flooding their watch or whatever with 50+ notifications)
has comment: http://stackoverflow.com/comment/34918682

http://stackoverflow.com/q/22880093
tagged with: string
has comment: http://stackoverflow.com/comment/34920318
has comment: http://stackoverflow.com/comment/34912306
has answer: http://stackoverflow.com/a/22880141
has body: I am aware about interning, but what if I had something like the following: String str = "before"; str = "after"; Since they are not the same string, would a new object of String be created for "after", and if so what happens to "before"? Just to clarify, when does interning automatically happen? Only when two Strings with the same literal are created?
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
has title: Does creating a String in java automatically make a new object of String?
answer count: 1

http://stackoverflow.com/comment/34941667
has text: yes. i did used. then i thought it would not necessary since it is not just provide mutable it also has aditional function which is overhead in this case. and to me MutableLong version in apache more apt. since just provides the mutable
comment on: http://stackoverflow.com/q/22896404
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35075470
has text: Thanks. We actually decided to stay with Firefox for these regression tests. It was just easier for the server the program will get ported to.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22962879
type: AnswerComment

cryptography
tags question: http://stackoverflow.com/q/22905541
tag name: cryptography
tags question: http://stackoverflow.com/q/22957830
tags question: http://stackoverflow.com/q/22821419
type: Tag
tags question: http://stackoverflow.com/q/22872004
tags question: http://stackoverflow.com/q/22923586
tags question: http://stackoverflow.com/q/22897512
tags question: http://stackoverflow.com/q/22961140
tags question: http://stackoverflow.com/q/22893607

http://stackoverflow.com/comment/37200436
score: 0
type: Comment
has text: @CyberMew Yea sure its a better way
comment on: http://stackoverflow.com/a/22965940
type: AnswerComment

http://stackoverflow.com/comment/35065310
has text: And still XSS is the wrong term - cross site scritping is usually referring to attacks in the browser. What you like to prevent is SQL-Injection - and this is completely 100% safely avoided by using Bind-Variables!
type: Comment
comment on: http://stackoverflow.com/a/22961987
score: 0
type: AnswerComment

http://stackoverflow.com/q/22955495
has body: I used Class Option in java as a replacement for the use of null with better type checks. http://functionaljava.googlecode.com/svn/artifacts/2.20/javadoc/fj/data/Option.html My question is how to serialize / deserialize my following code in JSON ? public Option&lt;? extends ClassA&gt; a; The result of serialization by using ObjectMapper is always: "a" : [ "Option$Some", { "none" : false, "some" : true } ] and the deserialization does not work. Thanks for any reponse. p/s: i paste my full code is as the following: public class TestOption { @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@class") @JsonSubTypes({ @JsonSubTypes.Type(value = SoundDog.class, name = "soundDog"), @JsonSubTypes.Type(value = SoundCat.class, name = "soundCat"), }) public static abstract class Sound { abstract String getSound(); } public static class SoundDog extends Sound { @Override String getSound() { return "gau gau"; } } public static class SoundCat extends Sound { @Override String getSound() { return "meo meo"; } } @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "dog"), @JsonSubTypes.Type(value = Cat.class, name = "cat"), }) public static abstract class Animal { public Animal() { } public Animal(String name) { this.name = name; } public String name; public Animal parent; public Option&lt;? extends Sound&gt; sound; } @JsonTypeName("dog") public static class Dog extends Animal { public Dog() { } public Dog(String name) { super(name); } } @JsonTypeName("cat") public static class Cat extends Animal { public Cat() { } public Cat(String name) { super(name); } } public static void main(String... args) throws Exception { TestOption zoo = createZoo(); ObjectMapper mapper = new ObjectMapper(); mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); String json1 = mapper.writerWithDefaultPrettyPrinter() .writeValueAsString(zoo); System.out.…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22956094
downvote count: 0
linked to: http://stackoverflow.com/q/10723826
favorite count: 0
tagged with: serialization
type: Question
score: 5
has comment: http://stackoverflow.com/comment/35050244
answer count: 1
accepted answer: http://stackoverflow.com/a/22956094
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/35048841
has comment: http://stackoverflow.com/comment/35048127
upvote count: 5
has comment: http://stackoverflow.com/comment/35048495
has title: How to serialize / deserialize a Option<> class (functional java) with JSON?

http://stackoverflow.com/a/22948141
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/22947596
answers question: http://stackoverflow.com/q/22947596
has comment: http://stackoverflow.com/comment/35036299
has body: Retrieve the date that the user selected by calling getDate(), which returns a Date object. Then convert that object into a String by calling SimpleDateFormat.format(): Date d; SimpleDateFormat sdf; String s; d = dateChooser.getDate(); // Date selected by user sdf = SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); // Or whatever format you need s = sdf.format(d); // Viola See also: Question 5683728
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35035616

http://stackoverflow.com/q/22844042
possible better answer: http://stackoverflow.com/a/22848729
has answer: http://stackoverflow.com/a/22848729
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/22969801
accepted answer: http://stackoverflow.com/a/22969801
tagged with: tableview
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34877808
has body: I'm currently trying to add some images from a decoded video to a TableView row and they are not appearing. Only empty TableColumns. The TableView has been designed in JavaFx Scene Builder along with the Label. Here's what I got so far: public class MainScreenController implements Initializable { @FXML private Label previewBoxLabel; @FXML private TableView tableView; private ObservableList&lt;ImageView&gt; imageList = FXCollections.observableArrayList(); @FXML public void AddClipBeta(){ //Code which uses an external class in order to decode video (Variables Frames, width and height are not shown but are present in the actual code) VideoSegment clip = new VideoSegment(0, file.getPath(), 0, Frames, width, height); //Opens the file in decoding class - ready to output frames try{clip.openFile();} catch(Exception e){} //First frame is updated on the preview box previewBoxLabel.setGraphic(new ImageView(convertToFxImage(clip.getThumbnail()))); System.out.println(file.getPath()); int i =0; //While loop in test phase to see whether or not 10 frames will be visible in the table while(i != 10){ //Creates and sets columns to tableView TableColumn&lt;ImageView, ImageView&gt; col = new TableColumn&lt;ImageView, ImageView&gt;(); col.setPrefWidth(100); //Set width of column tableView.getColumns().add(col); col.setCellFactory(new Callback&lt;TableColumn&lt;ImageView, ImageView&gt;, TableCell&lt;ImageView, ImageView&gt;&gt;() { @Override public TableCell&lt;ImageView, ImageView&gt; call(TableColumn&lt;ImageView, ImageView&gt; p) { TableCell&lt;ImageView, ImageView&gt; cell = new TableCell&lt;ImageView, ImageView&gt;(){ }; return cell; } }); //Adds current frame to list imageList.add(new ImageView(convertToFxImage(clip.getThumbnail()))); //Gets next video frame try{clip.getNextFrame();} catch(Exception e){} //Updates counter i++; } //Sets list of frames on the table tableView.setItems(imageList); } // There is a problem with this implementation: transparent pixels on the BufferedImage…
type: Question
has title: Inserting Images into a TableView JavaFX - Images not displayed
tagged with: javafx-2
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34846887

http://stackoverflow.com/comment/34919280
type: Comment
comment on: http://stackoverflow.com/a/22884026
has text: Aren't the two solutions you stated the same?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34804871
comment on: http://stackoverflow.com/a/22818051
has text: I get the error 'cannot convert from AlertDialog.Builder to AlertDialog'
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34962829
type: Comment
has text: Let's do the math, then. For each of the 100 bins you get space occupied by 1, 2 ... 1000, therefore each bin and it's history (free space) is 1 + 2 + ... + 1000 = 1000 * 999 / 2 = 499500 values, where you expect 1000 values. That's where the 500x ratio comes.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22906550

http://stackoverflow.com/q/22945665
has body: I have been trying various ways of getting VisualVM to see my Tomcat web application. I have the config in Eclipse to allow it to control the Tomcat installation. I have all my temp directories set to c:\development\temp in Eclipse, VisualVM, and Tomcat. I have tried setting CATALINA_TMPDIR, -Djava.io.tmpdir in VM arguments of Eclipse launch configurations, and everything else I can find on the web. Only Tomcat does not create hsperfdata_USERNAME in the c:\development\temp directory. It keeps writing to c:\users\XXX\appdata\temp. Am I missing something?
type: Question
has comment: http://stackoverflow.com/comment/35109927
has answer: http://stackoverflow.com/a/22990273
tagged with: tomcat
has comment: http://stackoverflow.com/comment/35109717
score: 0
answer count: 1
tagged with: windows-7
tagged with: visualvm
type: UnansweredQuestion
has title: Eclipse Kepler, Tomcat 7, on Windows 7, VisualVM cannot see tomcat
has comment: http://stackoverflow.com/comment/35091206
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/22823421
has body: You could use a CountDownLatch which you create before the runLater and count down at the end of the Runnable
type: Answer
answers question: http://stackoverflow.com/q/22821129
score: 0

http://stackoverflow.com/q/22915267
favorite count: 0
has comment: http://stackoverflow.com/comment/34979746
has comment: http://stackoverflow.com/comment/34978094
has answer: http://stackoverflow.com/a/22916779
has comment: http://stackoverflow.com/comment/34985989
tagged with: testng
has answer: http://stackoverflow.com/a/22922338
possible better answer: http://stackoverflow.com/a/22916779
tagged with: selenium
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34979045
upvote count: 5
tagged with: java
has title: TestNG Using @Factory and @DataProvider
has comment: http://stackoverflow.com/comment/34987198
accepted answer: http://stackoverflow.com/a/22922338
has comment: http://stackoverflow.com/comment/34983370
tagged with: webdriver
type: Question
tagged with: testing
answer count: 2
score: 5
has body: I'm very new using TestNG and Java programming in general and I have a question in regards to using @Factory and @DataProvider together. I want to test submitting a web form multiple times with different input data every time. I have the following code: public class SolicitudEmpleo extends LaunchBrowser { private String campoDni; private String firstName; private String lastName; @Factory (dataProvider="dataProviderMethod") public SolicitudEmpleo(String campoDni, String firstName, String lastName){ this.campoDni=campoDni; this.firstName = firstName; this.lastName = lastName; } @DataProvider public static Object[][] dataProviderMethod() { return new Object[][] { {"000007", "Bill", "Gates"}, {"000008", "Stack", "Overflow"} }; } When I run my test cases, the data provider will always use the last values contained in the array. For example, if I run the test now it will input the values: "000008", "Stack", "Overflow" into the web form and completely ignore "000007", "Bill", "Gates". Thanks!! EDIT: I printed all three Strings in the function: @Factory (dataProvider="dataProviderMethod") public SolicitudEmpleo(String campoDni, String firstName, String lastName){ this.campoDni=campoDni; this.firstName = firstName; this.lastName = lastName; System.out.println(campoDni); System.out.println(firstName); System.out.println(lastName); } Console: 000007 Bill Gates 000008 Stack Overflow EDIT 2: I'll post the entire code with the test cases so you guys can take a look and see if you can spot the mistake: public class SolicitudEmpleo extends LaunchBrowser { private String campoDni; private String firstName; private String lastName; @Factory (dataProvider="dataProviderMethod") public SolicitudEmpleo(String campoDni, String firstName, String lastName){ this.campoDni=campoDni; this.firstName = firstName; this.lastName = lastName; System.out.println(campoDni); System.out.println(firstName); System.out.println(lastName); } @DataProvider public static Object[][] dataProviderMethod() { ret…
downvote count: 0

http://stackoverflow.com/comment/35047452
type: AnswerComment
has text: Thank you for your answer. I actually didn't have a lib folder so I addded it and referenced the jar as shown in http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java) I then checked the library but I am still facing the same problem :(
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22954980

http://stackoverflow.com/comment/34912799
has text: What is the canonicalization method you are using?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22872603

http://stackoverflow.com/a/22908712
answers question: http://stackoverflow.com/q/22908520
type: Answer
has body: inherent means Existing in something as a permanent. it has nothing to do with inheritance.. by default,or already some methods are thread safe...in order to protect or avoid multitasking problems.. vector,hash table..are some of the example classes that are inherently thread safe.. nothing..confusing..there are some functions..which is thread safe by default..
downvote count: 2
score: 1
upvote count: 3

http://stackoverflow.com/comment/34983717
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22919727
has text: Still a bit unclear to me, but yes, once you put "something" it considers the something to be of type string. You can always declare a separate integer and get an integer from that string using Integer.parseInt() though.
type: AnswerComment

http://stackoverflow.com/comment/34993606
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22924469
has text: Looks good for me too with similar code: [GifTest](http://luniks.net/other/GifTest.png)
score: 0

http://stackoverflow.com/comment/35053892
type: QuestionComment
score: 0
has text: @Gooseman let me check that
type: Comment
comment on: http://stackoverflow.com/q/22956975

http://stackoverflow.com/comment/34971065
comment on: http://stackoverflow.com/a/22912847
type: AnswerComment
has text: Sounds good to me. But we still have filter and limit, after a filter and limit some of the items will not be processed
score: 0
type: Comment

http://stackoverflow.com/comment/35042048
comment on: http://stackoverflow.com/a/22951824
type: Comment
score: 1
type: AnswerComment
has text: @HotLicks It's a bit dangerous to talk about the compiler doing things that actually happen at run time.

http://stackoverflow.com/q/22910826
score: 0
has title: 0000-00-00 Date in Axis
type: UnansweredQuestion
type: Question
tagged with: jakarta-ee
tagged with: java
has answer: http://stackoverflow.com/a/22911591
tagged with: axis
answer count: 1
has body: I have the following task: I have to build a masive WS client with over 400 methods and very complex requests and responses, i am using axis 1.4, the WS is on a legacy system that i can not change. The problem I'm facing is the responses for some of the methods contains the date: "0000-00-00" when the field is not filled. Caused by: org.xml.sax.SAXException: Invalid date java.lang.NumberFormatException: Invalid date at org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:180) [axis-1.4.jar:] at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:502) [axis-1.4.jar:] at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087) [axis-1.4.jar:] at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171) [axis-1.4.jar:] at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) [axis-1.4.jar:] at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) [axis-1.4.jar:] at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) [axis-1.4.jar:] at org.apache.axis.client.Call.invoke(Call.java:2467) [axis-1.4.jar:] I have managed to get it working by manually changing the fields into String and formating them to Date when needed, but in my opinion that is not an elegant solution. Does anyone know how can I do this better. Thank you

http://stackoverflow.com/comment/35077391
type: Comment
comment on: http://stackoverflow.com/a/22954647
has text: Depending on width and frequency of the pulses, DFT is a poor choice if the OP intends to detect pulses that are any more often than twice the window period. If any kind frequency discrimination is required, this is a pretty poor bit-rate.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34918682
comment on: http://stackoverflow.com/a/22879857
type: Comment
has text: Ultimately I think I'll have to compromise in some fashion here. Perhaps let users define a limit after which the notification will stack turn into a single stack or produce another activity in the application that represents the notifications in some fashion.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22880618
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22880356
answers question: http://stackoverflow.com/q/22880356
score: 2
type: AcceptedAnswer
downvote count: 0
has body: For more complex queries (including JOINs, etc.) you might want to consider using UCanAccess. For more information see a related question here.

http://stackoverflow.com/comment/35127029
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22942829
type: Comment
has text: Javadoc for `getClass`: "_The actual result type is `Class<? extends |X|>}` where `|X|` is the erasure of the static type of the expression on which `getClass` is called._". Sound like you have to live with that warning.

http://stackoverflow.com/q/22845780
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34853223
type: Question
has comment: http://stackoverflow.com/comment/34870553
has body: I have developed an application which is communicating via bluetooth with another device. The device keeps sending data, but the application form a point stops processibg these data. The data are strings. I get them from the inputstream of my bluetoothsocket and then I deliver them to my Handler in order for them to be displayed on a TextView. Here is my thread: public class ConnectThread extends Thread { private String address; private boolean connectionStatus; ConnectThread(String MACaddress) { address = MACaddress; connectionStatus = true; } public void run() { try { BluetoothDevice device = btAdapter.getRemoteDevice(address); try { btSocket = device.createRfcommSocketToServiceRecord(SPP_UUID); } catch (IOException e) { connectionStatus = false; } }catch (IllegalArgumentException e) { connectionStatus = false; } btAdapter.cancelDiscovery(); try { btSocket.connect(); } catch (IOException e1) { try { btSocket.close(); connectionStatus = false; } catch (IOException e2) { } } try { outStream = btSocket.getOutputStream(); } catch (IOException e2) { connectionStatus = false; } try{ inStream = btSocket.getInputStream(); }catch (IOException e2){ } if (connectionStatus) { mHandler.sendEmptyMessage(1); }else { mHandler.sendEmptyMessage(0); } int bytes; while (true) { try { byte[] b = new byte[64]; bytes = inStream.read(b); mHandler.obtainMessage(MESSAGE_RECEIVE, bytes, -1, b).sendToTarget(); } catch (IOException e) { break; } } } } And here is my Handler: mHandler = new Handler() { @Override public void handleMessage(Message msg) { if (myProgressDialog.isShowing()) { myProgressDialog.dismiss(); myclip.stop(); } if (msg.what == 1) { connectStat = true; if(multi){ connect_button_m.setText(R.string.connected); }else{ connect_button.setText(R.string.connected); } microcOut = 0; ledStat = false; write(microcOut); }else if(msg.what == 2){ byte[] readBuf = (byte[]) msg.obj; String strIncom = new String(readBuf, 0, msg.arg1); sb.append(strIncom); int endOfLineIndex = sb.indexOf("/…
tagged with: bluetooth
has title: How to free the inStream Buffer in android application?
tagged with: handler
tagged with: buffer

currency
tag name: currency
type: Tag
tags question: http://stackoverflow.com/q/22966666

http://stackoverflow.com/comment/34836587
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22838489
has text: Are the jar files located in E:\Java\ACP\Cricket folder because if the jars are not located their you need to link them in the compiler. http://stackoverflow.com/questions/6069702/java-command-line-with-external-jar

http://stackoverflow.com/q/22936057
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/22936377
tagged with: spring
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: aspectj
has title: Intercept overloaded method via AOP
has body: I have service that has several overloaded methods, for example: MyService.execute(Long id); MyService.execute(Collection collection); And i need to intercept only execution of 'MyService.execute(Long id)' via AOP like: @Aspect @Component public class AopInterseptor{ @After("execution(* my.Service.MyService.execute(..))") public void intercept(JoinPoint joinPoint) throws Exception { // Do stuff } } Is it possible to do so?
tagged with: spring-aop
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22936377

http://stackoverflow.com/q/22862442
downvote count: 0
linked to: http://stackoverflow.com/q/2237803
favorite count: 0
has body: Is there a way to fetch parameter names of Interfaces from compiled source at runtime? Use case: I am creating some proxy instances based on some interfaces. I need to get parameter names to create some SQL statements. Any help?
type: Question
has comment: http://stackoverflow.com/comment/34879761
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/22862586
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/34879720
accepted answer: http://stackoverflow.com/a/22862586
has title: Preserving parameter names in java interfaces
has comment: http://stackoverflow.com/comment/34879632
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/34901690
comment on: http://stackoverflow.com/q/22873501
score: 0
type: QuestionComment
type: Comment
has text: @JustinPollard - I haven't tried google's volley library but I will look into it. I used the progress bar since the functionality of the apps depends on the data being retrieved. So if I make them cancelable and put it to background the app won't have any functionality at all. And the user might be surprised that something just popped up after the data was loaded on background

http://stackoverflow.com/q/22819110
has comment: http://stackoverflow.com/comment/34802356
has answer: http://stackoverflow.com/a/22819602
tagged with: servlets
has title: (Explanation required) retrieve image from computer folder
score: 0
answer count: 1
tagged with: jsp
favorite count: 0
accepted answer: http://stackoverflow.com/a/22819602
has comment: http://stackoverflow.com/comment/34802613
has comment: http://stackoverflow.com/comment/34802726
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8516387
has comment: http://stackoverflow.com/comment/34802673
has comment: http://stackoverflow.com/comment/34802838
tagged with: java
has body: I have been following http://balusc.blogspot.in/2007/07/fileservlet.html but couldn't get it right with my code as i am not understanding much of it ... filePath = request.getServletContext().getRealPath("")+File.separator+"images"+File.separator+"photo.jpg"; System.out.println(filePath); // Get requested file by path info. String requestedFile = request.getPathInfo(); System.out.println(requestedFile); // Check if file is actually supplied to the request URI. if (requestedFile == null) { // Do your thing if the file is not supplied to the request URI. // Throw an exception, or send 404, or show default/warning page, or just ignore it. response.sendError(HttpServletResponse.SC_NOT_FOUND); // 404. System.out.println("terminates"); return; } what i get out of this is the program terminates here as the requestedFile is null all the time... can anyone help me go through the code.... Any Help will be appreciated !!! Thanks in advance !!!
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/a/22863887
score: 8
has comment: http://stackoverflow.com/comment/34882596
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34882417
accepted answer of: http://stackoverflow.com/q/22863844
has body: Short answer: it doesn't matter. Long answer: It really doesn't matter at that low level. Even if you were to actually compare the executed machine code, there are so many things in between (the JIT compiler for one, all sorts of CPU caches for other). Gone are the times when you needed to micro-optimize things like this. What you need to make sure is that you're using effective algorithms. And as always, premature optimization is the root of all evil. I noted that you wrote "I just always wonder what is the best way for my code". The best way is to write clear code, so that other people can understand what you're doing (if they saw code like in your examples, they would think you're insane). Another old adage was that in order for the JVM to optimize your code in the best way, you should write "dumb code". The JIT optimizer can then understand the code better and convert it to a more efficient form.
has comment: http://stackoverflow.com/comment/34882560
upvote count: 8
answers question: http://stackoverflow.com/q/22863844
type: Answer
has comment: http://stackoverflow.com/comment/34883012
has comment: http://stackoverflow.com/comment/34883306

http://stackoverflow.com/a/22963019
upvote count: 1
has body: The PDE files that are available in that project are simply text files. You can either use them in your code directly, or better yet, try to understand what they're doing and adapt the code to your own purposes. But to answer your question, you don't include PDE files in a Java project. You included the Processing library jars on your classpath, which give you access to things like the PApplet class. Then you can include a PApplet (which is just like a Processing sketch, in fact a Processing sketch is a PApplet) in your Java application and pass it whatever information you want. More info here: http://processing.org/tutorials/eclipse/
type: Answer
answers question: http://stackoverflow.com/q/22959131
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22959131
type: AcceptedAnswer

http://stackoverflow.com/comment/35011871
type: Comment
type: QuestionComment
has text: replace the **comma** with a **dot**.
comment on: http://stackoverflow.com/q/22935466
score: 4

http://stackoverflow.com/comment/34911334
type: QuestionComment
comment on: http://stackoverflow.com/q/22879646
has text: You can't. A class is only aware of its direct parent.
score: 4
type: Comment

http://stackoverflow.com/comment/35069970
type: AnswerComment
has text: @Disputed This is exactly what I mean. Step through your code with the debugger and make sure that every line executes successfully.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22963176

http://stackoverflow.com/comment/35028672
type: AnswerComment
has text: this is a pretty clever method! but this is a pretty simple test, I think I'd prefer to do a thread.sleep above the verify rather than adding this degree of complexity. thread.sleep is dirty, but its easy to understand and its in a suite of long-running tests.
comment on: http://stackoverflow.com/a/22944544
score: 0
type: Comment

http://stackoverflow.com/a/22900839
answers question: http://stackoverflow.com/q/22900816
type: Answer
has body: In the lines like String sDia = String.format("%2d",Integer.toString(dia)); get rid of the Integer.toString(..) call. The d pattern used in %2d expects an integral value, but you are passing it a String. Simply do String sDia = String.format("%2d", dia);
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22900816

http://stackoverflow.com/a/28693983
answers question: http://stackoverflow.com/q/22855749
score: 5
upvote count: 5
type: Answer
downvote count: 0
has body: @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if(!s.toString().matches("^\\ (\\d{1,3}(\\,\\d{3})*|(\\d+))(\\.\\d{2})?$")) { String userInput= ""+s.toString().replaceAll("[^\\d]", ""); StringBuilder cashAmountBuilder = new StringBuilder(userInput); while (cashAmountBuilder.length() &gt; 3 &amp;&amp; cashAmountBuilder.charAt(0) == '0') { cashAmountBuilder.deleteCharAt(0); } while (cashAmountBuilder.length() &lt; 3) { cashAmountBuilder.insert(0, '0'); } cashAmountBuilder.insert(cashAmountBuilder.length()-2, '.'); cashAmountBuilder.insert(0, ' '); edAmountAddMoney.setText(cashAmountBuilder.toString()); // keeps the cursor always to the right Selection.setSelection(edAmountAddMoney.getText(), cashAmountBuilder.toString().length()); } } i use space instead of $ and it work for me

http://stackoverflow.com/a/22874506
score: 1
upvote count: 1
has body: You are in a infinite loop because you're never changing the value of secondBoolean. You should to this inside your while loop. Also, don't forget to initialize you secondBoolean variable before the loop (setting secondBoolean = false, so your loop will run at least once).
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22874439

http://stackoverflow.com/q/22893381
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22893415
has answer: http://stackoverflow.com/a/22893415
has title: Is collection synchronizing (via Collections.synchronizedX) necessary when access methods are synchronized?
downvote count: 0
has answer: http://stackoverflow.com/a/22893421
answer count: 3
has answer: http://stackoverflow.com/a/22893425
has body: There is a lot of topics when synchronization in Java appears. In many of them is recommended to using invokation of Collections.synchronized{Collecation, List, Map, Set, SortedMap, SortedSet} instead of Collection, List, etc. in case of multithreading work to thread-safe access. Lets imagine situation when some threads exist and all of them need to access collection via methods that have synchronized block in their bodies. So then, is it necessary to use: Collection collection = Collections.synchronizedCollection(new ArrayList&lt;T&gt;()); or only Collection collection = new ArrayList&lt;String&gt;(); need to? Maybe you can show me an example when second attempt instead of first will cause evidently incorrect behaviour?
favorite count: 0
tagged with: synchronization
tagged with: multithreading
upvote count: 1
accepted answer: http://stackoverflow.com/a/22893421
type: AnsweredQuestion

http://stackoverflow.com/q/22878604
linked to: http://stackoverflow.com/q/3327077
type: Question
linked to: http://stackoverflow.com/q/19163889
has comment: http://stackoverflow.com/comment/34909843
has comment: http://stackoverflow.com/comment/34911497
has answer: http://stackoverflow.com/a/22878850
has comment: http://stackoverflow.com/comment/34909900
accepted answer: http://stackoverflow.com/a/22879255
upvote count: 3
answer count: 2
downvote count: 2
possible better answer: http://stackoverflow.com/a/22878850
has comment: http://stackoverflow.com/comment/34910683
has comment: http://stackoverflow.com/comment/34909789
tagged with: collections
tagged with: java
has body: Hi guys i got this as an interview question and was having trouble with it. I am familiar with generics/collections &amp; iterator but the manner i which the Collection is declared completely threw me. Heres the question: Contained in the provided workspace is cocI, the start of a class that implements an Iterator that can be used to iterate a Collection of Collections. The Collection of Collections is passed into the constructor of the class. The Iterator should iterate through the contents depth-first. For example, if the Collection of Collections looks like the following: [0] – [“A”, “B”, “C”] [1] – [“D”] [2] – [“E”, “F”] The iterator should then return the contents in the following order: “A”, “B”, “C”, “D”, “E”, “F” Q.Provide implementations for the hasNext() and next() methods in cocI Thanks import java.util.Collection; import java.util.Iterator; public class cocI implements Iterator&lt;Object&gt; { private Collection&lt;Collection&lt;Object&gt;&gt; _collOfColl = null; public cocI(Collection&lt;Collection&lt;Object&gt;&gt; collofColl) { _collOfColl = collofColl; } public boolean hasNext() { // TODO implement this method return false; } public Object next() { // TODO implement this method return null; } public void remove() { throw new UnsupportedOperationException(); } }
has comment: http://stackoverflow.com/comment/34910063
has title: Interview: Collections Iterator
has comment: http://stackoverflow.com/comment/34910011
tagged with: iterator
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22879255
score: 1
has comment: http://stackoverflow.com/comment/34909735
has comment: http://stackoverflow.com/comment/34909763
favorite count: 0

http://stackoverflow.com/comment/34978919
score: 1
comment on: http://stackoverflow.com/a/22916324
type: AnswerComment
has text: `chmod 777` is worse than just "publishing" the data for everyone (i.e. allowing them to read it) - every user is also able to modify or delete it.
type: Comment

http://stackoverflow.com/comment/34885980
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22862117
type: Comment
has text: You can use reflection provided your main method does not explicitly throw ReflectionExceptions such IllegalAccessException or .However,you may need to modify your code if your main method chooses to throw such exceptions

http://stackoverflow.com/comment/35014677
score: 2
type: Comment
type: QuestionComment
has text: Look at the related questions on the right. You'd find examples of split on a delimiter except within ...
comment on: http://stackoverflow.com/q/22937065

http://stackoverflow.com/comment/34937528
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22894094
has text: Use a Swing based `Timer` (single shot) that closes the window after the required time.
score: 1

http://stackoverflow.com/comment/34943670
type: Comment
comment on: http://stackoverflow.com/a/22897090
has text: That sounds more like a flaw in ANdroid that there's any way to install an app without a direct action from the user. It still seems to me to be an odd way to have fixed the flaw, as it still allows installation of the app (which will likely eventually be run as a user will sometime see the icon and go "what's this?").
type: AnswerComment
score: 0

http://stackoverflow.com/q/22922850
has body: I'm trying to create word encrypted and decrypter using Java. Having initialized a char array of the alphabet, I'm attempting to shuffle it (and create the crypt code) by copying into another array of Character class in order to do Collections.shuffle. I don't get any compilation errors, but get a NullPointerException when attempting to run the code. Do let me know if you have any insight into my issue: my Cryptogram constructor to shuffle the alphabet: public class Cryptogram { private char [] alphabet = { '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' }; private char [] cryptCode; public Cryptogram( ) { cryptCode = new char[alphabet.length]; Character[] anAlphabet = new Character[alphabet.length]; for (int i = 0; i &lt; alphabet.length; i++) { alphabet[i] = anAlphabet[i]; } List&lt;Character&gt; cryptList = Arrays.asList(anAlphabet); Collections.shuffle(cryptList); Object ob[] = cryptList.toArray(); for (int j = 0; j &lt; anAlphabet.length; j++){ cryptCode[j] = anAlphabet[j]; } } my user input class: import java.util.Scanner; public class CryptogramClient { public static void main( String [] args ) { Cryptogram cg = new Cryptogram( ); System.out.println( cg ); // print alphabet and substitution code } } Exception: java.lang.NullPointerException at Cryptogram.&lt;init&gt;(Cryptogram.java:39) at CryptogramClient.main(CryptogramClient.java:16) 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 edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:272)
has answer: http://stackoverflow.com/a/22922919
has title: Shuffling character array in Java producing NullPointerException
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: arrays
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/22922919
favorite count: 0

http://stackoverflow.com/comment/34822313
comment on: http://stackoverflow.com/q/22829814
score: 0
type: QuestionComment
type: Comment
has text: No answer from the community :(

method-reference
tags question: http://stackoverflow.com/q/22936972
tags question: http://stackoverflow.com/q/22959427
tag name: method-reference
tags question: http://stackoverflow.com/q/22945870
type: Tag

http://stackoverflow.com/q/22860441
upvote count: 2
tagged with: android
score: 2
type: AnsweredQuestion
has title: Open the phone default launcher when clicking a button
tagged with: java
has comment: http://stackoverflow.com/comment/34917577
accepted answer: http://stackoverflow.com/a/22860617
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/9787658
has comment: http://stackoverflow.com/comment/34906408
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34880957
linked to: http://stackoverflow.com/q/18804002
has body: I want to open the phone default launcher, where all the phone's applications are displayed, whenever i click my button. I've tried to look up for an answer but i couldn't find one, Is that even possible? Maybe by passing a category to an intent?
favorite count: 0
has answer: http://stackoverflow.com/a/22860617

http://stackoverflow.com/comment/34930648
type: AnswerComment
has text: The main problem with such aggregator is that it handles messages synchronously, one by one. So, if I get message of a type with huge timeout - all other messages would wait. That is why I started using DelayedQueue.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22887051

http://stackoverflow.com/comment/34866428
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22850946
score: 0
has text: can you give me example source code link

http://stackoverflow.com/comment/35050015
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22895632
has text: Does your INPUT line include the folders that contain the interface files?
score: 0

http://stackoverflow.com/q/22959314
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/35056928
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/20486743
has answer: http://stackoverflow.com/a/22962144
tagged with: wsdl
tagged with: soap
tagged with: http://stackoverflow.com/tag/xml
upvote count: 3
type: UnansweredQuestion
tagged with: web-services
has comment: http://stackoverflow.com/comment/35055330
has body: I have a requirement of creating SOAP request xml for one operation from wsdl. I researched and tried the solution of the blog "Java: Get Sample Request XML from wsdl" , 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/" please suggest how can I rectify it. Is there any other approach which I can take apart from this? Thanks in advance !!
has comment: http://stackoverflow.com/comment/35057134
type: Question
score: 3
has title: Creating SOAP request from wsdl

http://stackoverflow.com/comment/34966717
score: 0
type: AnswerComment
type: Comment
has text: i understand where the 500 comes from. what i meant was that even if i calculated the expected size "properly" the ratio would still be around the same (and increase with time). i also think my use case should be more common than you think - any use case where you retain data samples of any sort would involve ever-increasing values being stored
comment on: http://stackoverflow.com/a/22906550

http://stackoverflow.com/q/22810712
type: Question
answer count: 1
tagged with: build-process
has answer: http://stackoverflow.com/a/22817282
has body: i newby in Gradle Projects. I receive now a project and i need to import then to Eclipse. Gradle is installed and work fine. When i go to Eclipse and try to import a grandle project using build model i got this error message. FAILURE: Build failed with an exception. Where: Build file 'C:\application\xpto\git-repo\xpto\xpto\Workspace\build.gradle' line: 42 What went wrong: A problem occurred evaluating root project 'Workspace'. C:\Users\myid\Downloads\eclipse-jee-juno-SR1-win32\eclipse.....\Distribution\gradle-settings\config.groovy (folder cannot b found) Try: Run with --info or --debug option to get more log output. Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'Workspace'. at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127) at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38) One important point. 1 - "Workspace" is the name from the Folder who i have my projects. I would like to know why during importing he is considering my eclipse Folder, where i can change it. here a short part of the build.gradle file. ext { xpto_buildBaseDir = "./../../" xpto_buildTempDir = "$xpto_buildBaseDir/_temp" xpto_buildFileDir = "$xpto_buildBaseDir/Build_Process/Distribution" xpto_buildSettingsDir = "$xpto_buildFileDir/gradle-settings" xpto_buildDir = "$xpto_buildTempDir/building directory" xpto_earDir = "$xpto_buildDir/ears" xpto_appConfDir = "$xpto_buildBaseDir/Application_Configuration" } and the row 42 we have. ext.config = new ConfigSlurper(environment).parse(new File("$buildSettingsDir/config.groovy").toURL()) I'm using Gradle 1.5 Anyone can help me in this case?
score: 0
type: UnansweredQuestion
has title: Error by importing Gradle Project into Eclipse
tagged with: java
tagged with: gradle

aspectj
tags question: http://stackoverflow.com/q/22899266
tags question: http://stackoverflow.com/q/22907538
tags question: http://stackoverflow.com/q/22923813
tags question: http://stackoverflow.com/q/22936057
tag name: aspectj
tags question: http://stackoverflow.com/q/22851919
tags question: http://stackoverflow.com/q/22923316
tags question: http://stackoverflow.com/q/22830516
tags question: http://stackoverflow.com/q/22852657
type: Tag
tags question: http://stackoverflow.com/q/22826526
tags question: http://stackoverflow.com/q/22961244
tags question: http://stackoverflow.com/q/22862310

http://stackoverflow.com/q/22830692
has body: I'm customizing my liferay theme for my own portal, I'm copy portal_normal.ftl to _diffs/templates and I saw this code : &lt;a class="${logo_css_class}" href="${site_default_url}" title="&lt;@liferay.language key="go-to" /&gt; ${site_name}"&gt; &lt;img alt="${logo_description}" height="${site_logo_height}" src="${site_logo}" width="${site_logo_width}" /&gt; &lt;/a&gt; I wonder that what is these ${logo_css_class}, ${site_default_url},${site_name},${logo_description} ? If it an attribute so where we will define it, and especial src="${site_logo}", is it a image url ? and how to define this attribute ? I want to change the src from ${site_logo} to a direct url like "it.tdt.edu.vn/wp-content/themes/cs_tdt/images/…; but it does work, so how do i change the picture in logo ? Thanks in advance.
tagged with: java
tagged with: dom
type: Question
tagged with: portal
tagged with: liferay
score: 0
has answer: http://stackoverflow.com/a/22836795
tagged with: freemarker
answer count: 3
has answer: http://stackoverflow.com/a/22830868
has answer: http://stackoverflow.com/a/40497413
type: UnansweredQuestion
has title: change logo in liferay portal

opencv
type: Tag
tags question: http://stackoverflow.com/q/22932575
tags question: http://stackoverflow.com/q/22948553
tags question: http://stackoverflow.com/q/22816777
tags question: http://stackoverflow.com/q/22921865
tags question: http://stackoverflow.com/q/22960273
tags question: http://stackoverflow.com/q/22881209
tags question: http://stackoverflow.com/q/22955429
tags question: http://stackoverflow.com/q/22958470
tags question: http://stackoverflow.com/q/22846748
tags question: http://stackoverflow.com/q/22898996
tag name: opencv
tags question: http://stackoverflow.com/q/22879481
tags question: http://stackoverflow.com/q/22952505
tags question: http://stackoverflow.com/q/22910047
tags question: http://stackoverflow.com/q/22966109
tags question: http://stackoverflow.com/q/22965277
tags question: http://stackoverflow.com/q/22962013
tags question: http://stackoverflow.com/q/22860603
tags question: http://stackoverflow.com/q/22929038
tags question: http://stackoverflow.com/q/22889903
tags question: http://stackoverflow.com/q/22955482
tags question: http://stackoverflow.com/q/22879005

http://stackoverflow.com/comment/34979020
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22917147
has text: The average of 2 scalars is a scalar, so I don't understand how you can update a vector (in colorspace) to a scalar.
type: Comment

http://stackoverflow.com/q/22931128
has title: How to decode qr code from SD card
has comment: http://stackoverflow.com/comment/35042568
has comment: http://stackoverflow.com/comment/35012966
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35054012
has body: I want to decode qr code from image on my sd card, and I don't want to use external scanner. I use Zxing library. I have some code @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView txt = (TextView)findViewById(R.id.textView1); ImageView img=(ImageView)findViewById(R.id.imageView1); img.setImageResource(R.drawable.qr); Bitmap bt = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getAbsolutePath()+"/cameraApplicationSe/qr.png"); img.setImageBitmap(bt); int [] pix = new int[bt.getWidth() * bt.getHeight()]; LuminanceSource qr=new RGBLuminanceSource(bt.getWidth(),bt.getHeight(),pix); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(qr)); Reader reader = new MultiFormatReader(); Result result; try { result = reader.decode(bitmap); txt.setText(result.getText()); } catch (NotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); txt.setText("NotFoundException"); } catch (ChecksumException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } } in Manifest file add user permission on Read and write external storage. in all attempt i receive in TextView - NotFoundException. In image I have QR code, independently created. in website. Where i have mistake? Please, help me.
has comment: http://stackoverflow.com/comment/35057865
answer count: 0
tagged with: java
tagged with: zxing
has comment: http://stackoverflow.com/comment/35010922
type: Question
has comment: http://stackoverflow.com/comment/35013073
has comment: http://stackoverflow.com/comment/35057347
score: 0

http://stackoverflow.com/comment/35031898
has text: Use either iText or PDFBox. They are the two main libraries for reading pdf files in Java
comment on: http://stackoverflow.com/q/22946141
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34951116
type: Comment
comment on: http://stackoverflow.com/a/22901608
score: 2
has text: +1 for typing faster, but I was also busy typing that you should not be using static variables as this is not necessary.
type: AnswerComment

http://stackoverflow.com/comment/35048495
score: 0
has text: i used Jackson ObjectMapper to serialize / deserialize. Can you give an example (or link) using Jackson marshaller ? Thanks Angelo Immediata.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22955495

http://stackoverflow.com/comment/34926440
type: Comment
comment on: http://stackoverflow.com/a/22887734
type: AnswerComment
has text: Pls give the reference to verify the answer
score: 0

http://stackoverflow.com/comment/34845976
score: 0
type: AnswerComment
has text: Great and simple, thank you I knew their had to be a way that was simple.
comment on: http://stackoverflow.com/a/22843638
type: Comment

http://stackoverflow.com/q/22898225
has answer: http://stackoverflow.com/a/22900401
has comment: http://stackoverflow.com/comment/35287575
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/35337851
tagged with: terminal
has title: How can you get the current caret position in terminal with Java?
has comment: http://stackoverflow.com/comment/35115953
has answer: http://stackoverflow.com/a/72991896
linked to: http://stackoverflow.com/q/2575037
has comment: http://stackoverflow.com/comment/35325816
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35112047
has body: I've looked at JLine, Lanterna, and others, but I'm not seeing a simple way to find the current caret position in the terminal with these tools. I've looked at a number of escape codes, tput, etc. But, I'm looking for the easiest way to get the current column and row where the caret is located with Java. Maybe I haven't found the right call in these libraries... What's the easiest way to get the row and column of the caret in the terminal? I'm looking for a pure textual library so that I can re-write the buffer. I'm aware of ansi escape codes and how to manipulate them to produce the effects I'm after. What I'm trying to do is make a Java prompt library in the vain of Inquirer.js for Node. It has a number of simple ways to get info from the user (lists, questions, split lists, etc). All of it text -- so all of it without a UI, and so non-swing. I don't want swing, I just want a decent terminal UI experience.
type: Question
has comment: http://stackoverflow.com/comment/35110068
tagged with: java
has comment: http://stackoverflow.com/comment/35111985
has comment: http://stackoverflow.com/comment/35113027
has comment: http://stackoverflow.com/comment/35312776
upvote count: 4
has comment: http://stackoverflow.com/comment/35384229
answer count: 2
has comment: http://stackoverflow.com/comment/35111821
downvote count: 0
linked to: http://stackoverflow.com/q/60134860

http://stackoverflow.com/q/22831937
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22832360
tagged with: android
has body: I'm trying to create a listview to show users that can be added by pressing a ToggleButton. The problem is that when you press a toggleButton more than one id is returned, and every time I move the scroll more ids are returned .. without pressing any. :S App Screenshot (only one click in the first element): LogCat recieving on SELECCIONAT(checked) AND DESSELECCIONAT(unchecked) TAGS (2 times the first element, and one time the second element.. with only one click... The code: MyAdapter: public class MyAdapter extends ArrayAdapter&lt;Usuari&gt; { private final List&lt;Usuari&gt; list; private final Activity context; boolean checkAll_flag = false; boolean checkItem_flag = false; public MyAdapter(Activity context, List&lt;Usuari&gt; list) { super(context, R.layout.row, list); this.context = context; this.list = list; } static class ViewHolder { protected TextView nom_usuari; protected ToggleButton boto_agregar; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { LayoutInflater inflator = context.getLayoutInflater(); convertView = inflator.inflate(R.layout.row, null); viewHolder = new ViewHolder(); viewHolder.nom_usuari = (TextView) convertView .findViewById(R.id.nom_usuari); viewHolder.boto_agregar = (ToggleButton) convertView .findViewById(R.id.boto_agregar); viewHolder.boto_agregar .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { int getPosition = (Integer) buttonView.getTag(); // Here // we // get // the // position // that // we // have // set // for // the // checkbox // using // setTag. list.get(getPosition).setSelected( buttonView.isChecked()); // Set the value of // checkbox to // maintain its // state. String nom = list.get(getPosition).getName(); if (isChecked) { Log.d("SELECCIONAT", nom); } else { Log.d("DESSELECCIONAT", nom); } } }); convertView.setTag(viewHolder); conv…
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: getview
tagged with: listview
type: Question
has title: ListView error getting one OnCheckedChange position
upvote count: 1

http://stackoverflow.com/a/22954737
has comment: http://stackoverflow.com/comment/35046916
has comment: http://stackoverflow.com/comment/35047031
has comment: http://stackoverflow.com/comment/35047078
has comment: http://stackoverflow.com/comment/35047145
has comment: http://stackoverflow.com/comment/35046664
score: 0
has comment: http://stackoverflow.com/comment/35046485
type: Answer
has comment: http://stackoverflow.com/comment/35047196
has comment: http://stackoverflow.com/comment/35046711
answers question: http://stackoverflow.com/q/22954620
has body: override onPostExecute method of Async Task which will be called as soon the task is completed and show your toast there
has comment: http://stackoverflow.com/comment/35046635

http://stackoverflow.com/a/22949630
type: Answer
has comment: http://stackoverflow.com/comment/35037832
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/22949347
accepted answer of: http://stackoverflow.com/q/22949347
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35037912
has body: RFC 2616 defines that "the Content-Disposition response-header field has been proposed as a means for the origin server to suggest a default filename if the user requests that the content is saved to a file" so I don't think you can do what you intend to through your servlet. Maybe you will have better luck with some script in the pdf : you could imagine parsing its own name to dynamically set it at the right anchor at opening.
upvote count: 3

http://stackoverflow.com/q/22839931
type: UnansweredQuestion
favorite count: 0
type: Question
answer count: 0
upvote count: 2
has body: I have found the same question Here, and I tried to do the same for my project, but I can't get the results, can anyone check my code below and tell me where have I make a mistake. What I want to do is to get a Table where columns are the aircrafts and the rows are the work packages of each aircraft and the cells are the jobs in each work package of each aircraft. the XHTML is: &lt;h:form id="globalreport"&gt; &lt;p:layout&gt; &lt;p:layoutUnit position="north"&gt; &lt;p:selectOneMenu id="model" value="#{userInterfaceMB.model}"&gt; &lt;f:selectItem itemLabel="All models" itemValue="" /&gt; &lt;f:selectItems value="#{userInterfaceMB.getAllAvailableModels()}" /&gt; &lt;p:ajax update="aircraftTable"listener="#{userInterfaceMB.handleModelChange()}" /&gt; &lt;/p:selectOneMenu&gt; &lt;/p:layoutUnit&gt; &lt;p:layoutUnit position="center"&gt; &lt;p:dataTable id="aircraftTable" var="workPackageId" value="# {userInterfaceMB.workPackagesIds}" rowIndexVar="rowIdx"&gt; &lt;p:column headerText="" styleClass="ui-widget-header"&gt; &lt;h:outputText value="#{workPackageId}" /&gt; &lt;/p:column&gt; &lt;p:columns var="aircraftId" value="# {userInterfaceMB.aircraftsIds}" headerText="#{aircraftId}" columnIndexVar="colIdx"&gt; &lt;ui:repeat value="#{userInterfaceMB.myJobs[rowIdx][colIdx]}" var="myJob"&gt; &lt;p:panel&gt; &lt;h:outputText value="#{myJob}" /&gt; &lt;/p:panel&gt; &lt;/ui:repeat&gt; &lt;/p:columns &lt;/p:dataTable&gt; &lt;/p:layoutUnit&gt; &lt;/p:layout&gt; &lt;/h:form&gt; &lt;/h:body&gt; And here's my ManagedBean: @ManagedBean(name="userInterfaceMB") @SessionScoped @ComponentScan("com.") public class UserInterfaceBean implements Serializable{ private static final long serialVersionUID = 1L; //TODO Autowired is not working, get it to work @Autowired private DBDataManipulatorService dbDataManipulatorService; private int aircraftId; private String type; private String model; private List&lt;String&gt; workPackagesIds; private List&lt;Integer&gt; aircraftsIds; private ArrayList&…
has title: How can I create a table as matrix with primefaces (3D Table somehow)?
tagged with: primefaces
tagged with: java
tagged with: jsf-2
score: 2
linked to: http://stackoverflow.com/q/16350122
downvote count: 0

http://stackoverflow.com/comment/34965791
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22909755
has text: Wow that did work it out. Please Modify your answer so I can accept.

http://stackoverflow.com/comment/34835262
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22837420
has text: @INK - That would retrieve the site domain as well, which I don't think they want.

http://stackoverflow.com/comment/35102935
comment on: http://stackoverflow.com/q/22959493
type: Comment
type: QuestionComment
has text: You can always deserialize the JSON, modify it, then reserialize to pass to your existing kluge.
score: 0

http://stackoverflow.com/comment/34853124
comment on: http://stackoverflow.com/q/22847455
has text: Maybe the problem resides here: Go to java problems/warnings and check if theres no warning with this library. If it exist, select the quick fix
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34860287
comment on: http://stackoverflow.com/q/22851123
has text: possible duplicate of [Java inverse matrix calculation](http://stackoverflow.com/questions/1992638/java-inverse-matrix-calculation)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22864164
linked to: http://stackoverflow.com/q/7456327
favorite count: 0
type: UnansweredQuestion
has body: Is there a programmatic way to read all the widget a GWT page or Panel contains? I have several error labels in my form, all suffixed by "ErrorLabel" and I'd like to find them and clear them. I can do a list of them, but I figured out I can actually automate that if I had some... I am using UiBinder.
has answer: http://stackoverflow.com/a/22864607
tagged with: gwt
has comment: http://stackoverflow.com/comment/34883075
has answer: http://stackoverflow.com/a/22867791
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34883031
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34883181
has comment: http://stackoverflow.com/comment/34882906
tagged with: uibinder
has answer: http://stackoverflow.com/a/52671579
answer count: 3
has comment: http://stackoverflow.com/comment/34883335
has title: List all the widgets of a page/panel in GWT

http://stackoverflow.com/comment/34830159
type: QuestionComment
has text: Is 1.7 set as your Runtime Environment?
score: 2
comment on: http://stackoverflow.com/q/22834938
type: Comment

http://stackoverflow.com/q/22841414
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34841988
has title: OpenJPA Eager Fetching
upvote count: 2
possible better answer: http://stackoverflow.com/a/22842906
has comment: http://stackoverflow.com/comment/34842630
has comment: http://stackoverflow.com/comment/34842792
tagged with: jpa-2.0
favorite count: 0
has answer: http://stackoverflow.com/a/22982853
accepted answer: http://stackoverflow.com/a/22982853
tagged with: openjpa
has body: I use OpenJPA 2.3 bundled with WebSphere 8.5 and I have to read a lot of data from a table. I also have to fetch a lot of relations with the root entity. Atm I am using the criteria API to create the search query and select the entities. I annotated all collections with EAGER. When I check the logfile it creates 5 Queries to fetch all children. That is the way I want it. The catch is that I have to filter a lot in java after the select and stop after 1000 matching entities. So I thought i specify the fetch size and stop reading entities from the db as soon I have my 1k results. If I introduce the FetchBatchSize setting, OpenJPA creates single queries for each entity to load the children. (n+1 problem) I also tried to use the fetch join syntax directly in my query, but without any success. So what am I doing wrong? I tried: 1) query.setHint("openjpa.FetchPlan.FetchBatchSize", 1000); query.setHint("openjpa.FetchPlan.ResultSetType", "SCROLL_INSENSITIVE"); 2) OpenJPAQuery&lt;?&gt; kq = OpenJPAPersistence.cast(query); JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan(); fetch.setFetchBatchSize(1000); fetch.setResultSetType(ResultSetType.FORWARD_ONLY); fetch.setFetchDirection(FetchDirection.FORWARD); fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.UNKNOWN); The entity: @Entity @Table(name = "CONTRACT") public class Contract { // omitted the other properties. The other relationships are annotated the same way @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "contract") private List&lt;Vehicle&gt; vehicles= new ArrayList&lt;Vehicle&gt;(); The query: CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery&lt;Contract&gt; crit = cb.createQuery(Contract.class); crit.distinct(true); Root&lt;Contract&gt; r = crit.from(Contract.class); // omited the where clause. In worst case I have a full table scan without any where clause. (the reason I need the batch size) Fetch&lt;Contract, Vehicle&gt; fetchVehicles = r.fetch("vehicles", JoinType.LEFT); // I trie…
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22842906
tagged with: java
has comment: http://stackoverflow.com/comment/34843967

http://stackoverflow.com/comment/34976969
score: 0
comment on: http://stackoverflow.com/q/22915512
type: QuestionComment
has text: I'm so stupid sometimes...it worked! Can't say how much I'm grateful!! Thank you so much!
type: Comment

http://stackoverflow.com/a/22872377
downvote count: 0
has body: You could try to change faces/index.xhtml to faces/index.jsf And make sure you have following lines in your web.xml Faces Servlet *.jsf Faces Servlet *.xhtml
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22861724
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22861724

http://stackoverflow.com/a/22869552
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22862253
score: 2
type: AcceptedAnswer
has body: You need to stop debugging and start the program again since the signature has changed. If you want more hot-swap possibilities you need to consider using JRebel or similar tool.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22862253

http://stackoverflow.com/q/22886641
has comment: http://stackoverflow.com/comment/34924157
type: Question
tagged with: apache
has comment: http://stackoverflow.com/comment/34924591
score: 0
has body: I am working on a project and the task wants me to sort through 10,000 lines from an .xlsx file. I got it working with apache.org.poi jars but it is going extremely slow to just read the line and put it in an array. Is there any other way to read excel .xlsx files (that is quicker) that does not involve apache? Thank you
linked to: http://stackoverflow.com/q/16890206
has comment: http://stackoverflow.com/comment/34924443
type: UnansweredQuestion
tagged with: excel
has title: Is there any other way to read .xlsx in Java than apache.org.poi?
has comment: http://stackoverflow.com/comment/34924564
answer count: 0
tagged with: java

http://stackoverflow.com/a/22928973
upvote count: 1
answers question: http://stackoverflow.com/q/22928858
score: 1
downvote count: 0
type: Answer
has body: You can do something like boolean isExists = true; try { driver.findElement(By.id("previewFrame"); // No exception means frame is present } catch (NoSuchElementException e) { // Exception, no such frame is present isExists = false; }

http://stackoverflow.com/q/22947362
answer count: 1
tagged with: android-activity
has body: emphasized text 04-09 02:16:18.029: E/AndroidRuntime(6560): FATAL EXCEPTION: main&lt;br&gt; 04-09 02:16:18.029: E/AndroidRuntime(6560): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.game.lutung/com.game.lutung.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class &lt;unknown&gt; &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at android.app.ActivityThread.access$1500(ActivityThread.java:117) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at android.os.Handler.dispatchMessage(Handler.java:99) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at android.os.Looper.loop(Looper.java:123) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at android.app.ActivityThread.main(ActivityThread.java:3683) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at java.lang.reflect.Method.invokeNative(Native Method) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at java.lang.reflect.Method.invoke(Method.java:507) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at dalvik.system.NativeStart.main(Native Method) &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class &lt;unknown&gt; &lt;br&gt;04-09 02:16:18.029: E/AndroidRuntime(6560): at android.view.LayoutInflater.createVi…
favorite count: 0
upvote count: 2
tagged with: android
downvote count: 2
has title: java.lang.RuntimeException : Unable to start activity
tagged with: android-intent
has answer: http://stackoverflow.com/a/22947434
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/22947434
score: 0
has comment: http://stackoverflow.com/comment/35033864

http://stackoverflow.com/comment/34887154
type: QuestionComment
has text: @dasblinkenlight: Look at the accepted answer there. I presume that this is the explanation sought by the OP.
comment on: http://stackoverflow.com/q/22866454
score: 0
type: Comment

http://stackoverflow.com/q/22966769
tagged with: keyevent
tagged with: java
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/35068052
has answer: http://stackoverflow.com/a/22966977
tagged with: keylistener
score: 0
tagged with: keypress
answer count: 1
type: UnansweredQuestion
has body: I'm trying to create a brickbreakers game. Obviously i'm still struggling with the beginning of it. I need my "block" to move but if i press some key my code won't even go in the keyPressed()-method. Does anybody know why? import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class VGKernel extends JPanel implements KeyListener { public Rectangle screen, ball, block; // The screen area and ball location/size. public Rectangle bounds; // The boundaries of the drawing area. public JFrame frame; // A JFrame to put the graphics into. public VGTimerTask vgTask; // The TimerTask that runs the game. public boolean down, right; // Direction of ball's travel. public VGKernel(){ super(); screen = new Rectangle(0, 0, 600, 400); ball = new Rectangle(0, 0, 20, 20); block = new Rectangle(0, 350, 40, 10); bounds = new Rectangle(0, 0, 600, 400); // Give some starter values. frame = new JFrame("VGKernel"); vgTask = new VGTimerTask(); addKeyListener(this); } class VGTimerTask extends TimerTask{ public void run(){ moveBall(); frame.repaint(); } } // Now the instance methods: public void paintComponent(Graphics g){ // Get the drawing area bounds for game logic. bounds = g.getClipBounds(); // Clear the drawing area, then draw the ball. 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(){ // Ball should really be its own class with this as a method. if (right) ball.x+=1; // If right is true, move ball right, else ball.x-=1; // otherwise move left. if (down) ball.y+=1; // Same for up/down. else ball.y-=1; if (ball.x &gt; (bounds.width - ball.width)) // Detect edges and bounce. { right = false; ball.x = bounds.width - ball.width; } if (ball.y &gt; (bounds.height - ball.height)) { down = false; ball.y = bounds.height - ball.height;} if (ball.x &lt;= 0) { right = true; ball.x = 0; } if (ball.y &lt;= 0) { down =…
has title: Why doesn't my code go in the keyPressed() method? (Even if i press keys)

http://stackoverflow.com/a/22834976
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22832524
type: Answer
has comment: http://stackoverflow.com/comment/34881898
has body: Have you specified form encryption type(enctype="multipart/form-data")?. That could be the reason sometimes. Ex: &lt;form method="post" name="formName" action="action.htm" commandName="object" enctype="multipart/form-data"&gt;

http://stackoverflow.com/comment/34915914
score: 0
type: QuestionComment
has text: Read about [PECS](http://stackoverflow.com/questions/2723397/java-generics-what-is-pecs).
type: Comment
comment on: http://stackoverflow.com/q/22882012

http://stackoverflow.com/q/22908869
has body: I have a coefficients, that I got in Matlab, of a low pass filter and I want to filter my signal using these coefficients, is there any function to filter my data in Java? In Matlab I use the "filter.m" function. If not, how can I create it? Best.
tagged with: java
has answer: http://stackoverflow.com/a/22908986
downvote count: 1
type: Question
upvote count: 0
tagged with: signals
has title: Filtering signal in Java using coefficients
tagged with: filter
answer count: 1
score: -1
favorite count: 0
type: UnansweredQuestion
tagged with: matlab

http://stackoverflow.com/q/22900305
downvote count: 0
tagged with: jaxb2
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: How Add element to XML file?
score: 1
tagged with: java
has body: I used JAXB in generate my class but I have problem when insert element in my XML file, so I insert first time element in my file XML, but when insert second time all file is clear and re-write XML. I have classes (project,layer) and I am write method for insert Project and layer to XML file. Please help me how I can insert project in XML then insert layer in XML with out clear xml file each time write XML. This my class project : @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "Project") public class Project { @XmlElement(name = "Layer") protected List&lt;Layer&gt; layer; @XmlAttribute(name = "name") protected String name; public List&lt;Layer&gt; getLayer() { if (layer == null) { layer = new ArrayList&lt;Layer&gt;(); } return this.layer; } public String getName() { return name; } public void setName(String value) { this.name = value; } } this my class Layer: @XmlAccessorType(XmlAccessType.FIELD) public class Layer { @XmlElement(name = "LayerName", required = true) protected String layerName; @XmlAttribute(name = "idLayer") protected int idLayer; public String getLayerName() { return layerName; } public void setLayerName(String value) { this.layerName = value; } public int getIdLayer() { return idLayer; } public void setIdLayer(int i) { this.idLayer = i; } } Method insert project: public boolean Insert(Project entity) { Project pr = new Project(); pr.setName(entity.getName()); try { JAXBContext jc = JAXBContext.newInstance(Project.class); javax.xml.bind.Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); File XMLfile = new File("Projects//asdad//ProjectDataBase.xml"); marshaller.marshal(pr, XMLfile); } catch (JAXBException e) { e.printStackTrace(); } return false; } Method insert Layer: public boolean Insert(Layer entity) { Project pr = new Project(); pr.setName(pr.getName()); Layer addLayer = new Layer(); addLayer.setIdLayer(entity.getIdLayer()); addLayer.setLayerName(entity.getLayerNa…
type: Question

http://stackoverflow.com/a/22844030
answers question: http://stackoverflow.com/q/22843397
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: I'm unsure why you are using an ArrayList at all. What you are describing is a queue, a First-In-First-Out data structure. Java offers several Queue implementations that are thread-safe, notably ConcurrentLinkedQueue and LinkedBlockingQueue. An ArrayList is fundamentally not thread-safe, and the only way to make it so is by wrapping it in a call to Collections.synchronizedList() which will make read and write access to the array essentially single-threaded.

http://stackoverflow.com/q/22906025
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/22907243
tagged with: mysql
type: Question
has body: I have a DB in mysql, I want to show all the data in the DB as a list of chkbox with the data from the DB . and after selection of few checkbox i can fire query to DB for certain data about the selected ones. I have tried using listView below is my JAVA file and xml here is JAVA file public class BdaySelect extends Activity { private String jsonResult; private String url = "http://10.0.2.2/markit/login.php"; private ListView listView; private TextView textv1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bday_select); listView = (ListView) findViewById(R.id.listView1); textv1=(TextView)findViewById(R.id.textView1); accessWebService(); } @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; } // Async Task to access the web private class JsonReadTask extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(params[0]); try { HttpResponse response = httpclient.execute(httppost); jsonResult = inputStreamToString( response.getEntity().getContent()).toString(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } private StringBuilder inputStreamToString(InputStream is) { String rLine = ""; StringBuilder answer = new StringBuilder(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); try { while ((rLine = rd.readLine()) != null) { answer.append(rLine); } } catch (IOException e) { // e.printStackTrace(); Toast.makeText(getApplicationContext(), "Error..." + e.toString(), Toast.LENGTH_LONG).show(); } return answer; } @Override protected void onPostExecute(String result) { ListDrwaer(); } }// end async task public void accessWebService() { JsonReadTask tas…
tagged with: java
score: 0
answer count: 1
has title: How to show data from DB as a checkbox list in android

http://stackoverflow.com/q/22886083
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29515190
upvote count: 127
has answer: http://stackoverflow.com/a/22899758
has answer: http://stackoverflow.com/a/36219164
has title: How do I run a spring boot executable jar in a Production environment?
has body: Spring boot's preferred deployment method is via a executable jar file which contains tomcat inside. It is started with a simple java -jar myapp.jar. Now, I want to deploy that jar to my linux server on EC2, am I missing something or do I really need to create a init script to properly start the application as a daemon? If I simply call java -jar the application dies when I log out. I could start it in screen or nohup but that is not very elegant and a restart in my server would force me to log in and start the process manually. So, is there something already for the task in spring boot?
has comment: http://stackoverflow.com/comment/34923933
downvote count: 0
has comment: http://stackoverflow.com/comment/34931430
favorite count: 0
has comment: http://stackoverflow.com/comment/34923002
tagged with: linux
type: Question
tagged with: spring
score: 127
has comment: http://stackoverflow.com/comment/45700832
has comment: http://stackoverflow.com/comment/47377253
has answer: http://stackoverflow.com/a/41309626
has answer: http://stackoverflow.com/a/44205322
has answer: http://stackoverflow.com/a/29928639
has comment: http://stackoverflow.com/comment/34931221
has comment: http://stackoverflow.com/comment/50048105
linked to: http://stackoverflow.com/q/11203483
has comment: http://stackoverflow.com/comment/65751303
tagged with: spring-boot
has answer: http://stackoverflow.com/a/40491096
has comment: http://stackoverflow.com/comment/34923361
has answer: http://stackoverflow.com/a/31654838
linked to: http://stackoverflow.com/q/21503883
answer count: 9
has answer: http://stackoverflow.com/a/46277047
tagged with: java

http://stackoverflow.com/comment/60704564
comment on: http://stackoverflow.com/a/30399046
type: Comment
has text: Thanks for number 2 been siting with it for two hours
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34944867
score: 0
has text: Ok, right on, so i need to learn how to use SwingWorker. Got any examples or education material i can use to learn it?
comment on: http://stackoverflow.com/q/22898062
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35067979
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22965940
has text: String path = getServletContext().getRealPath("/"); i already added in my code

http://stackoverflow.com/comment/34836846
type: Comment
comment on: http://stackoverflow.com/q/22838644
score: 0
type: QuestionComment
has text: I want to Center the Selected Row. ie if my listview has 10 rows and i click on 2nd row it should be on the position where 5th row was. no matter if i would have to give padding to it. it would be good as far as it should work

http://stackoverflow.com/comment/34811232
has text: @SimonAndréForsberg Your statements are true regarding the syntax, but in Java 8 the latter fragment (which comes from skiwi's code) will compile but will fail at runtime with a `ClassCastException`. This is because the cast still does a runtime check, and `LinkedList` does not in fact implement `RandomAccess`. So there's no way to fake it this way.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22819804

http://stackoverflow.com/comment/34965269
has text: Because of anonymous inner class, this has to be a constant
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22909674

http://stackoverflow.com/a/22958239
has comment: http://stackoverflow.com/comment/35076667
has body: An hibernate entity must define a no argument constructor. Source: http://coding.tocea.com/java/java-frameworks/hibernate/hibernate-entity-does-not-define-no-argument-constructor/
has comment: http://stackoverflow.com/comment/35075448
downvote count: 0
answers question: http://stackoverflow.com/q/22949652
type: Answer
has comment: http://stackoverflow.com/comment/35075699
has comment: http://stackoverflow.com/comment/35074229
has comment: http://stackoverflow.com/comment/35075070
upvote count: 1
score: 1

web-services
type: Tag
tags question: http://stackoverflow.com/q/22928283
tags question: http://stackoverflow.com/q/22918231
tags question: http://stackoverflow.com/q/22819876
tags question: http://stackoverflow.com/q/22954407
tags question: http://stackoverflow.com/q/22813994
tags question: http://stackoverflow.com/q/22816979
tags question: http://stackoverflow.com/q/22830601
tags question: http://stackoverflow.com/q/22852425
tags question: http://stackoverflow.com/q/22933521
tags question: http://stackoverflow.com/q/22959208
tags question: http://stackoverflow.com/q/22892848
tags question: http://stackoverflow.com/q/22812783
tags question: http://stackoverflow.com/q/22898163
tags question: http://stackoverflow.com/q/22868236
tags question: http://stackoverflow.com/q/22872046
tags question: http://stackoverflow.com/q/22955177
tags question: http://stackoverflow.com/q/22850882
tags question: http://stackoverflow.com/q/22922744
tags question: http://stackoverflow.com/q/22957753
tags question: http://stackoverflow.com/q/22882330
tags question: http://stackoverflow.com/q/22940719
tags question: http://stackoverflow.com/q/22860027
tags question: http://stackoverflow.com/q/22910880
tags question: http://stackoverflow.com/q/22932468
tags question: http://stackoverflow.com/q/22923085
tags question: http://stackoverflow.com/q/22931138
tags question: http://stackoverflow.com/q/22936367
tags question: http://stackoverflow.com/q/22959314
tags question: http://stackoverflow.com/q/22832595
tags question: http://stackoverflow.com/q/22811484
tags question: http://stackoverflow.com/q/22965861
tags question: http://stackoverflow.com/q/22904872
tags question: http://stackoverflow.com/q/22880105
tags question: http://stackoverflow.com/q/22958966
tags question: http://stackoverflow.com/q/22844002
tags question: http://stackoverflow.com/q/22868791
tags question: http://stackoverflow.com/q/22860009
tags question: http://stackoverflow.com/q/22821590
tags question: http://stackoverflow.com/q/22819887
tags question: http://stackoverflow.com/q/22953714
tag name: web-services
tags question: http://stackoverflow.com/q/22872603
tags question: http://stackoverflow.com/q/22883088
tags question: http://stackoverflow.com/q/22951850
tags question: http://stackoverflow.com/q/22857190
tags question: http://stackoverflow.com/q/22952138
tags question: http://stackoverflow.com/q/22834231
tags question: http://stackoverflow.com/q/22862341
tags question: http://stackoverflow.com/q/22966690
tags question: http://stackoverflow.com/q/22929382
tags question: http://stackoverflow.com/q/22922423

http://stackoverflow.com/comment/35065264
type: Comment
has text: Can you please provide an example number that has a solution and would run too slow with the permutation algorithm?
comment on: http://stackoverflow.com/a/22958898
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35044932
type: QuestionComment
comment on: http://stackoverflow.com/q/22953533
has text: I have a feeling , you need to debug the type and gsonfeed before passing these to fromJson function, check if it's having data or null value ??
score: 0
type: Comment

http://stackoverflow.com/a/22918820
answers question: http://stackoverflow.com/q/22918681
type: Answer
has comment: http://stackoverflow.com/comment/34982718
score: 0
has body: Try out this library Android-Universal-Image-Loader

http://stackoverflow.com/comment/35040465
comment on: http://stackoverflow.com/q/22950063
score: 0
type: Comment
type: QuestionComment
has text: @ElliottFrisch I've been trying to use a Servlet to send to anchor tag in PDF by changing the URL (e.g. forwarding). Are you saying that is possible?

http://stackoverflow.com/comment/35049121
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22956100
type: Comment
has text: tried this ..it did not work..not sure where i am wrong in this.

http://stackoverflow.com/comment/35069019
has text: I think he wants to change STDOUT to the command prompt.
comment on: http://stackoverflow.com/q/22967110
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22935474
type: Question
has body: I want to call my method in fxml file after user click on text field, but see exception: Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch My fxml tag: &lt;TextField fx:id="userId" onMouseClicked="#processEnter" /&gt; What can I do?
has title: TextField events in Java FX
tagged with: fxml
accepted answer: http://stackoverflow.com/a/22935619
score: 0
answer count: 1
tagged with: java
tagged with: javafx
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22935619

http://stackoverflow.com/a/22877135
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34907094
type: Answer
has comment: http://stackoverflow.com/comment/34907335
accepted answer of: http://stackoverflow.com/q/22876963
upvote count: 3
answers question: http://stackoverflow.com/q/22876963
has body: Why am I getting java.util.ConcurrentModificationException?. Because you are modifying a collection while iterating it. Where am I modifying 'concurrently' as the Exception name implies? You are modifying it when you call poll(). That call removes the first element of the queue (if there is one) ... and that is a modification to the queue. Is assigning itself a modification as it internally uses poll()? I am talking about for(String str: pq) line. There each element in the pq is being assigned to the str in one iteration right? No. It is not using poll internally. It wouldn't make sense! The for loop creates an Iterator and then calls hasNext() and next() on it. But those calls are not allowed to modify the underlying collection. The poll method does modify the underlying collection, so it clearly can't be used. (But feel free to find / read the source code for PriorityQueue.) I should note that when I (and the other answers) are talking about iterating, we are referring to the explicit or implicit use of an Iterator object provided by the Collection object. And when you apply an "enhanced" for loop to a collection, you are implicitly creating and using an Iterator. By contrast, @Shekhar's solution is NOT using an Iterator so there is no issue with CME's in his code. One thing still I don't get is why does for-each create an Iterator? It does so because the Java Language Specification says it does! This is how Java implements "for each" iteration for this kind of object. You can read all about it in the spec - JLS 14.14.2. (But note that no iterator is created when you apply an "enhanced" for loop to a array.)

http://stackoverflow.com/a/52671579
type: Answer
answers question: http://stackoverflow.com/q/22864164
score: 0
has body: Something like that private void myFunction(RootPanel panel) { for (Widget w : panel) { if(w instanceof Label){ //do something } } }

http://stackoverflow.com/q/22899711
type: AnsweredQuestion
tagged with: java
has title: Unfortunately,"App" has stopped, OnClickListener
tagged with: eclipse
tagged with: android-emulator
accepted answer: http://stackoverflow.com/a/22899738
type: Question
has body: i'm new here. I just wrote this code, but on my emulator I get the message "unfortunately, "App" has stopped. Here are my codes. I don't know where the error is, maybe you do. MainActivity.java package com.nando.testile; import android.app.Activity; import android.app.ActionBar; import android.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.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; import android.os.Build; public class MainActivity extends Activity implements OnClickListener{ Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button=(Button)findViewById(R.id.button1); button.setOnClickListener(this); } @Override public void onClick(View v) { Toast.makeText(MainActivity.this, "button was clicked", Toast.LENGTH_LONG).show(); } } fragment_main.xml &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" &gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /&gt; &lt;/LinearLayout&gt; Logcatfile 04-06 16:20:45.831: W/dalvikvm(2642): threadid=1: thread exiting with uncaught exception (group=0xb1cadb20) 04-06 16:20:45.841: E/AndroidRuntime(2642): FATAL EXCEPTION: main 04-06 16:20:45.841: E/AndroidRuntime(2642): Process: com.nando.testile, PID: 2642 04-06 16:20:45.841: E/AndroidRuntime(2642): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nando.testile/com.nando.testile.MainActivity}: java.lang.NullPointerException 04-06 16:20:45.841: E/AndroidRuntime(2642): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)…
tagged with: adt
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22899738
tagged with: android
upvote count: 1

http://stackoverflow.com/comment/35321390
score: 0
type: Comment
has text: Be Careful with saving on Exit - that one's a bitch, because the User expects "save on exit" also to work when exiting the Application via Alt+F4 or on automatic exit on Computer-Shutdown. On Shutdown can only be catched with a JVM-Exit-Hook and even then not reliably. Better save your settings in regular intervals!
type: AnswerComment
comment on: http://stackoverflow.com/a/22964064

http://stackoverflow.com/comment/34876387
comment on: http://stackoverflow.com/q/22860582
score: 2
has text: possible duplicate of [Type parameter vs unbounded wildcard](http://stackoverflow.com/questions/18142009/type-parameter-vs-unbounded-wildcard)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34998418
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22918195
has text: @user3504419 I dont see in your code "CalculatorFrame" is a JFrame ??? Its a main class. and you cant open the main class.
type: AnswerComment

http://stackoverflow.com/q/22811845
has body: How can i replace a microsoft word document variable value with a value from a java variable ? I have a .doc or .docx file template in which i have defined some variables. When user click on download button from my app the .doc or .docx variables must get the value from java variables.
has answer: http://stackoverflow.com/a/43357631
tagged with: ms-word
has title: pass values from java variables to microsoft word (doc and docx) variables
tagged with: http://stackoverflow.com/tag/docx
has comment: http://stackoverflow.com/comment/34834576
linked to: http://stackoverflow.com/q/17093781
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34788717
has answer: http://stackoverflow.com/a/24595401
tagged with: doc
type: Question
has comment: http://stackoverflow.com/comment/34941876
answer count: 2
has comment: http://stackoverflow.com/comment/34876035
has comment: http://stackoverflow.com/comment/34833494
score: 0

http://stackoverflow.com/a/22875601
type: Answer
has comment: http://stackoverflow.com/comment/34905145
upvote count: 4
has comment: http://stackoverflow.com/comment/34905135
downvote count: 0
has body: "Is it possible to add JDesktopPane and JInternalFrame to a JPanel" Sure you can desktop = createDesktopPane(); JInternalFrame iFrame = createInternalFrame(); desktop.add(iFrame); JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(new TitledBorder("DesktopPane")); panel.add(desktop); import java.awt.BorderLayout; import java.awt.Graphics; import java.awt.Image; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.TitledBorder; public class JDesktopPaneDemo1 { private static final String URL_ONE = "http://www.hdbackgroundspoint.com/wp-content/uploads/2013/12/16/345t34.jpeg"; private static final String URL_TWO = "http://www.hdbackgroundspoint.com/wp-content/uploads/2013/09/hh.jpeg"; private Image image; private JDesktopPane desktop; public JDesktopPaneDemo1() { desktop = createDesktopPane(); JInternalFrame iFrame = createInternalFrame(); desktop.add(iFrame); JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(new TitledBorder("DesktopPane")); panel.add(desktop); JFrame frame = new JFrame("Desktop Background"); frame.setContentPane(panel); frame.setSize(500, 350); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); iFrame.setVisible(true); } public JDesktopPane createDesktopPane() { JDesktopPane pane = new JDesktopPane() { private Image image; { try { image = ImageIO.read(new URL(URL_ONE)); } catch (IOException e) { e.printStackTrace(); } } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, 0, 0, getWidth(), getHeight(), this); } }; return pane; } private JInternalFrame createInternalFrame() { JInternalFrame frame = new JInternalFrame(); frame.setSize(20…
score: 4
answers question: http://stackoverflow.com/q/22874818

http://stackoverflow.com/comment/35069175
type: QuestionComment
comment on: http://stackoverflow.com/q/22967035
has text: `http://123.45.67.89/somefile.html` - though some kinds of multiple-sites-per-server schemes won't work without knowing the name of the server you are seeking.
score: 0
type: Comment

http://stackoverflow.com/a/22836304
has comment: http://stackoverflow.com/comment/34832926
has comment: http://stackoverflow.com/comment/34832796
type: Answer
has comment: http://stackoverflow.com/comment/34833646
has comment: http://stackoverflow.com/comment/34832887
answers question: http://stackoverflow.com/q/22835509
score: 0
has body: this will work in your particular case beacause the data you are scraping is in this format and the below regex will work in most cases. I am not saying that this is the perfect answer but I should tell you that this will keep you going: find [a-z]\s[A-Z] and replace with \1\2 demo here : http://regex101.com/r/kF8vG6

http://stackoverflow.com/comment/34865818
comment on: http://stackoverflow.com/a/22854415
has text: I tried this but didn't work .. I have posted my new manifest / new logcat after this addition .
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22904527
has body: You've got three loops, and your inner loop goes through the whole range of the deck - and assigns a card to it which doesn't depend on the index: for (int i = 0; i &lt; theDeck.length; i++) { theDeck[i] = new Card(s,v); } So for each value of s and v you're overwriting the whole deck with the same card. The final card you create is the king of spades, hence the problem. I suspect you don't want that inner loop at all - instead, work out the index to use based on s and v: for (int s = 1; s &lt;= 4; s++) { for (int v = 1; v &lt;= 13; v++) { int index = (s - 1) * 13 + (v - 1); theDeck[index] = new Card(s, v); } } Or keep a separate index variable and just increment that: int index = 0; for (int s = 1; s &lt;= 4; s++) { for (int v = 1; v &lt;= 13; v++) { theDeck[index] = new Card(s, v); index++; } }
answers question: http://stackoverflow.com/q/22904482
score: 3
accepted answer of: http://stackoverflow.com/q/22904482
has comment: http://stackoverflow.com/comment/34956462
has comment: http://stackoverflow.com/comment/34956424
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/comment/66254700
type: AnswerComment
type: Comment
score: 0
has text: @User10001 But if I have `ins = null` in public static ReceiverActivity `getInstance() { Log.d("RECEIVER_ACTIVITY", "getInstance => "+String.valueOf(ins)); return ins; }` what i should do with it?
comment on: http://stackoverflow.com/a/22870274

http://stackoverflow.com/q/22821129
tagged with: javafx-8
answer count: 3
downvote count: 0
has body: I have a presentation class storing an XYChart.Series object and updating it by observing the model. The Series updating is done by using Platform.runLater(...) I want to unit-test this, making sure the commands in runLater are performed correctly. How do I tell the unit-test to wait for the runLater commands to be done? Right now all I do is Thread.Sleep(...) on the test-thread to give the FXApplicationThread the time to complete, but that sounds stupid.
has answer: http://stackoverflow.com/a/22823421
favorite count: 0
has answer: http://stackoverflow.com/a/57885088
has answer: http://stackoverflow.com/a/22846799
tagged with: javafx-2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/57885088
tagged with: java
tagged with: unit-testing
type: Question
accepted answer: http://stackoverflow.com/a/22846799
upvote count: 9
has title: Wait for Platform.RunLater in a unit test
score: 9

http://stackoverflow.com/q/22827906
type: Question
has comment: http://stackoverflow.com/comment/34821661
tagged with: struts2
has comment: http://stackoverflow.com/comment/34819727
score: 0
type: UnansweredQuestion
has body: In my application, I am getting hold of spring ApplicationContext inside Struts2 action, using ApplicationContextAware interface. To invoke the Service method(Spring service), I am using the below code private ABCService abcService; abcService=(ABCService)ApplicationContextUility.getSpringBean("ABCSeviceImpl"); /** * @return the abcService */ public ABCService getAbcService() { return abcService; } /** * @param abcService the abcService to set */ public void setAbcService(ABCService abcService) { this.abcService = abcService; } Here even if I cast it to ABCServiceImpl, instead of ABCService or I remove the getter/setter methods for abcService, code flow works. Can someone throw some light on this? I found the answer. Both the cases the bean would get injected. But if we cast it to ABCServiceImpl instead of ABCService, proxy wont work. Incase you want to intercept this class using proxy.
tagged with: spring
has title: Spring bean injection in Struts2 action using ApplicationContextAware interface
answer count: 0
tagged with: java

http://stackoverflow.com/q/22950156
type: Question
has title: returning null do nothing
has body: my program is 90% done for an assignment but i keep getting one error. It says "If WavIO.read() returns null, no change should be made to the current samples array." No idea what to change. Also, Im new to writing javadocs, whats the proper way to write a javadoc for the constructors/methods and the @params etc. Here is my code: public class Sound { private String fileName; private double [] samples; /** * initializes the empty Sound array. */ public Sound() { this.samples = new double[0]; } /** * Makes copy sound object of given sound. */ public Sound(Sound pSound) { double[] temp; temp = new double[pSound.samples.length]; for (int i = 0; i &lt; temp.length; i++) { temp[i] = pSound.samples[i]; } this.samples = temp; } /** * get the array of sound samples * @return samples */ public double[] get() { return samples; } /** * increase volume of sound by given percent * @param double how much to increase volume by */ public void increaseVol(double percent) { // percent = percent/100.0; for (int i = 0; i &lt; samples.length; i++) { samples[i] = samples[i] * (1.0 + percent); } } /** * reduce volume of sound by given percent * @param double how much to reduce volume by */ public void reduceVol(double percent) { //percent = percent/100.0; for (int i = 0; i &lt; samples.length; i++) { samples[i] = samples[i] * (1.0 - percent); } } /** * lengthen sound duration by two */ public void lengthen() { double[]t = new double[samples.length]; for (int i = 0; i &lt; samples.length; i++) { t[i] = samples[i]; } samples = new double[t.length * 2]; for (int i = 0; i &lt; samples.length; i++) { samples[i] = t[i / 2]; } } /** * shorten sound duration by half. */ public void shorten() { double[]t = new double[samples.length]; if ( samples.length % 2 == 0) { t = new double[samples.length / 2]; } else { t = new double[samples.length / 2 + 1]; } int j = 0; for (int i = 0; i &lt; t.length; i++) { t[i] = samples[j]; j = j + 2; } samples = t; } /** * reverse the sound */ public void reverse() { fo…
tagged with: wav
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22950178
type: UnansweredQuestion
tagged with: io
tagged with: java
tagged with: javadoc

heroku
tags question: http://stackoverflow.com/q/22922922
tags question: http://stackoverflow.com/q/22960234
type: Tag
tag name: heroku

http://stackoverflow.com/comment/34978783
comment on: http://stackoverflow.com/q/22917135
has text: You're probably overthinking this. Modularization doesn't have anything to do with multiple main methods; you call main once, and then your application calls library functions (which don't have main methods).
score: 4
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34901096
comment on: http://stackoverflow.com/q/22873748
has text: @BheshGurung that will depend on your design. If you have a `Short`, then you can only return the current value as `int`. If you have a `Long`, you can define to return `Integer.MAX_VALUE` to avoid overflow...
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/22898861
has title: Usability: How do I provide & easily deploy a (preferably node.js + MongoDB based) server backend for my users?
score: 0
tagged with: java
tagged with: usability
has comment: http://stackoverflow.com/comment/34946259
type: Question
answer count: 2
has body: I'm currently planing an application (brainstorming, more or less), designed to be used in small organizations. The app will require syncronization w/ a backend-server, e.g. for user management and some advanced, centralized functionality. This server has to be hosted locally and should be able to run on Linux, Mac and Windows. I haven't decided how I'm going to realize this, mainly I simply don't know which would be the smartest approach. Technically speaking, a very interessting approach seemed to be node.js + mongoose, connecting to a local MongoDB. But this is where I'm struggeling: How do I ensure that it's easy and convienient for a organization's IT to set this up? Installing node.js + MongoDB is tedious work and far from standartized and easy. I don't have the ressources to provide a detailled walthrough for every major OS and configuration or do take over the setup myself. Ideally, the local administrator should run some sort of setup on the machine used as server (a "regular" PC running 24/7 should suffice) and have the system up and running, similar to the way some games provide executables for hosting small game-servers for a couple friends (Minecraft, for instance). I also thought about Java EE, though I haven't dug into an details here. I'm unsure about whether this is really an option. Many people suggest to outsource the backend (BaaS), e.g. to parse.com or similar services. This is not an option, since it's mandatory that the backend will be hosted locally. I'm sorry if this question is too unspecific, but unfortunately, I really don't know where to start.
tagged with: administration
has answer: http://stackoverflow.com/a/22899505
has answer: http://stackoverflow.com/a/38721127
type: UnansweredQuestion
tagged with: backend
tagged with: node.js

http://stackoverflow.com/q/22825364
possible better answer: http://stackoverflow.com/a/22825422
has comment: http://stackoverflow.com/comment/34813485
has title: Processing an array from a class in another class
accepted answer: http://stackoverflow.com/a/22825435
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34813456
type: Question
has body: I'm having difficulty processing an array of numbers from a class file (Scores.java) within a separate class file (ProcessScores.java). Adding Scores.main(); within the main void of ProcessScores.java does print the array but my attempts to work with the output have failed. For instance, int[] numbers = Scores.main(); throws the error "Incompatible Types. Required: int[], Found: void". I understand that I'm calling the main void from the Scores class so my question is... How can I get the output from the Scores class into the ProcessScores class in a way that I can work with it?
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/22825422
has answer: http://stackoverflow.com/a/22825435
score: 0

http://stackoverflow.com/a/22956825
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22956562
answers question: http://stackoverflow.com/q/22956562
score: 1
type: AcceptedAnswer
downvote count: 0
has body: I am a little confused by the compareTo method. This defines the natural order right? So what does (this._title.compareTo(o._title)) actually do? The natural order of Strings is their lexicographical order. try: if (arg0._time &gt; arg1._time){ return -1 } else if (arg0._time &lt; arg1._time){ return 1; } else { return arg0._title.compareTo(arg1._title); }

http://stackoverflow.com/a/22837921
upvote count: 1
type: AcceptedAnswer
has body: Take a look on the stop-condition found || counter &lt; ArrayToSearch.size(). What if you've found the needed element? In such a case found will be true and stop-condition will always be true, your loop will never stop. The correct loop is the following: public static boolean Search(ArrayList&lt;String&gt; ArrayToSearch,String word) { String temp; for(int counter = 0;counter &lt; ArrayToSearch.size();counter++) { temp = ArrayToSearch.get(counter); if(temp.equals(word.toLowerCase())) { position = counter; return true; } } return false; }
type: Answer
accepted answer of: http://stackoverflow.com/q/22837805
downvote count: 0
answers question: http://stackoverflow.com/q/22837805
score: 1

http://stackoverflow.com/comment/34892831
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22857783
has text: Thank you very much for the answer. It helps a lot. Another question is this a good way of typing json manually and sending it to a post call or is there a suggestion you can provide?

http://stackoverflow.com/a/31702951
has body: I used below method to check if a given date falls in current week public boolean isDateInCurrentWeek(Date date) { Date currentWeekStart, currentWeekEnd; Calendar currentCalendar = Calendar.getInstance(); currentCalendar.setFirstDayOfWeek(Calendar.MONDAY); while(currentCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) { currentCalendar.add(Calendar.DATE,-1);//go one day before } currentWeekStart = currentCalendar.getTime(); currentCalendar.add(Calendar.DATE, 6); //add 6 days after Monday currentWeekEnd = currentCalendar.getTime(); Calendar targetCalendar = Calendar.getInstance(); targetCalendar.setFirstDayOfWeek(Calendar.MONDAY); targetCalendar.setTime(date); Calendar tempCal = Calendar.getInstance(); tempCal.setTime(currentWeekStart); boolean result = false; while(!(tempCal.getTime().after(currentWeekEnd))) { if(tempCal.get(Calendar.DAY_OF_YEAR)==targetCalendar.get(Calendar.DAY_OF_YEAR)) { result=true; break; } tempCal.add(Calendar.DATE,1);//advance date by 1 } return result; }
type: Answer
has comment: http://stackoverflow.com/comment/76975735
score: 0
answers question: http://stackoverflow.com/q/22890644

http://stackoverflow.com/a/22922483
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35029928
has comment: http://stackoverflow.com/comment/35006004
has body: In your code you read the json data from a URL. I just copied your data and pasted it in a file and read the file as your url was down. Here step by step I have shown how to parse your json object and content inside it. For this I used java-json-schema.jar. import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Iterator; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; public class Tets { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub JSONParser parser = new JSONParser(); try{ /* URL url = new URL("http://192.168.1.13/test/ProductWb.php?productId=9"); HttpURLConnection conn ; conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setReadTimeout(60); conn.setRequestProperty("Accept", "application/json");*/ String json=""; Object obj = parser.parse(new FileReader("C:\\XXX\\XX\\src\\javapackage\\t.json")); JSONObject jsonObject = (JSONObject) obj; System.out.println(jsonObject.toJSONString()); //modeles object JSONArray name = (JSONArray) jsonObject.get("modeles"); System.out.println(name.toJSONString());//array inside modeles array for (Object o : name) { JSONObject person = (JSONObject) o; JSONObject person1 = (JSONObject)person.get("modele"); System.out.println(person.get("modele"));//modele object System.out.println(person1.get("id_lang"));//modele attribute } }catch(Exception e){e.printStackTrace();} } } OutPut Your Json Object {"modeles":[{"modele":{"id_lang":"4","info_5":null,"info_4":null,"link_rewrite":"208","meta_keywords":"peugeot 208","info_3":null,"info_2":null,"info_1":null,"available_now":"","meta_description":"Peugeot 208","id_product":"9","description_short":"&lt;pre&gt;Peugeot 208&lt;\/pre&gt;","description":null,"name":"208","info_prix":"","meta_title":"Peugeot 208","available_later":"","id_shop":"1"}}]} Your Jso…
accepted answer of: http://stackoverflow.com/q/22914808
answers question: http://stackoverflow.com/q/22914808
type: AcceptedAnswer

http://stackoverflow.com/q/22920651
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/23626657
favorite count: 0
has answer: http://stackoverflow.com/a/23615870
type: UnansweredQuestion
upvote count: 1
tagged with: java
has body: Per the installation directions I run: ./bin/sqoop.sh client and it returns error: could not find or load main class org.apache.sqoop.shell.SqoopShell I'm setting up Sqoop for the first time. I have the server up and running on Redhat Linux. Now I am stuck running the client on Windows Server 2012. I am running hadoop v2 and sqoop-1.99.3-bin-hadoop200. At the command line I verified java is installed by running "java -version" at the command line and seeing "1.8.0". Scoop is written in Java 1.6. Does that matter? I'm having difficulty locating an active download link to 1.6 for windows for troubleshooting. I tried installing Cygwin and running the command. Same error.
type: Question
tagged with: hadoop
has title: Error launching sqoop client on windows
tagged with: sqoop
answer count: 3
has answer: http://stackoverflow.com/a/41576744

http://stackoverflow.com/comment/35002358
has text: Although in another programming language, I think [this might help](http://stackoverflow.com/a/3067597/1300817) as it achieves the same thing, and the code is kinda straightforward
score: 0
comment on: http://stackoverflow.com/q/22929748
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34921185
comment on: http://stackoverflow.com/a/22884654
type: AnswerComment
score: 0
type: Comment
has text: The resulting random function will probably not be uniform.

http://stackoverflow.com/a/22925108
has body: If you call an instance method (not a static method) in Cricketer, you need to give it an object: Cricketer x = new Cricketer(...); x.someMethod(); Inside the body of someMethod, you can use this to mean "the object that you're calling the method on", which in this case is x. Similarly, inside the body of a constructor, this will mean "the object that we just created". So here, inside setName, this.name means "the name member of the object that we called setName on". Usually, inside an object's methods, you can just say name instead of this.name; the problem here is that the code is using name for a different meaning, i.e. the string you're passing to setName, and that meaning has priority inside the body of setName.
answers question: http://stackoverflow.com/q/22925031
score: 0
type: Answer

http://stackoverflow.com/comment/34933393
has text: You say your VLC is 64-bit, but isn't this a 32-bit install path: "C:\\Program Files (x86)\\VideoLAN\\VLC" i.e. X86...
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22885679

http://stackoverflow.com/a/22937248
upvote count: 2
type: Answer
has body: There are two parts to the tools necessary to build an Android project, the version numbers of each part need to match. I suspect that from your description, that you have only updated one, namely the Android SDK Tools To check the version of this component, click on the Android SDK Manager icon in the toolbar and in the popped up window you will probably see "Android ADK Tools rev 22.6.2" near the top. Now check the other necessary part, (the plugin), version number by selecting Help, Install new software, click 'what is already installed". At the top you will see the 4 plugin Android components. These need to be version 22.6.2 as well. If they are not then add the repository https://dl-ssl.google.com/android/eclipse and update it if necessary.
score: 2
has comment: http://stackoverflow.com/comment/35021367
answers question: http://stackoverflow.com/q/22936565
accepted answer of: http://stackoverflow.com/q/22936565
type: AcceptedAnswer
downvote count: 0

delimiter
tags question: http://stackoverflow.com/q/22853390
tags question: http://stackoverflow.com/q/22948802
tag name: delimiter
tags question: http://stackoverflow.com/q/22852113
type: Tag
tags question: http://stackoverflow.com/q/22936218

http://stackoverflow.com/comment/35226333
type: AnswerComment
has text: Did this work for you? If so, please accept the answer.
type: Comment
comment on: http://stackoverflow.com/a/22830069
score: 0

http://stackoverflow.com/q/22822246
answer count: 1
downvote count: 0
tagged with: templating
score: 1
favorite count: 0
tagged with: mustache
has answer: http://stackoverflow.com/a/22822957
has title: How do you ignore tags with Mustache.java?
type: UnansweredQuestion
upvote count: 1
tagged with: java
has body: I'm currently trying to set up a site that is rendered on the server side with Mustache.java: https://github.com/spullara/mustache.java However, for some pages, I need to also render on the client side with Mustache.js. However, Mustache.java processes any tags in the Mustache I want to process only on the client side. How can I make mustache ignore certain tags? Template: {{process_on_backend}} What I want it to compile to: This should be processed. What it actually compiles to: This should be processed I saw in another question that using {{={{{ }}}=}} to temporarily change the delimiters might work, but when I tried it, I got a 500 error: com.github.mustachejava.MustacheException: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 and I'm pretty sure that it isn't supported in mustache.java.
type: Question

http://stackoverflow.com/q/22907538
accepted answer: http://stackoverflow.com/a/23473912
has comment: http://stackoverflow.com/comment/34961950
type: Question
has comment: http://stackoverflow.com/comment/34962496
tagged with: aop
tagged with: aspectj
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/34962365
favorite count: 0
has body: i am new to aspectj. i have an android appplication with an activity. That activity does not show any menu when i press menu button. I found that, application owner have not overridden the method onCreateOptionsMenu(Menu menu) SO now i want to override this method in that application activity class. But i have been restricted to not to change their original code, and make changes via aspect . SO i want to know that is there any way through which i can add this method to their code through aspectj's pointcut. Here is my android file MainActivity.java: import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sampleactivity); } } I want following method to add in above code via pointcut : @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.sampleactivity, menu); return true; } SO if possible suggest me any pointcut to achive above things. Thank u in advance . .
tagged with: android
type: AnsweredQuestion
has title: How to insert a method in java code via aspect's pointcut?
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23473912

http://stackoverflow.com/q/22928116
has answer: http://stackoverflow.com/a/22928609
tagged with: imageicon
type: Question
has body: I am trying to make a Java desktop application. I want to set an image on JLabel. I am using NetBeans. From my project folder, my directory structure is: F:/&gt;MARKET | |___src | |___lib | |___src | | | |__defaultpackage | | | demo.java |__images | | Logo1.png I used following code: jLabel4 = new JLabel(new ImageIcon("images/Logo1.png")); It is not working, how can I get my output?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22928430
possible better answer: http://stackoverflow.com/a/22928208
has comment: http://stackoverflow.com/comment/34999969
favorite count: 0
tagged with: jlabel
has answer: http://stackoverflow.com/a/22928208
answer count: 3
has comment: http://stackoverflow.com/comment/34999688
tagged with: embedded-resource
tagged with: swing
has title: How to set image on jlabel from project folder?
has comment: http://stackoverflow.com/comment/34999337
score: 4
tagged with: java
linked to: http://stackoverflow.com/q/7598623
has comment: http://stackoverflow.com/comment/34999638
has comment: http://stackoverflow.com/comment/34999738
upvote count: 4
has answer: http://stackoverflow.com/a/22928430
has comment: http://stackoverflow.com/comment/34999772
downvote count: 0

http://stackoverflow.com/a/22931485
answers question: http://stackoverflow.com/q/22914888
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22914888
has body: After Artem Bilan's comments, i searched again (just to make sure, there are no duplicates) and found a class that loads the same properties, but within Java (Properties.load()). This causes to override the system properties i was trying to load via Spring.

http://stackoverflow.com/a/22876976
has comment: http://stackoverflow.com/comment/34906857
has comment: http://stackoverflow.com/comment/34906942
has body: Change ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, R.id.names,presidents); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1); to AutoCompleteTextView textView=(AutoCompleteTextView)findViewById(R.id.autoCompleteTextView1); textView.setThreshold(1); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,presidents); textView.setAdapter(adapter); Hope this will work
has comment: http://stackoverflow.com/comment/34907356
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/34907263
upvote count: 1
has comment: http://stackoverflow.com/comment/34907219
has comment: http://stackoverflow.com/comment/34906834
answers question: http://stackoverflow.com/q/22876730
downvote count: 0

http://stackoverflow.com/comment/34957334
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22905127
type: Comment
has text: @EyalSchneider : Was on the way of adding it.

http://stackoverflow.com/comment/34971680
has text: Yes, I see what you mean now. +1. But I will leave it unaccepted for a while to give time to someone to give a more in deep argument.
comment on: http://stackoverflow.com/a/22912847
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35636070
score: 0
has text: @KatedralPillon if the answer is not accepted by the OP, and is auto selected due to being the answer with the most votes when time expires, the user who answered receives 1/2 points.
type: Comment
comment on: http://stackoverflow.com/a/23075399
type: AnswerComment

http://stackoverflow.com/a/22843162
downvote count: 0
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: Instead of using filter, you could create a custom view class that extends FreeMarkerView and applies custom formatting after the view is rendered. Benefit is that it will only apply to responses that were created from freemarker views (which I assume is what you want). public class CustomFreeMarkerView extends FreeMarkerView { @Override protected void processTemplate(Template template, SimpleHash model, HttpServletResponse response) throws IOException, TemplateException { StringWriter writer = new StringWriter(); template.process(model, writer); String formattedTemplate = formatTemplate(writer.toString()); response.getWriter().write(formattedTemplate); } private String formatTemplate(String renderedTemplate) { //do custom formatting of the renderedTemplate here return renderedTemplate; } } Once you apply your formatting in formatTemplate you can wire in your custom view in view resolver: &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver" autowire="no"&gt; &lt;property name="viewClass" value="com.example.CustomFreeMarkerView" /&gt; ... &lt;/bean&gt; In JavaConfig it would look something like this: @Bean public FreeMarkerViewResolver freeMarkerViewResolver() { FreeMarkerViewResolver fvr = new FreeMarkerViewResolver(); fvr.setViewClass(CusotmFreeMarkerView.class); ... }
answers question: http://stackoverflow.com/q/22839116
accepted answer of: http://stackoverflow.com/q/22839116
score: 2

http://stackoverflow.com/q/22870714
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/1359689
has answer: http://stackoverflow.com/a/22880746
tagged with: asp.net
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34896104
has title: Working with two web servers and a single web page
has comment: http://stackoverflow.com/comment/34905354
has comment: http://stackoverflow.com/comment/34981416
has comment: http://stackoverflow.com/comment/34895820
has comment: http://stackoverflow.com/comment/34897942
tagged with: java
has answer: http://stackoverflow.com/a/22877193
type: Question
has body: I have two web servers (call them A and B), one with a ASP.NET web API (A) and the other serves a web page (B). How do I get around the cross-domain issue ? I serve the web page from B and I run some Java servlets at that server. I also want to access database content on server A which has a ASP.NET web API available to get at it. I could open a TCP/IP socket between the two servers to share info, but since I have a web API, how can I connect during the doGet() in the the Java Servlet to the web API to get the information ? Any help would be greatly appreciated.
has comment: http://stackoverflow.com/comment/34901194
tagged with: servlets

http://stackoverflow.com/q/22821360
accepted answer: http://stackoverflow.com/a/22832402
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34824416
has body: How can I write a program that takes marks as user input? If marks are greater then 60 the program should display "Great, you have passed the course", else the program should print "Sorry, you have failed he course". // I wish to clarify, because I did not understand how to write a program like this and thank you:)
type: Question
has title: How write a program that takes the marks of user as input?
downvote count: 3
has comment: http://stackoverflow.com/comment/34823891
answer count: 1
favorite count: 0
score: -3
tagged with: input
has answer: http://stackoverflow.com/a/22832402

http://stackoverflow.com/comment/34801406
score: 3
comment on: http://stackoverflow.com/q/22818590
type: Comment
type: QuestionComment
has text: Are third-party libraries fair game? Guava has [`Files.equal`](http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/io/Files.html#equal(java.io.File,%20java.io.File)). There's no real reason to bother with hashing if you don't have to; it can only be less efficient.

http://stackoverflow.com/comment/34938991
has text: Do you understand what 'no route to host' means?
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22894748

http://stackoverflow.com/comment/35043446
comment on: http://stackoverflow.com/a/22952851
score: 0
type: AnswerComment
type: Comment
has text: Now i may sound like an idiot but the code inside Case 1 do i need to delete that out of there? Not like the whole case but only certain parts in it?

http://stackoverflow.com/comment/34969314
comment on: http://stackoverflow.com/q/22911929
type: Comment
type: QuestionComment
score: 0
has text: @cheseaux Yes it is. I double checked. Thanks for asking a good question.

http://stackoverflow.com/q/22829082
score: 0
has body: I am trying to create real-time candlestick chart using JFreeChart. How do i convert a time series into OHLC to use in Jfreechart? I'm taking a price and time snapshot of data and storing into a mysql database. I am trying to java client and jfreechart to generate candlestick charts of the time series, but I also want to be able to select the bar size (5 min, 15 min, etc) from the java client.. (i am pulling data into java client using java hibernate) so how do I take a continious series and convert to X min ohlc?
answer count: 1
has answer: http://stackoverflow.com/a/23240080
linked to: http://stackoverflow.com/q/18419795
type: UnansweredQuestion
has title: jfreechart convert time series to ohlc?
tagged with: java
tagged with: jfreechart
type: Question
has comment: http://stackoverflow.com/comment/34862278
linked to: http://stackoverflow.com/q/5736820

http://stackoverflow.com/comment/35057708
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22956975
type: QuestionComment
has text: under Mac OSx I have put the mysql jconnector under `/System/Library/Java/Extensions/` which works perfect

http://stackoverflow.com/comment/34795967
type: QuestionComment
has text: The error pretty much says it all. What do you think the g variable is? You need to load your image ahead of time (at startup), and then use it in a paintComponent() method where you have access to a Graphics instance.
comment on: http://stackoverflow.com/q/22815692
score: 0
type: Comment

http://stackoverflow.com/comment/34936324
comment on: http://stackoverflow.com/a/22863041
has text: Let me work on it. I've been meaning to give it a shot. Give me 30 mins or so :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22954452
tagged with: api
tagged with: apache
has body: Regarding a particular Java library to solve ODEs with Jacobian approximation, a previous Apache Commons Math library 2.2 is intuitive and there are some clear examples too: Ordinary Differential Equations Integration But 2.2 is deprecated now, and the recent library 3.0+ Apache Commons Math 3.0 particularly the packages: org.apache.commons.math3.ode org.apache.commons.math3.ode.events org.apache.commons.math3.ode.nonstiff are the replacements but seem to be much more complex. I think the new ODE versions were motivated by generalising the data structures and methods, but it is difficult to understand how some of the classes are intended to be used together (e.g. MainStateJacobianProvider, ExpandableStatefulODE, ParameterizedODE) and there are no examples of it anywhere while Apache have not updated their information pages. The API documentation is not very informative and seems ambiguous too. So instead of sounding like I am complaining about everything I will pose a specific question, How would you recode the same problem from one of the examples demonstrated using 2.2 above, using the 3.0 library? Here is the code: public class BasicCircleODE implements ParameterizedODE { private double[] c; private double omega; public BasicCircleODE(double[] c, double omega) { this.c = c; this.omega = omega; } public int getDimension() { return 2; } public void computeDerivatives(double t, double[] y, double[] yDot) { yDot[0] = omega * (c[1] - y[1]); yDot[1] = omega * (y[0] - c[0]); } public int getParametersDimension() { // we are only interested in the omega parameter return 1; } public void setParameter(int i, double value) { omega = value; } } double[] hY = new double[] { 0.001, 0.001 }; double[] hP = new double[] { 1.0e-6 }; FirstOrderIntegratorWithJacobians integrator = new FirstOrderIntegratorWithJacobians(dp853, ode, hY, hP); integrator.integrate(t0, y0, dy0dp, t, y, dydy0, dydp);
downvote count: 0
answer count: 1
score: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/24461310
tagged with: ode
tagged with: java
tagged with: apache-commons-math
has title: How do you use Apache Commons Math 3.0+ to solve ODEs with Jacobian?
type: Question

http://stackoverflow.com/q/22938700
possible better answer: http://stackoverflow.com/a/22938825
upvote count: 3
tagged with: java
type: Question
downvote count: 0
has title: Java constructor fails to work with varargs
accepted answer: http://stackoverflow.com/a/22938797
has answer: http://stackoverflow.com/a/22938825
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22938797
has body: I have the following enum which has a number of constructors: public enum Route { HOMEPAGE("", null, UserType.GUEST); Route(String baseName, String langFile, Entity entity) {} Route(String langFile, Entity entity) {} Route(String langFile, UserType... availability) {} Route(String baseName, String langFile, UserType... availability) {} } In this case, I'm pretty clearly calling the 4th constructor when I define HOMEPAGE. But the problem is, I'm getting the error: Cannot resolve constructor Route(java.lang.String, null, com.foo.UserType). If I either remove the varags from the constructor, i.e so it looks like: Route(String baseName, String langFile, UserType availability) {} Or if I change the null when defining HOMEPAGE, i.e: HOMEPAGE("", "", UserType.GUEST); Then it works. But it doesn't make sense to me why that is. Why doesn't it detect that I'm calling the 4th constructor?
has answer: http://stackoverflow.com/a/22938824
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/22873989
tagged with: algorithm
has body: I'm currently writing code on Singly Linked Lists. How would I remove an element after the object passed in as the parameter in a single linked list? Here is my method to remove the last element of the list public Object removeLast() throws EmptyListException { if (head == null) throw new EmptyListException(); Object o; // If there is only one element, we need to modify the head of the list if (head.next == null) { o = head.content; head.content = null; head = null; return o; } Node crt = head; while (crt.next.next != null) crt = crt.next; o = crt.next.content; // Remove all references that are not needed crt.next.content = null; crt.next = null; return o; }
tagged with: java
has title: Single Linked List remove object after parameter Java
answer count: 1
has comment: http://stackoverflow.com/comment/34901452
tagged with: singly-linked-list
has answer: http://stackoverflow.com/a/22874116
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/22874116
type: Question

http://stackoverflow.com/comment/34953692
comment on: http://stackoverflow.com/q/22902892
has text: @CyberneticTwerkGuruOrc can u elaborate on what you mean? I'm a complete noob at this.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22815776
upvote count: 2
has body: I found that the filter mappings of *.action /struts/* / were preventing the redirect to my welcome file. the pattern of /* fixed the problem.
answers question: http://stackoverflow.com/q/22814580
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/34904652
type: Comment
type: AnswerComment
has text: Have a look at [this answer](http://stackoverflow.com/a/22075683/2587435). It may help also.
score: 0
comment on: http://stackoverflow.com/a/22875644

http://stackoverflow.com/a/22916255
score: 3
has body: "Random" doesn't mean "non-repeating", and you cannot judge randomness by short sequences. For example, imagine that you have 2 sequences of 1 and 0: 101010101010101010101010101010101 and 110100100001110100100011111010001 Which looks more random? Second one, of course. But when you take any short sequence of 3-4-5 numbers from it, such sequence will look less random than taken from the first one. This is well-known and researched paradox.
type: Answer
has comment: http://stackoverflow.com/comment/34977587
has comment: http://stackoverflow.com/comment/34977422
upvote count: 3
answers question: http://stackoverflow.com/q/22915937
downvote count: 0

http://stackoverflow.com/a/22917550
has comment: http://stackoverflow.com/comment/108149142
upvote count: 6
answers question: http://stackoverflow.com/q/22910375
has comment: http://stackoverflow.com/comment/108147427
has body: If you're suggesting Guava, then new MapMaker().weakKeys().makeMap() would do the job directly, since weakKeys uses reference equality for keys. The documentation of weakKeys says: Specifies that each key (not value) stored in the map should be wrapped in a WeakReference (by default, strong references are used). Warning: when this method is used, the resulting map will use identity (==) comparison to determine equality of keys, which is a technical violation of the Map specification, and may not be what you expect.
has comment: http://stackoverflow.com/comment/117901409
score: 6
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34909044
comment on: http://stackoverflow.com/a/22875979
type: AnswerComment
has text: I tested you code. It allows diagonal selection. Which is not allowed. It should allow only two circle at a time for drawing line.
score: 0
type: Comment

http://stackoverflow.com/q/22888716
type: Question
accepted answer: http://stackoverflow.com/a/22894370
tagged with: minecraft
has comment: http://stackoverflow.com/comment/34929965
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34929903
has answer: http://stackoverflow.com/a/22894370
has comment: http://stackoverflow.com/comment/34927816
tagged with: plugins
has body: I am trying my hand at Bukkit plugins and im having some difficulty on my first. My console for the server is incapable of running the command, if i could get your review, an explanation to whats going on would be helpfull. Class Code: This is just the relevant code chunk. //Overrides bukkits onCommand with modified code @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (args.length &gt; 1) {//No more then 1 argument sender.sendMessage("[ConsoleFilter] Too many arguments!"); //Sends player a message return false; } if (args.length &lt; 1) {//No less then 1 argument sender.sendMessage("[ConsoleFilter] Not enough arguments!"); //Sends player a message return false; } if (cmd.getName().equalsIgnoreCase("CF")) { //Checks for /CF if (args[0].equalsIgnoreCase("Reload")){ //Checks for /CF Reload Player player = null; //Sets player if (sender instanceof Player){ //if sender is a player entity player = (Player) sender; //player = sender //plugin.yml will actually validate permissions, however additional provisions allows for //further security and further extendability. if (player.isOp() || player.hasPermission("ConsoleFilter.Reload")){ //Is the player an Op or have specified Permission this.reloadConfig(); //Reloads config file back into memory player.sendMessage(ChatColor.DARK_GREEN + "Config Reloaded!"); //Sends player a message getLogger().info("[ConsoleFilter] Config Reloaded"); return true; //Close True } } else{ this.reloadConfig(); //Reloads config file back into memory getLogger().info("[ConsoleFilter] Config Reloaded"); return true; //Close True } } } return false; } Server output: [Server] INFO You don't have ConsoleFilter Permissions node- ConsoleFilter.Reload Plugin.yml: This file parses properly any spacing errors is due to posting. name: ConsoleFilter main: com.dirtyredz.ConsoleFilter.ConsoleFilter version: 0.0.1 commands: CF: description: This is a demo reload command. usage: /CF Reload permission: Console…
type: AnsweredQuestion
has title: Minecraft, FTB, MCPC+, Multicraft, Plugin: Console cannot run command without permissions
tagged with: java
tagged with: bukkit

http://stackoverflow.com/comment/35004712
score: 0
comment on: http://stackoverflow.com/q/22929900
has text: @Pierre I made a small project with OP code to test is, and I get non null "data" even with no permissions. I have no idea whats wrong with this code.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22901602
score: 1
has comment: http://stackoverflow.com/comment/34952410
answers question: http://stackoverflow.com/q/22901151
downvote count: 0
type: Answer
upvote count: 1
has body: You're definitely asking for... a LOT. We can't do your assignment for you! I believe that you should really just start by writing some stuff, little by little. For example, you could: make it work maybe for one particular case at first, then an other, then see some pattern and make it generic... I'll get you started, though. I think that your interaction with the user should look like that: boolean gameEnded = false; boolean isWhitesTurn = true; while(!gameEnded) { System.out.println("You are" + (isWhitesTurn)?"white":"black" + ". Where do you want to move?"); final String input = keyboard.nextLine(); // process the input here isWhitesTurn = !isWhitesTurn; // every time, you toggle between the players. } System.out.println("Game over."); Now, in order to process the input, we can first assume that the user will input a valid String. That is, the coordinates of some actual board case. Later, you'll have to check this and deal with the wrong inputs. Here is what you have to do with that imput: translate that String to some Object: e.g.: "E5" should mean boardE[4]. I guess that you could create some methods like getValueAt(final String coordinates) and setValueAt(final String coordinates). check if there is already a player at those coordinates (using getValueAt()). 2.1 If there is, ask for a new input. 2.2 If there isn't, place the player's colour at the right coordinates (using setValueAt()), then execute the algorithm that changes the colours of the surrounded "players". You know what I mean. there must be some kind of condition that stops the game (e.g.: no more empty case on the board). Check it. If the game is supposed to end, set gameEnded = true; Since I'm at it, I would suggest your board to look more like an actual board, that is... a matrix. For instance, I would use this: private static final int BOARD_WIDTH = 6; private static final int BOARD_HEIGHT = 6; final String[][] board = new String[BOARD_WIDTH][BOARD_HEIGHT]; and initialize it like this: for (int …
has comment: http://stackoverflow.com/comment/34952346

http://stackoverflow.com/comment/34997081
type: AnswerComment
comment on: http://stackoverflow.com/a/22926826
has text: could you explain it. Because i tried by ++i, it's still error. (dont care about i in loop)
type: Comment
score: 0

http://stackoverflow.com/comment/35031049
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22924155
has text: Well... since we're using Hibernate, I'll simply use `@CollectionOfElements` (org.hibernate.annotations.CollectionOfElements)
score: 1

http://stackoverflow.com/q/22948777
type: Question
tagged with: android-view
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/35050177
accepted answer: http://stackoverflow.com/a/22948987
answer count: 1
has body: I am making an application, it seems to work run very well, but the application has some kind of a bug. Every time i am touching the view and moving my finger outside the view and releasing, it crashes. Here is an explanation of my problem:![enter image description here][1] Here is some of my code that might be the problem: public class Game extends View implements OnTurnBasedMatchUpdateReceivedListener { public Game(GameActivity activity){ super(activity); this.mGameActivity = activity; this.mGameBoard = new GameBoard(activity); this.setFocusable(true); this.setFocusableInTouchMode(true); this.setClickable(true); } @Override public boolean onTouchEvent(MotionEvent event) { // TODO Auto-generated method stub // TODO Subtract movementpoints int eventCode = event.getAction(); switch(eventCode){ case MotionEvent.ACTION_DOWN: return true; case MotionEvent.ACTION_MOVE: return true; case MotionEvent.ACTION_UP: return true; default: return true; } } Here is the error log: 04-08 23:00:47.585: E/InputEventReceiver(18313): Exception dispatching input event. 04-08 23:00:47.585: E/MessageQueue-JNI(18313): Exception in MessageQueue callback: handleReceiveCallback 04-08 23:00:47.620: E/MessageQueue-JNI(18313): java.lang.NullPointerException 04-08 23:00:47.620: E/MessageQueue-JNI(18313): at com.boentertainment.quizgame.Game.onTouchEvent(Game.java:199) 04-08 23:00:47.620: E/MessageQueue-JNI(18313): at android.view.View.dispatchTouchEvent(View.java:7713) 04-08 23:00:47.620: E/MessageQueue-JNI(18313): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) 04-08 23:00:47.620: E/MessageQueue-JNI(18313): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959) 04-08 23:00:47.620: E/MessageQueue-JNI(18313): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) 04-08 23:00:47.620: E/MessageQueue-JNI(18313): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959) 04-08 23:00:47.620: E/MessageQueue-JNI(18313): at android.view.V…
tagged with: android
has answer: http://stackoverflow.com/a/22948987
has title: java.lang.NullPointerException; android.view.View.dispatchTouchEvent(View.java:7713)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35036516
linked to: http://stackoverflow.com/q/8551818

http://stackoverflow.com/a/22964781
upvote count: 3
has body: if(condition_1 || condition_2) if condition_1 is true, does java go on and also check condition_2? No! Google short circuiting concept.
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22964745

http://stackoverflow.com/a/22851429
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: You need to split using comma and not space. Change this String[] field = record.split(" "); to String[] field = record.split(","); As you don’t have the spaces in your input string, so it is not getting split and hence the output array does not have multiple items, leading to ArrayIndexOutOfBoundException
accepted answer of: http://stackoverflow.com/q/22851418
upvote count: 4
answers question: http://stackoverflow.com/q/22851418

http://stackoverflow.com/a/22831915
downvote count: 0
has comment: http://stackoverflow.com/comment/34825086
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22831612
score: 1
has body: I would recommend you update your UI elements in your activity or fragment with triggering an interface from your ConnectToServer class. In your Login activity, implement LoginInterface and create your object with a construct like this: new ConnectToServer(this); and create an interface public interface LoginInterface { abstract void onLoginProcessFinished(String message); } in your ConnectToServer class, declare an interface LoginInterface loginInterface; and your constructor public ConnectToServer(LoginInterface loginInterface) { this.loginInterface = loginInterface; } then when you are done with your connection, if(processing_ok){ loginInterface.onLoginProcessFinished(response); } your connectToServer will trigger the onLoginProcessFinished in your Login activity where you implemented the interface, so you will have a method called onLoginProcessFinished in your activity where you update your UI.

http://stackoverflow.com/a/22897020
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: GLSurfaceView does its own EGL context management. It takes all responsibility for creating it, destroying it, and ensuring that it's current on the renderer thread when onDrawFrame() is called. If this is not what you want, you should use a plain SurfaceView instead, and issue the various EGL calls yourself.
accepted answer of: http://stackoverflow.com/q/22894885
type: Answer
answers question: http://stackoverflow.com/q/22894885

http://stackoverflow.com/comment/35064626
comment on: http://stackoverflow.com/a/22964675
score: 0
type: AnswerComment
type: Comment
has text: but i used to know that a lazy quantifier matches the least. `.*` should only match till the end ?

http://stackoverflow.com/a/22841172
answers question: http://stackoverflow.com/q/22841158
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34841593
accepted answer of: http://stackoverflow.com/q/22841158
has comment: http://stackoverflow.com/comment/34844255
type: Answer
has comment: http://stackoverflow.com/comment/34841657
score: 3
downvote count: 0
has body: You need to pass Class&lt;T&gt; clazz as argument to your method, then use it to check if the element can be assignable to that class by using Class#isInstance. public &lt;T&gt; T getItemsByType(Class&lt;T&gt; clazz) { T[] retarr = null; for(int i = 0; i&lt;items.size(); i++){ if(clazz.isInstance(items.get(i))){ //do your logic here... } } return null; } Some recomendations: It would be better returning a List&lt;T&gt; or Collection&lt;T&gt; instead of returning a single T element. Avoid returning null, so you don't have to do null-defensive programming. Use an iterator or an enhanced for loop to traverse through all the elements in your list. So, a better implementation would be: public &lt;T&gt; List&lt;T&gt; getItemsByType(Class&lt;T&gt; clazz) { List&lt;T&gt; theList = new ArrayList&lt;T&gt;(); //using Object since you never specified which type of elements holds this list for (Object o : items) { if(clazz.isInstance(o)) { //do your logic here... theList.add(clazz.cast(o)); } } return theList; }
upvote count: 3

http://stackoverflow.com/comment/34953762
type: Comment
comment on: http://stackoverflow.com/q/22879490
score: 0
type: QuestionComment
has text: any example code will help me a lot...

http://stackoverflow.com/a/22892531
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22873574
upvote count: 2
has body: I have spent some time to figure it out and here are solutions I have found. If you have your resources placed on classpath then you can access them as follows from both cloud and local dev server. getClass().getClassLoader().getResource("resourceName"); or getClass().getClassLoader().getResourceAsStream("resourceName"); However, if your resources are place somewhere else (e.g. WEB-INF), the only way I have found is by means of javax.servlet.ServletContext#getResource(String) or javax.servlet.ServletContext#getResourceAsStream(String) that also work in both environments. This solution is perfectly OK if you access resources from web layer of your app but if you need to access them from other layers (e.g. service layer), it is not probably a good idea to introduce a dependency to Java Servlet API to that layer. Since I am using Spring, I decided to load resources via org.springframework.core.io.ResourceLoader#getResource(String) that returns a resource abstraction whose concrete implementation depends on the application context type and a resource path prefix. For applications running in a web container, the actual implementation uses ServletContext methods under the hood but you are shielded from it. If you do not use Spring, it should not be a big deal to implement your own resource abstraction based on ServletContext. If anyone could provide other solutions, feel free to do so.
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22873574

http://stackoverflow.com/q/22841706
answer count: 1
tagged with: emf
tagged with: eclipse-atl
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22866694
has title: ATL transformation - empty output
linked to: http://stackoverflow.com/q/37196593
type: Question
tagged with: xtext
has body: I'm trying to combine XText with EMF's ATL model to model transformation. I'm reading my DSL, dump it into EMF's XMI resource and put it into the ATL api: ATL does not give me any errors and runs correctly: Number of instructions executed: 38 Whatever I do, my OutModel (palData) stays empty (null). If I take all the files from here (hdl.ecore, pal.ecore, hdl.xmi) and put them into the example ATL project, I get an output that is correct. So is there any magic parameter that I need to throw onto the EMFVM launcher? My code for triggering the ATL: // create stuff EMFModelFactory emfFactory = new EMFModelFactory(); XMIResourceFactoryImpl xmiFactory = new XMIResourceFactoryImpl(); EMFExtractor extractor = new EMFExtractor(); EMFInjector emfInjector = new EMFInjector(); ResourceSet resourceSet = new ResourceSetImpl(); // load model EMFReferenceModel hdlMetaModel = (EMFReferenceModel) emfFactory.newReferenceModel(); emfInjector.inject(hdlMetaModel, resourceSet.getResource(URI.createFileURI("org.xtext.hal/model/generated/Hdl.ecore"), true)); EMFModel hdlData = (EMFModel) emfFactory.newModel(hdlMetaModel); EMFReferenceModel palMetaModel = (EMFReferenceModel) emfFactory.newReferenceModel(); emfInjector.inject(palMetaModel, resourceSet.getResource(URI.createFileURI("org.xtext.hal/model/Pal.ecore"), true)); EMFModel palData = (EMFModel) emfFactory.newModel(palMetaModel); palData.setIsTarget(true); // load xtext content, convert to xmi Resource xmiResource = xmiFactory.createResource(URI.createURI("org.xtext.hal/model/generated/Hdl.xmi")); xmiResource.getContents().addAll(hdlModel.getContents()); emfInjector.inject(hdlData, xmiResource); // ATL transformation InputStream asm = new FileInputStream("org.xtext.hal/model/Pal.asm"); EMFVMLauncher launcher = new EMFVMLauncher(); HashMap&lt;String,Object&gt; options = new HashMap&lt;String,Object&gt;(); options.put("showSummary", "true"); options.put("step", "true"); launcher.initialize(Collections.&lt;String, Object&gt; emptyMap()); …
score: 0

http://stackoverflow.com/a/27576816
answers question: http://stackoverflow.com/q/22882489
has body: In the Server Class: Put System.setProperty("java.rmi.server.hostname","ipaddress");
upvote count: 0
type: Answer
score: -1
downvote count: 1

http://stackoverflow.com/comment/44680213
comment on: http://stackoverflow.com/a/27721691
score: 0
type: AnswerComment
has text: Did not help for my Android project in Netbeans on Win 8.1 (I tried to restart machine). However, when I follow rzymek advice and change ant.properties, then everything is ok.
type: Comment

http://stackoverflow.com/a/22945833
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35037895
has comment: http://stackoverflow.com/comment/35040083
has comment: http://stackoverflow.com/comment/35030993
has comment: http://stackoverflow.com/comment/35043152
downvote count: 0
has comment: http://stackoverflow.com/comment/35039141
accepted answer of: http://stackoverflow.com/q/22945440
has comment: http://stackoverflow.com/comment/35031667
type: Answer
has body: You could make sure you don't add duplicate elements to novaFronteira. There's nothing preventing this code: for(Nodo nodoPai : nodosBase) { Collection&lt;Nodo&gt; filhos = nodoPai.gerarFilhos(); for(Nodo filho : filhos) { if( idsPercorridos.contains( filho.getId() ) == false ) { novaFronteira.add( filho ); } } } From adding many duplicate nodes to novaFronteira. If you were to add to idsPercorridos inside the if-statement, that would prevent this from happening, and result in less steps, although, depending on exactly what your data and data structures looks like, the added running time of this call may actually make it take longer than it did originally. If the problem is running time, you should make sure that idsPercorridos is a TreeSet or HashSet, as these allow for efficient contains calls, as opposed to ArrayList or LinkedList, which don't. If this doesn't help, you could try using the A* algorithm instead, which involves adding a heuristic function to each node, which is the distance to the target - this allows us to explore the nodes closer to the target first, often resulting in less steps to get there. A good heuristic function might be the sum of Manhattan distances between each tile and its target location. Note that this would involve quite a few changes to your current code.
answers question: http://stackoverflow.com/q/22945440
score: 3
has comment: http://stackoverflow.com/comment/35073839
upvote count: 3

http://stackoverflow.com/q/22841158
type: AnsweredQuestion
tagged with: generics
type: Question
has body: I have the following function public &lt;T&gt; T getItemsByType(){ T[] retarr = null; for(int i = 0; i&lt;items.size(); i++){ if(items.get(i).get instanceof T){ } } return null; } I need my function to search in a list of items for instances of type T and then return an array of T. Of course, this would've been great if worked but the problem is that: Cannot perform instanceof check against type parameter T. Use its erasure Object instead since further generic type information will be erased at runtime What should I do to obtain the same effect?
has answer: http://stackoverflow.com/a/22841172
score: 0
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/22841172
has title: How to create a method that retrieves a sublist containing elements of a specific class T?

http://stackoverflow.com/comment/35001225
has text: The CircularFifoQueue [default size](http://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/queue/CircularFifoQueue.html#CircularFifoQueue()) is 32. As the default constructer gets invoked this value will automatically be applied. It would help to see what actually get stored in mongodb using a CircularFifoQueue. But you might try registering a [custom reading converter](http://docs.spring.io/spring-data/data-mongodb/docs/current/reference/html/mongo.core.html#mongo.custom-converters.reader).
score: 1
comment on: http://stackoverflow.com/q/22910717
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22896441
tagged with: object
has comment: http://stackoverflow.com/comment/34941613
has title: NullPointer exception when using second non-static reference to static object
has comment: http://stackoverflow.com/comment/34941640
has body: I have a static object in a Class, where the Class is a writer, and then instances of that Class that need to refer to one of the static objects. To avoid code duplication (where I'd have to write the same code multiple times, each where the only difference is in which of the static objects is used). My solution was to have a static writer called writer1 and a static writer call writer7, and to then have a non-static writer called otherWriter, which in the constructor of either writer1 or writer7 points to the other writer. However, I keep getting NullPointer exceptions when I access otherWriter. Error and code below - any ideas? Sorry, the code is not neat - it's hacky as only fiddeling about at this stage. Thanks Error: java.lang.NullPointerException at popl.PoplFormative.generalWrite(PoplFormative.java:108) at popl.PoplFormative.run(PoplFormative.java:51) package popl; import java.util.Arrays; public class PoplFormative extends Thread { int currentIndex = 0; int lastIndexWritten = -1; static int data[]; int writerId; static PoplFormative writer1; static PoplFormative writer7; PoplFormative otherWriter; public static void main(String[] args) { data = new int[10]; writer1 = new PoplFormative(1); writer7 = new PoplFormative(7); writer1.start(); writer7.start(); try { Thread.sleep(600); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println(Arrays.toString(data)); } public PoplFormative(int writer) { this.writerId = writer; if (writerId == 1) { this.otherWriter = PoplFormative.writer7; } else if (writerId == 7) { this.otherWriter = PoplFormative.writer1; } else { System.out.println("Big nasty error occurred"); while (true) { } } } public void run() { try { generalWrite(); } catch (InterruptedException e) { // TODO Auto-generated catch block System.out.println("Exception Thrown"); e.printStackTrace(); } } public void generalWrite() throws InterruptedException { while (currentIndex &lt; 5) { //System.out.println(…
accepted answer: http://stackoverflow.com/a/22896584
score: 0
answer count: 1
tagged with: static
tagged with: reference
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22896584
has comment: http://stackoverflow.com/comment/34941534
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34941478
type: Question

http://stackoverflow.com/a/22899098
has body: I am not familiar with neural networks, but if you just want to find letters in an image with respecting scale and rotation, I can recommend this Project http://www.codeproject.com/Articles/196168/Contour-Analysis-for-Image-Recognition-in-C It is written in C#, but you could port it to java or at least get a good amount of insights on this topic.
type: Answer
answers question: http://stackoverflow.com/q/22879005
score: 0

http://stackoverflow.com/comment/35044275
type: AnswerComment
score: 0
has text: @user1270235 It's kinda funky but gets the job done ;)
type: Comment
comment on: http://stackoverflow.com/a/22953344

http://stackoverflow.com/comment/35124502
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22957332
type: AnswerComment
has text: That's still incorrect, you're executing every behavior, not one depending on "i"'s value.

http://stackoverflow.com/a/22833680
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/34828520
score: -1
answers question: http://stackoverflow.com/q/22832700
type: Answer
has body: It seems you dont understand php with http well . You will get the HTML response only after your php client code completes execution. (i.e) all your echo's will be put in place where you specified and returned as a whole. Putting sleep will only delay the execution.
has comment: http://stackoverflow.com/comment/34834847
has comment: http://stackoverflow.com/comment/34828208

http://stackoverflow.com/comment/34985989
has text: Sorry, but that code isn't helpful. It won't be in your `@Test`s. Can you show us the code in `LaunchBrowser` (Specifically, what you are doing with TestNG)?
score: 0
comment on: http://stackoverflow.com/q/22915267
type: QuestionComment
type: Comment

http://stackoverflow.com/a/36219164
has body: You can use the application called Supervisor. In supervisor config you can define multiple services and ways to execute the same. For Java and Spring boot applications the command would be java -jar springbootapp.jar. Options can be provided to keep the application running always.So if the EC2 restart then Supervisor will restart you application I found Supervisor easy to use compared to putting startup scripts in /etc/init.d/.The startup scripts would hang or go into waiting state in case of errors .
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22886083
downvote count: 0

http://stackoverflow.com/q/22931849
downvote count: 2
upvote count: 1
tagged with: dictionary
has comment: http://stackoverflow.com/comment/35005722
has body: Consider the following code: public interface A {}; public class AImpl implements A {}; public interface B {}; public class BImpl implements B {}; public interface Service{ Map&lt;? extends A, List&lt;? extends B&gt;&gt; get(); } Why does the following implementation of Service not compile? public class ServiceImpl implements Service { public Map&lt;AImpl, List&lt;BImpl&gt;&gt; get() { return null; } } Compiler error: The return type is incompatible with Service.get() But the following code compile: public interface Service{ List&lt;? extents B&gt; get(); } public class ServiceImpl implements Service{ public List&lt;BImpl&gt; get(){ return null; } }
type: AnsweredQuestion
tagged with: list
accepted answer: http://stackoverflow.com/a/22932213
tagged with: java
has answer: http://stackoverflow.com/a/22932208
score: -1
type: Question
has answer: http://stackoverflow.com/a/22932054
has answer: http://stackoverflow.com/a/22932190
has comment: http://stackoverflow.com/comment/35005755
favorite count: 0
possible better answer: http://stackoverflow.com/a/22932054
has title: Generics with Wildcards (Map<? extends A, List<? extends B>>)
has answer: http://stackoverflow.com/a/22932213
has comment: http://stackoverflow.com/comment/35005625
tagged with: generics
answer count: 4

http://stackoverflow.com/a/22852235
has comment: http://stackoverflow.com/comment/34863116
has comment: http://stackoverflow.com/comment/34862239
has comment: http://stackoverflow.com/comment/34862318
has comment: http://stackoverflow.com/comment/34863099
has comment: http://stackoverflow.com/comment/34862454
answers question: http://stackoverflow.com/q/22852113
score: 0
has comment: http://stackoverflow.com/comment/34862103
has body: Id consider creating a 3d array here 8x8x8 from right to left in the array is row, col, and in so [0][0][1] is block one or kevin [0][1][1] is 7657 [1][1][1] is 400. I like this way because not only does it give each 'item' an array it allows you to keep it organized and easily accessable
type: Answer

http://stackoverflow.com/q/22923370
has comment: http://stackoverflow.com/comment/34991104
accepted answer: http://stackoverflow.com/a/22923536
has comment: http://stackoverflow.com/comment/34991062
upvote count: 3
has comment: http://stackoverflow.com/comment/34991029
has comment: http://stackoverflow.com/comment/34991276
has comment: http://stackoverflow.com/comment/34990867
answer count: 1
has comment: http://stackoverflow.com/comment/34991244
tagged with: synchronization
favorite count: 0
has comment: http://stackoverflow.com/comment/34991214
has answer: http://stackoverflow.com/a/22923536
has comment: http://stackoverflow.com/comment/34991056
has comment: http://stackoverflow.com/comment/34991012
has comment: http://stackoverflow.com/comment/34995492
has comment: http://stackoverflow.com/comment/34991587
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34993166
has comment: http://stackoverflow.com/comment/34990813
tagged with: lock-free
has body: I want to know if the JMM will permit an implementation to reorder the access to the ai and ada variables to behave differently than the intention shown in the code. The intention is that the method perform ops is the next: gets the next index of an array of volatile items writes a number in the newly obtained index performs a spinlock waiting to be sure that older indexes of the array got it's value prints the sum of the array from the first index to the current obtained one. What happens after the index reached 1000 is non-important to me. I actually want to use the array as a ring, but if this question gets answered I will be able to figure out how to do it. Basically I want to avoid locks and rely on atomic and lock-free objects. I don't know however if in this specific case I still need implicit synchronization. AtomicInteger ai = new AtomicInteger(0); // let's say all values are null by default AtomicDoubleArray ada = new AtomicDoubleArray(1000); int rn = 4; // dice rolled... void perfomOps(AtomicInteger ai, AtomicDoubleArray ada) { int i = ai.getAndIncrement(); ada.set(i, rn); spinlock(ada, i); printSum(ada, i); } void spinlock(AtomicDoubleArray ada, int idx) { // spinlock in case the other threads couln't write to older indexes yet if (idx &gt; 0) for (int c = 0;c &lt; idx; c++) while (i = ada.get(c) == null); } void printSum(AtomicDoubleArray ada, int idx) { double sum = 0; for (int i = 0;i &lt; idx; i++) sum = sum + ada.get(i); Sytem.out.println(sum); } // thread 1 perfomOps(ai, ada); // lets say we get 4 printed // thread 2 perfomOps(ai, ada); // lets say we get 8 printed // thread 3 perfomOps(ai, ada); // lets say we get 12 printed Other threads will keep doing the same, it can happen that the print order is not as expected, like 8, 12 and then 4. But assuming a next thread comes in, then it will see correct values and correctly print now 16. All this fancy stuff is to avoid making explicit locks in order to measure which one performs better, the lockfre…
downvote count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34991186
type: Question
linked to: http://stackoverflow.com/q/4756536
score: 3
tagged with: performance
has title: Will the Java Memory Model permit the reordering of non-synchronized accesses of many atomic/volatile variables?
tagged with: java

http://stackoverflow.com/comment/35063119
type: AnswerComment
has text: It's not quite working... the only thing I want to do is assert if twitter:card is actually present or not. As long as twitter:card is in one of the META tags, I'm good.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22963880

http://stackoverflow.com/comment/34944686
has text: yes, it has the same number of cols for each row. it' a complete table
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22897903

http://stackoverflow.com/a/22925891
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22925397
type: Answer
has body: The most basic option is to use a GridLayout import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class LayoutExamples { public static void main(String[] args) { new LayoutExamples(); } public LayoutExamples() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridLayout(0, 2)); frame.add(new OptionsPanel()); frame.add(new OtherPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class OtherPane extends JPanel { public OtherPane() { setBackground(Color.RED); } @Override public Dimension getPreferredSize() { return new Dimension(100, 200); } } public class OptionsPanel extends JPanel { public OptionsPanel() { super(); //layout components however you wish setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.insets = new Insets(8, 8, 8, 8); gbc.anchor = GridBagConstraints.NORTHWEST; JButton backButton = new JButton("&lt;&lt; Back"); backButton.setFont(new Font("Arial", Font.PLAIN, 15)); backButton.setForeground(Color.white); backButton.setBackground(Color.black); backButton.setOpaque(true); backButton.setBorderPainted(false); backButton.addActionListener(new ActionListener() { @Override public void actionP…
score: 1

http://stackoverflow.com/comment/34865230
type: AnswerComment
comment on: http://stackoverflow.com/a/22854029
type: Comment
score: 0
has text: No need, you'll just have a path with only one folder element.

http://stackoverflow.com/q/22900917
has comment: http://stackoverflow.com/comment/34949975
score: 0
linked to: http://stackoverflow.com/q/217065
has body: So I have a simple program that creates a LinkedList array of given size n, with each value in the list representing a new separate LinkedList data Structure. public class Graph { public final LinkedList[] graph; public Graph(int n){ graph = new LinkedList[n]; for (int i=0; i&lt;n; i++){ graph[i] = new LinkedList(); } } public void addEdge(int x, int y){ graph[x].addFirst(y); graph[y].addFirst(x); } For some reason, however, when I call the addEdge() method with two int values, instead of adding them to the specific called LinkedList in graph[], it adds them to every LinkedList in graph[]. What is the problem here? Edit:* public void addEdge(int x, int y){ graph[x].addFirst(y); graph[y].addFirst(x); for (int i=0; i&lt;graph.length; i++){ Node tmp = graph[i].first; System.out.println(i + ":"); while (tmp != null){ System.out.print(tmp.name + " "); tmp = tmp.Rnext; } System.out.println(); } System.out.println(); } public class Test { public static void main(String[] args) { Graph myGraph1 = new Graph(8); myGraph1.addEdge(1, 2); myGraph1.addEdge(1, 7); myGraph1.addEdge(1, 4); myGraph1.addEdge(2, 5); myGraph1.addEdge(2, 6); myGraph1.addEdge(6, 3); myGraph1.addEdge(3, 8); myGraph1.addEdge(5, 7); } } Here is the output of graph: 0: 1 2 1: 1 2 2: 1 2 3: 1 2 4: 1 2 5: 1 2 6: 1 2 7: 1 2 0: 1 7 1 2 1: 1 7 1 2 2: 1 7 1 2 3: 1 7 1 2 4: 1 7 1 2 5: 1 7 1 2 6: 1 7 1 2 7: 1 7 1 2 0: 1 4 1 7 1 2 1: 1 4 1 7 1 2 2: 1 4 1 7 1 2 3: 1 4 1 7 1 2 4: 1 4 1 7 1 2 5: 1 4 1 7 1 2 6: 1 4 1 7 1 2 7: 1 4 1 7 1 2 0: 2 5 1 4 1 7 1 2 1: 2 5 1 4 1 7 1 2 2: 2 5 1 4 1 7 1 2 3: 2 5 1 4 1 7 1 2 4: 2 5 1 4 1 7 1 2 5: 2 5 1 4 1 7 1 2 6: 2 5 1 4 1 7 1 2 7: 2 5 1 4 1 7 1 2 0: 2 6 2 5 1 4 1 7 1 2 1: 2 6 2 5 1 4 1 7 1 2 2: 2 6 2 5 1 4 1 7 1 2 3: 2 6 2 5 1 4 1 7 1 2 4: 2 6 2 5 1 4 1 7 1 2 5: 2 6 2 5 1 4 1 7 1 2 6: 2 6 2 5 1 4 1 7 1 2 7: 2 6 2 5 1 4 1 7 1 2 0: 6 3 2 6 2 5 1 4 1 7 1 2 1: 6 3 2 6 2 5 1 4 1 7 1 2 2: 6 3 2 6 2 5 1 4 1 7 1 2 3: 6 3 2 6 2 5 1 4 1 7 1 2 4: 6 3 2 6 2 5 1 4 1 7 1 2 5: 6 3 2 6 2 5 1 4 1 7…
has comment: http://stackoverflow.com/comment/34949995
has comment: http://stackoverflow.com/comment/34949946
type: AnsweredQuestion
tagged with: linked-list
has comment: http://stackoverflow.com/comment/34950073
tagged with: java
tagged with: adt
has title: Java LinkedList Array referencing
has answer: http://stackoverflow.com/a/22901090
type: Question
has comment: http://stackoverflow.com/comment/34950170
has comment: http://stackoverflow.com/comment/34950202
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/34950269
has comment: http://stackoverflow.com/comment/34950055
has comment: http://stackoverflow.com/comment/34950051
accepted answer: http://stackoverflow.com/a/22901090

gilead
tag name: gilead
type: Tag
tags question: http://stackoverflow.com/q/22915437

http://stackoverflow.com/q/22892801
type: Question
has comment: http://stackoverflow.com/comment/34935525
score: 0
tagged with: java
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/22893184
tagged with: jfilechooser
has comment: http://stackoverflow.com/comment/34935205
has title: jfilechooser, how to write a name of the file to textfile
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34935242
has body: I would really appreciate your help in solving this problem. in my project i have a task to do. Here are the steps involved: Select an image file from disk using jfilechooser and attach image to label in the form. (straight forward) i need to create a text file with the file name using isbn string from one of the textfields in that form. (im creating an instance of the book, have isbn, title, au_name etc) inside this text document, I need to write a path and a file name of that image. For example h:\workplace\isbn1234.txt That should happen in one method. Next step would be creating another method, which will use created txt file (found by isbn string) and load image to all related forms. (but im not there yet) here what ive done so far, but its a mess... private void addPhotoButtonActionPerformed(java.awt.event.ActionEvent evt) { final JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File("H:\\java")); if (evt.getSource() == addPhotoButton) { int returnVal = fc.showOpenDialog(this); if ( returnVal== JFileChooser.APPROVE_OPTION) { java.io.File file = fc.getSelectedFile( ); String s = file.toString( ); String file_name = file.getName(); photoLabel.setIcon(new ImageIcon(file_name)); try(Scanner input = new Scanner(new FileInputStream (file_name)); PrintWriter outputStream = new PrintWriter(new FileOutputStream("files/" + isbnTxtField.getText() + ".txt" ))){ String line = ""; while (input.hasNext()) { line = input.nextLine(); outputStream.println(line); input.next(); } }catch (FileNotFoundException e){ System.out.println("problem opening files."); System.exit(0);}}}} here is the code i came up with to solve 1-3 steps: private void addPhotoButtonActionPerformed(java.awt.event.ActionEvent evt) { final JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File("H:\\java")); if (evt.getSource() == addPhotoButton) { int returnVal = fc.showOpenDialog(this); if ( returnVal== JFileChooser.APPROVE_OPTION) { java.io.File file = fc.getSelectedFile( ); t…
has comment: http://stackoverflow.com/comment/34934995
tagged with: file-io
has comment: http://stackoverflow.com/comment/34935616
has comment: http://stackoverflow.com/comment/34935094

http://stackoverflow.com/q/22856547
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22868361
downvote count: 0
has answer: http://stackoverflow.com/a/45237595
answer count: 3
has body: Spring 4 included major enhancements to generic type resolution, but I'm having trouble with autowiring a generic type when the type argument is parameterized on the containing bean class. I am needing to track the status of jobs submitted to an outside service, and I want to create an entry for each job when it starts and clear or update it when I receive postbacks. I generally try to keep my persistence strategy separated from the service interface, so I have an interface JobStatus and a Spring Data Mongo class MongoJobStatus implements JobStatus. Since a job might fail before the outside service gets a chance to assign it an ID (e.g., an HTTP 502), I need to pass the JobStatus back to the service to identify for updates: interface JobStatusService&lt;S extends JobStatus&gt; { S beginJob(...); S updateJobStatus(S targetJob, Status newStatus); void finishJob(S targetJob); } Accordingly, my Spring controller that handles firing off the jobs and recording the postbacks looks like this; the controller class carries a type parameter so that I can store the new status object and pass it back to the service: @Controller public class JobController&lt;JS extends JobStatus&gt; { @Autowired JobStatusService&lt;JS&gt; jobService; ... handler method ... JS status = jobService.createJob(info, goes, here); // submit job via HTTP jobService.updateJobStatus(status, Status.PROCESSING); ... } My MongoDB-backed implementation looks like this: public class MongoJobStatusService implements JobStatusService&lt;MongoJobStatus&gt; { MongoJobStatus beginJob(...) {...} MongoJobStatus updateJobStatus(MongoJobStatus job, Status newStatus) {...} } When I try to launch, the Spring context fails with NoSuchBeanDefinitionException for JobStatusService. I have confirmed that if I set required=false, the MongoJobStatusService bean is properly component-scanned and installed in the context, but Spring doesn't seem to be able to understand that the class implements that parameterized generic interfac…
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/34870127
linked to: http://stackoverflow.com/q/28246197
has answer: http://stackoverflow.com/a/22868361
has answer: http://stackoverflow.com/a/22857145
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34870049
tagged with: spring-4
has title: Spring autowiring parameterized generic types
possible better answer: http://stackoverflow.com/a/22857145
score: 1
tagged with: java

http://stackoverflow.com/q/22905828
has comment: http://stackoverflow.com/comment/34970828
has comment: http://stackoverflow.com/comment/34960532
has body: Im doing a JSF Project using Netbeans for school. I got a simple Problem. My Code is: ` public class PlayerData{ private Player pl; private HibernateUtil helper; private Session session; public void addMember(){ pl=new Player ("Example") session=helper.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.save(pl); session.getTransaction().commit(); session.close() } } ` My Error = cannot find symbol symbol:method getSessionFactory() location: variable helper of type HibernateUtil
score: 1
favorite count: 0
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: jsf
tagged with: session
tagged with: java
tagged with: hibernate
has title: Jsf Netbeans, Hibernate, Get Session Factory cannot find symbol error
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/34958927

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/22932727
type: Tag
tags question: http://stackoverflow.com/q/22957182
tags question: http://stackoverflow.com/q/22817953
tags question: http://stackoverflow.com/q/22965783

http://stackoverflow.com/a/22847056
answers question: http://stackoverflow.com/q/22832641
type: Answer
has body: I have seen this error when the target address is an invalid IP such as using broadcast/multicast address as destination in an unicast transaction. Can you paste the whole exception and what is the SIP message that you build (key being request URI and Route/Via headers), if you are using private DNS, what does the dest DNS name resolve to?
score: 0

http://stackoverflow.com/comment/34885688
type: Comment
has text: Are you using Glass Mirror-API or GDK?
type: QuestionComment
comment on: http://stackoverflow.com/q/22863806
score: 0

http://stackoverflow.com/comment/34874996
type: Comment
comment on: http://stackoverflow.com/a/22858605
type: AnswerComment
score: 0
has text: @user3483389, It's never possible with Windows 7 and recent versions of Windows. Just tested now. Btw, creating file and folder is different.

http://stackoverflow.com/a/22857278
has comment: http://stackoverflow.com/comment/34871312
downvote count: 0
has comment: http://stackoverflow.com/comment/34870923
has comment: http://stackoverflow.com/comment/34870655
type: Answer
has comment: http://stackoverflow.com/comment/34870791
upvote count: 1
has comment: http://stackoverflow.com/comment/34870732
answers question: http://stackoverflow.com/q/22857015
has body: Using a regex (and Markus' code) public class StringTest { public static void main(String[] args) { String s1 = "1/9"; String s2 = "12&amp;4"; String[] fragments1 = s1.split("[^\\d]"); String[] fragments2 = s2.split("[^\\d]"); int first = Integer.parseInt(fragments1[0]); first += Integer.parseInt(fragments2[0]); int second = Integer.parseInt(fragments1[1]); second += Integer.parseInt(fragments2[1]); String output = first + divider + second; System.out.println(output); } } You should be able to get from here to joining back from an array. If you're getting super fancy, you'll need to use regular expression capture groups and store the captured delimiters somewhere.
score: 1

http://stackoverflow.com/a/22923403
answers question: http://stackoverflow.com/q/22923297
score: 2
has comment: http://stackoverflow.com/comment/34994541
downvote count: 0
has comment: http://stackoverflow.com/comment/35000536
type: Answer
has comment: http://stackoverflow.com/comment/98437906
has body: I presume that what the author had in mind is that, since count goes from 0 to 2, two threads might call put() in sequence, and the reader threads would thus miss one of the messages. It's indeed a race condition: readers and putters compete for the same lock, and if the messages being read depends on which thread is notified by notifyAll().
upvote count: 2

http://stackoverflow.com/comment/34815927
has text: Good catch Chris! I definitely meant && there. However, this still didn't fix the problem. Any other suggestions? Thanks!!
type: AnswerComment
comment on: http://stackoverflow.com/a/22826659
score: 0
type: Comment

http://stackoverflow.com/a/22826976
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/22826945
answers question: http://stackoverflow.com/q/22826945
has body: Those class files are automatically generated for anonymous inner classes defined inside StreamGo.java. For example, if you have something like this: final Runnable runnable = new Runnable() { public void run() { // ... } }; then you'll have a StreamGo$1.class for the anonymous implementation of Runnable that you've defined here. Named nested classes will do much the same, except that you'll get their names instead of the number part.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/22881887
has comment: http://stackoverflow.com/comment/34945734
answers question: http://stackoverflow.com/q/22877887
has comment: http://stackoverflow.com/comment/34916839
type: Answer
has body: There is nothing wrong with background threads running in an implementation of an API, lots of components do this (e.g. in some way you can view Tomcat as a servlet-api implementation using lots of threads). Do consider the environment the component is running in: some environments like Java EE generally do not like threads started outside the server (JBoss, Glassfish) and require the thread to be somehow provided by the server. In any case make sure that these background threads stop running once the client signals it is done using the service/component (e.g. via service.logout()). Many components forget to do this which is very annoying when the implementation is used. E.g. log4j had a watchdog thread that was never stopped and recently the MySQL driver added an "abandoned connection thread" which fails to stop. For occasional use these issues are not important, but in server environments (where stuff has to, preferably, run forever) these issues are serious enough to consider an alternative implementation (which might be less functional complete but does not require a hack to fix).
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34945555
has comment: http://stackoverflow.com/comment/34930273
upvote count: 2

http://stackoverflow.com/comment/35027237
has text: If you don't find the file, you return `null`... `char[] buffer = null;` - I'd recommend a `StringBuilder` anyway.
type: QuestionComment
comment on: http://stackoverflow.com/q/22943791
type: Comment
score: 2

http://stackoverflow.com/comment/35107841
type: Comment
has text: I tried using onCompletion too but didnt worked and please tell me where can I get this data.get(position).getSONG_MP3() in my code
comment on: http://stackoverflow.com/a/22988951
type: AnswerComment
score: 0

http://stackoverflow.com/a/22828789
upvote count: 1
answers question: http://stackoverflow.com/q/22828751
has body: You are calling checkDB() method in isChecked() method, hence you dont need to call it onCreate() super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); openedLockers = (Button) findViewById(R.id.bOpenLockers); closedLockers = (Button) findViewById(R.id.bClosedLockers); openedLockers.setOnClickListener(this); closedLockers.setOnClickListener(this); checkDB(); // remove or comment this line isChecked(); loadListView(); registerListClickCallback();
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/34932081
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22890999
score: 1
has text: Remember, `JPanel` is opaque, that means, if you put it on top of something, it will cover it. You should also make appropriate use of [layout manager](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html) and save yourself a lot of hair pulling

http://stackoverflow.com/comment/34907111
type: Comment
type: QuestionComment
has text: Why don't just copy the code here?
score: 0
comment on: http://stackoverflow.com/q/22877129

http://stackoverflow.com/comment/34928225
type: Comment
type: QuestionComment
score: 0
has text: We need the error message, and stack trace.
comment on: http://stackoverflow.com/q/22881496

http://stackoverflow.com/q/22943144
upvote count: 3
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35026184
has comment: http://stackoverflow.com/comment/35026434
type: Question
has body: Hi must modify some hibernate legacy code and I should define a SQL char(2) column (foreign key to a char(2) primary key). My definition file contains: <property name="language" type="char" update="true" insert="true" column="LANGUAGE" length="2" /> but hibernate generates: +---------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------------+--------------+------+-----+---------+----------------+ (...) | LANGUAGE | char(1) | YES | | NULL | | +---------------------+--------------+------+-----+---------+----------------+ The foreign key table is something like: +--------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+-------+ | LANGUAGE | char(2) | NO | PRI | NULL | | (...) +--------------+--------------+------+-----+---------+-------+ Using: org.hibernate hibernate-core 3.3.1.GA
has comment: http://stackoverflow.com/comment/35026433
accepted answer: http://stackoverflow.com/a/22943689
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35026950
favorite count: 0
has answer: http://stackoverflow.com/a/22943689
type: AnsweredQuestion
score: 3
has title: how to define char(2) column in hibernate hbm.xml?

http://stackoverflow.com/q/22940825
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/35162295
tagged with: hp-quality-center
has comment: http://stackoverflow.com/comment/35160203
has title: Issue while trying to connect qc using OTA with java from MAC
tagged with: macos
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35045499
type: Question
tagged with: ota
has body: I am trying to connect QC using OTA with Java and I am executing from Mac machine. It is unable to establish a successful connection whereas I have tried the same piece of code in Windows and it is working fine. Can anyone throw some light on how to enable this from Mac? Exception stack trace: [junit] Exception in thread "Com4J shutdown hook" java.lang.NoClassDefFoundError: Could not initialize class com4j.COM4J [junit] at com4j.COM4J$3.run(COM4J.java:476)

http://stackoverflow.com/a/43302408
score: -1
has body: Pass two strings str1 and str1 of any length as input, the expected output is a string which takes the 1st char from str1, then 1st char from str2, then 2nd char from str1 and 2nd char from str2 and so on. For e.g. if str1=”Outer”, str2= “Space”, the output is “OSuptaecre”. //A function with two input parameter str1 and str2. public static String stringConcate(String str1,String str2){ //Creating a empty String variable that store the output String. String str3=""; //Checking the input String is a valid String or not(It must not be empty or null). if(str1!=null &amp;&amp; str2!=null &amp;&amp; !str1.isEmpty() &amp;&amp; !str2.isEmpty()){ //Condition for, if both input String are of same size. if(str1.length()==str2.length()){ for(int i=0;i&lt;=str1.length()-1;i++){ str3+=str1.charAt(i); str3+=str2.charAt(i); } } //Condition for, if str1 is greater than str2. if(str1.length()&gt;str2.length()){ for(int i=0;i&lt;=str1.length()-1;i++){ str3+=str1.charAt(i); if(i&lt;str2.length()){ str3+=str2.charAt(i); } } } //Condition for, if str1 is smaller than str2. if(str2.length()&gt;str1.length()){ for(int i=0;i&lt;=str2.length()-1;i++){ if(i&lt;str1.length()){ str3+=str1.charAt(i); } str3+=str2.charAt(i); } } } return str3; }
downvote count: 1
answers question: http://stackoverflow.com/q/22919096
has comment: http://stackoverflow.com/comment/73670866
type: Answer
has comment: http://stackoverflow.com/comment/80754081
upvote count: 0

http://stackoverflow.com/a/22930186
type: Answer
has comment: http://stackoverflow.com/comment/35003283
has comment: http://stackoverflow.com/comment/35004476
score: 6
has comment: http://stackoverflow.com/comment/53880631
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22929908
answers question: http://stackoverflow.com/q/22929908
has comment: http://stackoverflow.com/comment/35044812
type: AcceptedAnswer
upvote count: 6
has body: To do this you will need to include boolean flag in each object, or in you adapter create two list views (for groups and items) that will contain selected items. I would rather add boolean like this : class Group{ ... boolean isSelected; } class Item { ... boolean isSelected; } Then in Adapter in getViews() methods: getItemView(...){ ... itemHolder.checkbox.setSelected(item.isSelected) } getGroupView(...){ ... groupHolder.checkbox.setSelected(group.isSelected) //add lisener itemHolder.checkbox.setOnCheckedChangeListener(lisener); } And on group check you can do something like this : void selectGroup(Group group){ for(Item item: group.getItems()){ item.isSelected = true; } //update your list notifiDataSetChanged(); } That's all what you need UPDATE : Android Developers - UI Android Holder Pattern

http://stackoverflow.com/a/22901090
score: 1
accepted answer of: http://stackoverflow.com/q/22900917
type: Answer
answers question: http://stackoverflow.com/q/22900917
upvote count: 1
has body: public static Node first; This is the problem. Every single LinkedList you make is sharing the same Node, so they're all effectively the same list. Don't use static for instance variables.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35007795
has text: 1. `SELECT count(*)FROM information_schema` to `SELECT count(*) FROM information_schema`. 2. staffname is primary key so make sure u do not add a duplicate value for it.
score: 0
comment on: http://stackoverflow.com/q/22933080
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34883208
type: QuestionComment
has text: Try getApplicationContex() instead of getBaseContext()
comment on: http://stackoverflow.com/q/22864334
score: 0
type: Comment

http://stackoverflow.com/q/22828045
has body: I created a database and generated some entities from it. Now I want to plug in with Spring framework. The problem is that when I deploy to Wildfly, it attempts to create the tables in my database, and fails because the tables are there. My context.xml file is as follows <?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:jee="http://www.springframework.org/schema/jee" xmlns:util="http://www.springframework.org/schema/util" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:security="http://www.springframework.org/schema/security" 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/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <context:annotation-config /> org.hibernate.dialect.Oracle10gDialect <tx:annotation-driven transaction-manager="transactionManager" /> <context:component-scan base-package="com.foobar.rest.resources" /> <constructor-arg value="secret" /> <security:authentication-manager id="authenticationManager"> <security:authentication-provider user-service-ref="userDao"> <security:password-encoder ref="passwordEncoder"></security:password-encoder> </security:authentication-provider> </security:authentication-manager> <security:http realm="Protected API" use-expressions="…
downvote count: 0
has answer: http://stackoverflow.com/a/22828122
upvote count: 1
has answer: http://stackoverflow.com/a/22828170
favorite count: 0
has title: Spring Hibernate without creating tables
tagged with: spring
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22828114
score: 1
accepted answer: http://stackoverflow.com/a/22828114
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/22828170
has answer: http://stackoverflow.com/a/22828548
type: Question

http://stackoverflow.com/comment/34977023
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22915392
has text: @PeterMmm Ok, My intuition had told me that you won't that's perfectly ok no one like to share their hard worked programs and codes. But could you just explain what you meant by `I use a very very basic on-disk license file. All fits in one-class and it is hand obfuscated.` I did not understand that quite well

http://stackoverflow.com/comment/34865582
has text: as in log `abc have you declared this activity in your AndroidManifest.xml?`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22854384

http://stackoverflow.com/comment/34885968
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22865680
type: Comment
has text: Looks like an SDK for android is not available. But available on iOS http://support.airstash.com/forums/20898152

http://stackoverflow.com/comment/34980356
comment on: http://stackoverflow.com/a/22874553
score: 0
type: AnswerComment
type: Comment
has text: (Guava 14.0 is incompatible with glassfish 4, due to its modified manifest to try and support @ inject annotations. Subsequent versions of Guava work fine.)

http://stackoverflow.com/a/29421497
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22894499
upvote count: 1
downvote count: 0
has body: I'va ran into this problem myself on OpenShift and also on my Tomcat(that it was installed on personal PC). It seems that the problem is related to the context.xml file. Even if i edited the context.xml file that was in my cloned openshift project it seemed that the problem didn't dissappear. I've managed to solve this on my personal machine by accessing eclipse server directory: /Servers/Tomcat v7.0 Server at localhost-config/context.xml In the context.xml i had to manually add: &lt;Resource name="jdbc/MySQLPool" url="jdbc:mysql://localhost:3306/sakila" driverClassName="com.mysql.jdbc.Driver" username="root" password="nbuser" auth="Container" type="javax.sql.DataSource" maxActive="20" maxIdle="5" maxWait="10000" /&gt; Saved the file and everything was solved for the Tomcat on my PC. At this moment i'm still trying to solve the OpenShift issue. I am using eclipse, and even if i edit the context.xml that is in my OpenShift clone, it seems that somehow, the context.xml file on the OpenShift-Tomcat platform must be accessed and updated like in the previous example. Hope this help ! Update: I've managed to solve it for the OpenShift platform in the same manner. By using Filezilla(guide for openshift can be found here: https://blog.openshift.com/using-filezilla-and-sftp-on-windows-with-openshift/ ) i've connected to the server, accesed the Tomcat directory(in my case: jbossews/conf/context.xml) and i've manually edited the file by adding the same xml Resource like above. Hope it helps !

http://stackoverflow.com/a/22958546
answers question: http://stackoverflow.com/q/22934720
has body: FTS cannot search from the beginning of a column value. (Actually, it can, but this is undocumented and not enabled in Android.) To search from the beginning, you have to use LIKE 'pattern%'. If you want this to be efficient, you have to use this with a normal table and a case-insensitive index (COLLATE NOCASE).
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/22820267
downvote count: 0
has comment: http://stackoverflow.com/comment/34804342
type: Answer
has comment: http://stackoverflow.com/comment/65250336
score: 5
accepted answer of: http://stackoverflow.com/q/22820220
upvote count: 5
answers question: http://stackoverflow.com/q/22820220
has body: You could use toLowerCase if (message.toLowerCase().startsWith("!spoiler")) {
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34804302

http://stackoverflow.com/comment/34812902
type: QuestionComment
comment on: http://stackoverflow.com/q/22824809
score: 0
type: Comment
has text: What makes you think that you can use a * in the -cp argument? Perhaps you need to learn to use ant or maven?

http://stackoverflow.com/q/22853321
favorite count: 0
has answer: http://stackoverflow.com/a/62019176
answer count: 9
has answer: http://stackoverflow.com/a/46205542
tagged with: resttemplate
has body: I'm writing a simple client in Java to allow reusable use of proprietary virus scanning software accessible through a RESTful API. To upload a file for scanning the API requires a POST for Connect, followed by a POST for Publishing the file to the server. In the response to the Connect POST there are cookies set by the server which need to be present in the subsequent POST for publishing the file. I'm currently using Spring RestTemplate in my client. My question is how do I access the cookies in the response to forward back to the server with the subsequent POST? I can see that they are present in the header that is returned but there are no methods on the ResponseEntity to access them.
has answer: http://stackoverflow.com/a/65730139
tagged with: spring
possible better answer: http://stackoverflow.com/a/55165057
tagged with: http
has answer: http://stackoverflow.com/a/55165057
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22853923
tagged with: cookies
tagged with: java
type: Question
upvote count: 43
linked to: http://stackoverflow.com/q/6005709
downvote count: 0
has answer: http://stackoverflow.com/a/42759084
score: 43
has answer: http://stackoverflow.com/a/39630671
has answer: http://stackoverflow.com/a/66124297
has answer: http://stackoverflow.com/a/22853923
has title: RestTemplate client with cookies
has answer: http://stackoverflow.com/a/64924648

http://stackoverflow.com/comment/34935758
has text: What are you doing? mixing client and server side code. creating a tight coupling between layers. how come is it possible to read a value directly that resides at client browser?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22893015

xml-namespaces
tags question: http://stackoverflow.com/q/22964949
tag name: xml-namespaces
type: Tag
tags question: http://stackoverflow.com/q/22912444

http://stackoverflow.com/comment/34849233
comment on: http://stackoverflow.com/q/22845480
type: Comment
type: QuestionComment
has text: if it's a lot to look at, please do the work for us: undo your changes until you don't get the error, and then work in a single class, adding your changes in until you hit the error again: the last thing you added caused the error and you should start debugging from there
score: 0

http://stackoverflow.com/comment/34813331
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22824675
score: 0
has text: Or if you insist on putting it in MySql use blob. Also wait for about 45 seconds at least before saying it doesn't give an error. I'm betting that PHP is in an infinite loop, and eventually apache will kill it, and tell you.

http://stackoverflow.com/a/22830829
upvote count: 2
type: Answer
downvote count: 0
has body: to implement custom serialization you must implement writeObject and readObject in Employee as below: private void writeObject(ObjectOutputStream os) { // throws IOException { try { os.defaultWriteObject(); os.writeInt( ... ); // here serialize column } catch (Exception e) { e.printStackTrace(); } } private void readObject(ObjectInputStream is) { // throws IOException, ClassNotFoundException { try { is.defaultReadObject(); column = new Column( /*is.readInt() ... */); // here deserialize column } catch (Exception e) { e.printStackTrace(); } } also you should mark your column field, that is of non Serializable type as transient: transient Column column; this way ObjectOutputStream will skip serializing it (no exception will be thrown), and you will serialize it in readObject.
score: 2
answers question: http://stackoverflow.com/q/22830596

http://stackoverflow.com/q/22837086
has answer: http://stackoverflow.com/a/22837339
upvote count: 1
has answer: http://stackoverflow.com/a/22837403
tagged with: java
has answer: http://stackoverflow.com/a/22837414
accepted answer: http://stackoverflow.com/a/22837392
tagged with: matrix
type: AnsweredQuestion
tagged with: arrays
downvote count: 0
score: 1
has title: Remove Column with 0s on splitted Arrays
favorite count: 0
type: Question
has body: In a function I have as input two 2D Arrays(over 50x50), both with same Nr. of columns but different Nr. of Rows. Basically I need to remove the common columns containing digits from a range of 0 to 2 Example: A: 3 0 0 0 0 1 0 5 0 0 6 0 0 2 2 0 0 7 1 0 0 B: 2 3 0 1 0 0 1 4 9 0 2 0 0 0 In this case I would have to remove column 3 , 6 and 7(to A and B), since Column 3 has only 0s, Column six only 0s and 1s, and The last Column all Nr. from 0 to 2. I could use a function like LinearAlgebra.deleteColumns(A , 2 , 5,6); and LinearAlgebra.deleteColumns(B, 2, 5,6); but since my input Array is huge, I'd have to do a column parsing comparing both arrays. Any ideas to approach this? Here's a raw idea of using 3 for loops(java) for(int col=0; col &lt; A[0].length; col++){ // step through each column int cnt = 0; for(int row = 0; row &lt; B.length ; row ++){ if(!(B[col][row].equals(0 | 1 | 2))) { cnt++; } } if(cnt == 0) { // store number of column -&gt; use later on LinearAlgebra.deleteColumns } for(int row = 0; row &lt; A.length ; row++){ if(!(A[col][row].equals(0 | 1 | 2))) cnt++; } if(cnt == 0){ // check aswell all values of B otherwise iterate next column } }
answer count: 4
tagged with: parsing
possible better answer: http://stackoverflow.com/a/22837339
has answer: http://stackoverflow.com/a/22837392

http://stackoverflow.com/a/54201008
has body: It seems like you should just be able to declare a Stream, and the choice of sequential/parallel execution should be handled automagically in a layer below, either by library code or the JVM itself as a function of the cores available at runtime, the size of the problem, etc. To add to the already given answers: Thats a pretty bold assumption. Imagine simulating a board-game for training some form of AI, it's pretty easy to parallelize the execution of different playthroughs - just create a new instance and let it run on its own thread. As it doesn't share any state with another playthrough you don't even have to consider multi-threading issues in your game logic. If you on the other hand parallelize the game logic itself you get all sorts of multi-threading issues and most likely pay a steep price for complexity and even performance. Having control over the behaviour of streams gives you (appropriately limited) flexibility which in and of itself is a key feature for good library design.
type: Answer
has comment: http://stackoverflow.com/comment/95256341
score: 0
answers question: http://stackoverflow.com/q/22950642

http://stackoverflow.com/comment/34958789
score: 0
type: Comment
type: AnswerComment
has text: Yes, but it is EJB example with MDB. I found same example for Spring.
comment on: http://stackoverflow.com/a/22872327

amazon-web-services
tags question: http://stackoverflow.com/q/22904842
tags question: http://stackoverflow.com/q/22846867
tags question: http://stackoverflow.com/q/22916815
tags question: http://stackoverflow.com/q/22923122
tags question: http://stackoverflow.com/q/22890702
type: Tag
tags question: http://stackoverflow.com/q/22964545
tag name: amazon-web-services
tags question: http://stackoverflow.com/q/22911950
tags question: http://stackoverflow.com/q/22948482
tags question: http://stackoverflow.com/q/22945862

http://stackoverflow.com/a/22854784
downvote count: 0
type: Answer
has body: When using the newest libgdx version, you will find the Viewport class... The viewport describes the transformation of the coordinate system of the screen (being the pixels from 0,0 in the lower left corner to e.g. 1280,768 in the upper right corner (depending on the device)) to the coordinate system of your game and scene. The Viewport class has different possibilities on how to do that transformation. It can either stretch your scene coordinate system to exactly fit the screen coordinate system, which might change the aspect ratio and for example "stretch" your images or buttons. It's also possible to fit the scene viewport with its aspect ratio into the viewport, which might produce a black border. E.g. when you have developed the game for 4:3 screens and now embed it into 16:10 displays. The (in my opinion) best option is through fitting the scene viewport into the screen by matching either the longest or shortest edge. This way, you can have a screen/window coordinate system from (0,0) to (1280,768) and create your game coordinate system maybe from (0,0) to (16,10) in landscape mode. When matching the longest edge, this means that the lower left corner of the screen will be (0,0), the lower right will be (16,0)... On devices that don't have the same aspect ratio, the y-values on the upper corners might differ a bit. Or when matching the shortest edge, this means your scene coordinates will always be shown from (x,0) to (x,10) ... But the right edge might not exactly have and x value of 16, since device resolutions differ... When using that method, you might have to reposition some buttons or UI elements, when they are supposed to be rendered on the top or the right edges... Hope it helps...
answers question: http://stackoverflow.com/q/22851645
upvote count: 4
score: 4

http://stackoverflow.com/a/22935676
has body: A default file hierarchy for Maven projects looks like this: src/ main/ java/ com/ mycompany/ Main.java there could be test/... right beside main/. Also You may configure source directory with the &lt;sourceDirectory> tag (a child of the &lt;build> tag). See https://maven.apache.org/guides/introduction/introduction-to-the-pom.html for more examples
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/22935388
score: 6
accepted answer of: http://stackoverflow.com/q/22935388
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22939298
tagged with: code-templates
upvote count: 6
has comment: http://stackoverflow.com/comment/35047291
type: AnsweredQuestion
score: 6
possible better answer: http://stackoverflow.com/a/22939434
type: Question
has answer: http://stackoverflow.com/a/22954275
has answer: http://stackoverflow.com/a/22939434
tagged with: java
has title: eclipse code templates - indentation
tagged with: eclipse
has body: I have created a code template to add a logger and the corresponding import: ${:import(org.apache.log4j.Logger)} private static final Logger logger = Logger.getLogger(${enclosing_type}.class); If I add this now, the logger always starts at the beginning of the line, even if my cursor is already indented. Is there a way to to force the placement at the position of the cursor? This is a screenshot to show what I mean: ====>>>> Edit: The answer from Grove helped in this specific case. But how about this example? I also want to add a comment to the logger. If I define the template like this in the same line, the logger actually apears in the same line as the comment. ${:import(org.apache.log4j.Logger)} /** * Logger */ private static final Logger logger = Logger.getLogger(${enclosing_type}.class);
answer count: 2
tagged with: indentation
downvote count: 0
accepted answer: http://stackoverflow.com/a/22954275
favorite count: 0

http://stackoverflow.com/comment/34840860
score: 0
type: Comment
type: QuestionComment
has text: Try rebooting the device and make sure location enabled in settings. If all fine, I would recommend to use LocationClient to get current location
comment on: http://stackoverflow.com/q/22840812

http://stackoverflow.com/comment/34958759
has text: @seema download and add the apache commons library in your classpath.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22903489
type: Comment

http://stackoverflow.com/q/22928114
score: 0
answer count: 2
has body: I have written a java code to transfer files from one server to another using the concept of socket programming. I got the codes from another java forum that meet my requirements. The program is said to transfer large sized files (like .mkv , .mprg movies) from one machine to another and can be used to transfer files of all formats. But after running the codes I found that the program is not able to transfer large sized files such as movies and even pdf of sizes 80mb or 111mb. The program has used bytebuffer but still error occurs. The codes are as follows (I got them from this site http://www.coderpanda.com/java-socket-programming-transferring-large-sized-files-through-socket/) ClientMain.java import java.io.IOException; import java.net.Socket; public class ClientMain { private DirectoryTxr transmitter = null; Socket clientSocket = null; private boolean connectedStatus = false; private String ipAddress; String srcPath = null; String dstPath = ""; public ClientMain() { } public void setIpAddress(String ip) { this.ipAddress = ip; } public void setSrcPath(String path) { this.srcPath = path; } public void setDstPath(String path) { this.dstPath = path; } private void createConnection() { Runnable connectRunnable = new Runnable() { public void run() { while (!connectedStatus) { try { clientSocket = new Socket(ipAddress, 22); connectedStatus = true; transmitter = new DirectoryTxr(clientSocket, srcPath, dstPath); } catch (IOException io) { io.printStackTrace(); } } } }; Thread connectionThread = new Thread(connectRunnable); connectionThread.start(); } public static void main(String[] args) { ClientMain main = new ClientMain(); main.setIpAddress("localHost"); main.setSrcPath("C:/Transfer/"); main.setDstPath("C:/Receive"); main.createConnection(); } } DirectoryTxr.java import java.io.*; import java.net.Socket; import java.net.SocketException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class DirectoryTxr { Socket clientSocket = null; String srcDi…
has title: Program for file transfer in java using sockets
has answer: http://stackoverflow.com/a/22929092
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34999339
has answer: http://stackoverflow.com/a/22929242
type: Question
has comment: http://stackoverflow.com/comment/35000618
tagged with: sockets

http://stackoverflow.com/q/22856997
tagged with: guice
downvote count: 0
favorite count: 0
has title: HK2 equivalent of @Provides in Guice for Jersey 2
tagged with: hk2
type: AnsweredQuestion
has body: I've been using Jersey 1.X with Google Guice for dependency injection. Switching to Jersey 2.X seems to mean you need to use HK2 for dependency injection instead, I'm struggling to find a few things that I had in Guice. In Jersey 1.X with Guice, I would have something like this for the application: public class GuiceServletTestConfig extends GuiceServletContextListener { @Override protected Injector getInjector() { return Guice.createInjector(new ServletModule(){ @Override protected void configureServlets(){ bind(MyResource.class); serve("/*").with(GuiceContainer.class); bind(MyDAO.class).to(MyDAOSQL.class) } }); } } And something like this for tests: public class GuiceServletTestConfig extends GuiceServletContextListener { @Override protected Injector getInjector() { return Guice.createInjector(new ServletModule(){ @Override protected void configureServlets(){ bind(MyResource.class); serve("/*").with(GuiceContainer.class); } @Provides MyDAO provideMockMyDAO(){ MyDAO dao = mock(MyDAO.class); return dao; } }); } } Any my resrouce would look like this: @Path("myresource") public class MyResource { private MyDAO myDAO; @Inject protected void setMyDAO(MyDAO myDAO) { this.myDAO = myDAO; } @GET @Produces(MediaType.APPLICATION_JSON) public Response get() { // Do something with myDAO // Return response } } That was I can define mocks for my tests and everything is good. With Jersey 2.X however, I cannot find any equivalent for the @Provides annotation. MyResource is effectively the same. For dependency injection for the real application, I have: public class Application extends ResourceConfig { public Application() { packages("com.my.package.resources"); register(new AbstractBinder() { @Override protected void configure() { bind(MyDAOSQL.class).to(MyDAO.class); } }); } } But I don't know how to provide mocks for tests. Anyone knoe how?
possible better answer: http://stackoverflow.com/a/22861997
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22862238
upvote count: 1
type: Question
tagged with: dependency-injection
tagged with: jersey
has answer: http://stackoverflow.com/a/22862238
has comment: http://stackoverflow.com/comment/34875417
has answer: http://stackoverflow.com/a/22861997
answer count: 2

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/22868605
type: Tag
tags question: http://stackoverflow.com/q/22898629

http://stackoverflow.com/a/22899043
answers question: http://stackoverflow.com/q/22898906
score: 0
has comment: http://stackoverflow.com/comment/34946587
has body: IOException and ClassNotFoungException are "checked" exceptions. Take a look at the documentation to retrieve the whole list. (Checked Exceptions include "Exception" class and its sub-classes except for "RuntimeException" and its sub-classes which forms the "Uncheck Exception" group. Quick List Try-catch block or a try-with-resources and propagate the exception to its caller. try-with-resources The process is called propagation and if no handler is found, that the thread running will terminate (the message printed to the console is called the "Stack Trace"). The program itself would terminate only if the exception was propagated from the only one active remaining non-deamon thread (without finding any handler) Thread types | Thread Concept.
has comment: http://stackoverflow.com/comment/34946691
has comment: http://stackoverflow.com/comment/34946357
has comment: http://stackoverflow.com/comment/34946518
type: Answer

http://stackoverflow.com/comment/34851532
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22846406
has text: i am getting unsupported encoding exception

http://stackoverflow.com/comment/34883117
type: Comment
has text: Thanks for the pointers, but this is not a complete solution, yet. I have very little experience with either Java or Mule, and so I'm still a little puzzled by what you mean with 'via the invoke' message processor. What would it look like concretely?
comment on: http://stackoverflow.com/a/22846343
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34846954
comment on: http://stackoverflow.com/q/22843984
type: Comment
has text: "For some reason I'm not able to use it." What reason?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35063988
has text: @Rogue I know this is a small program hence the challenge lies in visualising how and in what way this program could possibly grow in future and accordingly think a good design. Regarding your suggestion of checking online conversion there is no need for that as CSV file is provided.
type: QuestionComment
comment on: http://stackoverflow.com/q/22964415
score: 0
type: Comment

http://stackoverflow.com/comment/34933903
has text: Ok So The only solution I can think of (and tested) is to put the `setUndecorated(true)` _before_ the `initComponents()` and get rid of it inside `initFullFrame()`. It works for me
type: Comment
comment on: http://stackoverflow.com/a/22892065
score: 0
type: AnswerComment

http://stackoverflow.com/a/22902397
answers question: http://stackoverflow.com/q/22902347
has comment: http://stackoverflow.com/comment/34952998
has comment: http://stackoverflow.com/comment/34952941
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34953143
has body: Your main method is a static method and has no instance of your class until it creates one. You cannot call the count(int) method unless you have an instance of the class. Try this instead: public static void main(String[] args) { //int result; int col = 0; Scanner input=new Scanner(System.in); n=input.nextInt(); if(n &lt; 4) System.out.println("the result is 0"); else { NQueens nq = new NQueens(); nq.count(n); } } Another problem is that your count(int) method tries to refer to the 'n' variable. It cannot because it's only existing in the static main method. You have to pass 'n' to the count method so it can see it. If you want to initialize the class with a starting value, perhaps you need a constructor that takes that value instead, like this: public void NQueens(int starting_n) { start = starting_n; } Then in main you'd use NQueens nq = new NQueens(n); to create your object. You'd also have to define int start = 0; in your class so it has a place to store the value being passed in.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34952897
score: 1
accepted answer of: http://stackoverflow.com/q/22902347

http://stackoverflow.com/comment/34960155
comment on: http://stackoverflow.com/a/22906389
has text: And don't use Uppercase letter in project names, that's also a convention
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22868225
has comment: http://stackoverflow.com/comment/34891476
has body: to which default number format? User input would be strings thus it would be up to the developer to get the numbers from the text, e.g. by using Scanner.nextInt(). How such a number would be interpreted would depend on the representation of that number but when in doubt, assume Java will read the number as an integer. and to which default charecter set/encoding standard? AFAIK that would depend on the JVM default enconding which defaults to the system enconding, unless the developper defines an encoding. Note that depending on the source of input there might be some api/library specific settings.
score: 0
has comment: http://stackoverflow.com/comment/34960790
type: Answer
answers question: http://stackoverflow.com/q/22868107

http://stackoverflow.com/q/22852645
has comment: http://stackoverflow.com/comment/34862708
score: 2
upvote count: 3
type: UnansweredQuestion
downvote count: 1
type: Question
tagged with: java
answer count: 6
has answer: http://stackoverflow.com/a/22852714
linked to: http://stackoverflow.com/q/196830
has body: //Input Number System.out.print("Enter a number from 1-10: "); words = input.next(); //Processing String if(!words.equals(FLAG)){ while(!words.equals("1") &amp;&amp; !words.equals("2") &amp;&amp; !words.equals("3") &amp;&amp; !words.equals("4") &amp;&amp; !words.equals("5") &amp;&amp; !words.equals("6") &amp;&amp; !words.equals("7") &amp;&amp; !words.equals("8") &amp;&amp; !words.equals("9") &amp;&amp; !words.equals("10")){ System.out.print("Please enter a number in integer form from 1-10: "); words = input.next(); } } //Close Scanner input.close(); //String to Integer num = Integer.parseInt(words); //Output Number if(num &gt;=1 || num &lt;=10){ System.out.println("\nYour number is: " + num); } How could i change the while loop? What if the number range was from 1-100? IS there any way to shorten the processing string segment? The program needs to be able to handle string and integers.
has title: How can I shorten my while loop without having to search through number (in string format) 1-10?
tagged with: string
has answer: http://stackoverflow.com/a/22855212
favorite count: 0
has answer: http://stackoverflow.com/a/22852729
has answer: http://stackoverflow.com/a/22852697
has answer: http://stackoverflow.com/a/22852732
has comment: http://stackoverflow.com/comment/34862713
has answer: http://stackoverflow.com/a/22852721
has comment: http://stackoverflow.com/comment/34862669

http://stackoverflow.com/q/22846933
tagged with: inheritance
has title: Why type casting of a base class to extended class is allowed at compile time in the given scenario?
score: 0
answer count: 1
has body: I have following scenario. public class Fruit { public Fruit() { System.out.println("Fruit Constructor"); } public String callSuperApple() { return "super fruit"; } } public class Apple extends Fruit{ private String color; public String callSuperApple() { return "super fruit"; } } And some third class: public class SomeClass{ private String color; public String callSuperApple() { return "fruit"; } } Now main method's implementation: public class MainClass{ public static void main(String[] args) { Fruit fruit= new Fruit (); String string = (String)((Apple)fruit).callSuperApple();//line 3 System.out.println(string); } } Here we have exception at the run time but not compile time error. But when the line 3 is changed to String string = (String)((SomeClass)fruit).callSuperApple(); It throws a compile time error. Also the method callSuperApple() is implemented in SomeClass and Fruit. Now, Apple is a type of Fruit but we are able to reverse typecast fruit to Apple. TypeCasting Apple to Fruit makes sense but not the reverse. Why is this allowed at compile time and with SomeClass this is caught at the compile time only?
type: UnansweredQuestion
tagged with: compiler-errors
tagged with: java
has answer: http://stackoverflow.com/a/22846981
type: Question
tagged with: compilation

http://stackoverflow.com/comment/35013164
score: 0
type: Comment
type: QuestionComment
has text: comma separated integers == comma separated values == CSV == use OpenCSV? By hand is OK if it's toy code, but for serious work, consider using OpenCSV.
comment on: http://stackoverflow.com/q/22936218

http://stackoverflow.com/comment/35041597
comment on: http://stackoverflow.com/a/22951475
score: 0
type: AnswerComment
has text: What do you mean? That he should learn the basics and i'm taking chance for it from him? Maybe but it's not ready piece of code and probably he has to modify it somehow so he will eventually learn. If you guys think i shoulnd post that code just downvote me to let me know that
type: Comment

http://stackoverflow.com/comment/34948578
type: Comment
comment on: http://stackoverflow.com/a/22899182
score: 0
type: AnswerComment
has text: Almost there, but you need to create one Person object for every time in the loop, so move that row to be the first below the for statement. Also, the persons.setData(person); should be persons.add(person);

http://stackoverflow.com/comment/34844296
comment on: http://stackoverflow.com/q/22842434
score: 0
type: Comment
type: QuestionComment
has text: @user3482500 Advice : use `Enum.values()` with caution because it creates a new array each time you call it. You should better call it once for all and store the result somewhere.

http://stackoverflow.com/q/22913828
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22914240
has comment: http://stackoverflow.com/comment/34973284
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34972666
score: 2
has comment: http://stackoverflow.com/comment/34972932
has comment: http://stackoverflow.com/comment/34973299
tagged with: java
has body: I want to print a doc file using java. How can i do it without any 3rd party API. As far as i know, you have to render the doc file as image and then pass it to the printer. Is there any way to render the doc file in image and then print it?
tagged with: doc
type: Question
has title: Print a doc file using java
tagged with: printing

http://stackoverflow.com/a/22898564
answers question: http://stackoverflow.com/q/22898509
score: 0
accepted answer of: http://stackoverflow.com/q/22898509
type: AcceptedAnswer
has body: short temp = image[i][j]; transposeImage[i][j] = image[j][i]; transposeImage[j][i] = temp; Why are you swapping here? That doesn't make sense - transposeImage is a new matrix, so you don't have to do inplace editing. This is guaranteed to break if imageWidth != imageLength - see if you can figure out why. And, actually, you're not even swapping. The three lines above are equivalent to: transposeImage[i][j] = image[j][i]; transposeImage[j][i] = image[i][j]; The body of the nested for loop should really just be: transposeImage[i][j] = image[j][i];
has comment: http://stackoverflow.com/comment/34945573
type: Answer

http://stackoverflow.com/comment/34958679
score: 0
type: Comment
type: QuestionComment
has text: sorry..i think i got the problem. i forgot to implement interface.
comment on: http://stackoverflow.com/q/22905849

http://stackoverflow.com/comment/34825360
type: Comment
has text: chrsva, after File->Invalidate alt-enter starts to insert "import". Thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/22831756
score: 0

http://stackoverflow.com/a/22960881
has body: SOCK is a TCP/IP level proxy protocol, not HTTP. It is not supported by HttpClient out of the box. One can customize HttpClient to establish connections via a SOCKS proxy by using a custom connection socket factory EDIT: changes to SSL instead of plain sockets Registry&lt;ConnectionSocketFactory&gt; reg = RegistryBuilder.&lt;ConnectionSocketFactory&gt;create() .register("http", PlainConnectionSocketFactory.INSTANCE) .register("https", new MyConnectionSocketFactory(SSLContexts.createSystemDefault())) .build(); PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(reg); CloseableHttpClient httpclient = HttpClients.custom() .setConnectionManager(cm) .build(); try { InetSocketAddress socksaddr = new InetSocketAddress("mysockshost", 1234); HttpClientContext context = HttpClientContext.create(); context.setAttribute("socks.address", socksaddr); HttpHost target = new HttpHost("localhost", 80, "http"); HttpGet request = new HttpGet("/"); System.out.println("Executing request " + request + " to " + target + " via SOCKS proxy " + socksaddr); CloseableHttpResponse response = httpclient.execute(target, request, context); try { System.out.println("----------------------------------------"); System.out.println(response.getStatusLine()); EntityUtils.consume(response.getEntity()); } finally { response.close(); } } finally { httpclient.close(); } static class MyConnectionSocketFactory extends SSLConnectionSocketFactory { public MyConnectionSocketFactory(final SSLContext sslContext) { super(sslContext); } @Override public Socket createSocket(final HttpContext context) throws IOException { InetSocketAddress socksaddr = (InetSocketAddress) context.getAttribute("socks.address"); Proxy proxy = new Proxy(Proxy.Type.SOCKS, socksaddr); return new Socket(proxy); } }
score: 32
has comment: http://stackoverflow.com/comment/59459192
has comment: http://stackoverflow.com/comment/97576745
has comment: http://stackoverflow.com/comment/45432612
accepted answer of: http://stackoverflow.com/q/22937983
answers question: http://stackoverflow.com/q/22937983
has comment: http://stackoverflow.com/comment/67015003
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/65805045
has comment: http://stackoverflow.com/comment/35075428
has comment: http://stackoverflow.com/comment/52609190
type: Answer
upvote count: 32
has comment: http://stackoverflow.com/comment/35076184
has comment: http://stackoverflow.com/comment/89510598

http://stackoverflow.com/q/22903474
has answer: http://stackoverflow.com/a/22903651
tagged with: android
has comment: http://stackoverflow.com/comment/34954429
type: UnansweredQuestion
tagged with: java
tagged with: text-to-speech
type: Question
has title: TextToSpeech only works when button is pressed, not when called separately
has body: I tried to do something extremely simple or I thought it was. In my BluetoothChat, I set public static boolean potato = false; In the onCreateBundle of my MainActivity, I have talker = new TextToSpeech(getApplicationContext(),new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { if(status != TextToSpeech.ERROR) { talker.setLanguage(Locale.US); } } }); if(BluetoothChat.potato == false) { speakOut(); } When speakOut(); is called by a button or separately by itself it works. public void speakOut() { String original ="You will have a seizure in thirty seconds."; talker.speak(original,TextToSpeech.QUEUE_FLUSH,null); } However, this does not work. Can someone explain why?
score: 0
linked to: http://stackoverflow.com/q/6210096
has comment: http://stackoverflow.com/comment/34954596
answer count: 1

http://stackoverflow.com/a/22814870
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/22814658
downvote count: 1
has comment: http://stackoverflow.com/comment/37426347
score: 5
has body: Do binary Search to find the first occurence. Do binary search to find the last occurence. The number of occurences is equal to the number of numbers between the 2 indices found. Working code: public class Main { public static void main(String[] args){ int[] arr = {-5, -5, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 67, 67, 99}; int lo = getFirst(arr, -5); if(lo==arr.length){ // the number is not present in the array. System.out.println(0); }else{ int hi = getLast(arr, -5); System.out.println((hi-lo+1)); } } // Returns last occurence of num or arr.length if it does not exists in arr. static int getLast(int[] arr, int num){ int lo = 0, hi = arr.length-1, ans = arr.length; while(lo&lt;=hi){ int mid = (lo+hi)/2; if(arr[mid]==num){ ans = mid; lo = mid+1; }else if(arr[mid]&lt;num){ lo = mid+1; }else if(arr[mid]&gt;num){ hi = mid-1; } } return ans; } // Returns first occurence of num or arr.length if it does not exists in arr. static int getFirst(int[] arr, int num){ int lo = 0, hi = arr.length-1, ans = arr.length; while(lo&lt;=hi){ int mid = (lo+hi)/2; if(arr[mid]==num){ ans = mid; hi = mid-1; }else if(arr[mid]&lt;num){ lo = mid+1; }else if(arr[mid]&gt;num){ hi = mid-1; } } return ans; } }

http://stackoverflow.com/comment/34877335
comment on: http://stackoverflow.com/q/22861190
type: QuestionComment
type: Comment
score: 0
has text: please help what the change i have to do.. I'm the beginner of Java. little time taking for understanding.. Give the order hoe to do it

http://stackoverflow.com/comment/34941411
comment on: http://stackoverflow.com/q/22896404
score: 0
type: Comment
type: QuestionComment
has text: I cant use other api, Actually i just recreated MutableLong in java

http://stackoverflow.com/q/22898845
type: Question
possible better answer: http://stackoverflow.com/a/22898917
has comment: http://stackoverflow.com/comment/34946474
has answer: http://stackoverflow.com/a/22898917
tagged with: arrays
has body: Write a program in java that read two 3 by 3 matrix and find out their sum and display result? i tried this but i got Runtime error Scanner r=new Scanner(System.in); int [][]array = null; int[][]array2 = null; int total=0; System.out.println("Enter matrix"); for(int row=0;row&lt;array.length;row++){ for(int col=0;col&lt;array[row].length;col++){ array[row][col]=r.nextInt(); array[row][col]=r.nextInt() ; System.out.print(" "+total +" "); total=array[row][col]+array2[row][col]; System.out.println(" ");
score: 0
answer count: 2
has title: Sum of 3x3 in 2D-Array
has comment: http://stackoverflow.com/comment/34947303
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34946054
tagged with: java
has answer: http://stackoverflow.com/a/22900853
accepted answer: http://stackoverflow.com/a/22900853

http://stackoverflow.com/comment/34999304
type: QuestionComment
comment on: http://stackoverflow.com/q/22928173
has text: what you've done so far? post it here
score: 0
type: Comment

http://stackoverflow.com/q/22961124
score: 0
tagged with: logical-operators
has body: I am trying to get 3 parameters on my servlet,i split my code into 3 classes for code readability but on the query_a1 method of my DatabaseQuery class i always get false and i cant understand why! Here it is my servlets classes : DatabaseQuery public class DatabaseQuery { //Query i aktivitetit 1 public static boolean query_a1(String user,String pass) { if (user== "andi" &amp; pass=="andi") return true; else return false; } //ky do te jete query i aktivitetit 2 public static void query_a2() { } } Servlet import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/web2") public class Servlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //merr aktivitetitn nga i cili vijne parametrat int activiteti=Integer.parseInt(req.getParameter("activitetiNR").toString()); //krijo nje switch per cdo parameter switch (activiteti){ case 1:{ //marrim te dhenat qe i perkasin aktivitetit String user = req.getParameter("user").toString(); System.out.println(user); String pass = req.getParameter("pass").toString(); System.out.println(pass); //i kalojme ne metoden e klases Aktiviteti1 dhe marrim pergjigje dhe me pas japim response response(resp,Aktiviteti1.kontrolloDhenat(user,pass)); } break; } } private void response(HttpServletResponse resp, String msg) throws IOException { PrintWriter out = resp.getWriter(); out.println(msg); } } Aktiviteti public class Aktiviteti1 { //ketu vendosen kontrollet llogjike te aktivitetit public static String kontrolloDhenat(String user,String pass){ //ndersa ketu therrasim queryn nga klasa database if (DatabaseQuery.query_a1(user,pass)==true){ return "Succes!"; }else{ System.out.println(Database…
linked to: http://stackoverflow.com/q/513832
answer count: 3
tagged with: string
accepted answer: http://stackoverflow.com/a/22961152
has answer: http://stackoverflow.com/a/22961170
has answer: http://stackoverflow.com/a/22961345
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22961152
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
tagged with: equality
type: Question
possible better answer: http://stackoverflow.com/a/22961170
has title: Logical if always false on a servlet
tagged with: servlets

http://stackoverflow.com/a/22879212
has comment: http://stackoverflow.com/comment/34910686
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22879188
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: In Java - "References to Objects are passed by value". public class Swap { public static void swap(int[] a){ // now a = x --&gt; {5,3} int temp = a[1]; a[1] = a[0]; // swapping a[0] and a[1] in this and next step. a[0] = temp; // NOW only a[] goes out of scope but since both x and a were pointing to the "same" object {5,3}, the changes made by a will be reflected in x i.e, in the main method. } public static void main(String[] args){ int[] x = {5,3}; // here - x is a reference that points to an array {5,3} swap(x); System.out.println("x[0]:" + x[0] + " x[1]:" + x[1]); } } And, public class Switch { public static void switch(String s){ // now s=x="Hello" s = "GOODBYE"; //here x="hello" , s ="GOODBYE" i.e, you are changing "s" to point to a different String i.e, "GOODBYE", but "x" still points to "Hello" } public static void main(String[] args){ String x = "HELLO"; switch(x); System.out.println(x); } }
answers question: http://stackoverflow.com/q/22879188

http://stackoverflow.com/q/22819887
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22823615
favorite count: 0
type: UnansweredQuestion
tagged with: web-services
tagged with: java
tagged with: mysql
downvote count: 1
type: Question
has body: Hello Folks I am new to webservice I googled a lot I couldn't come to conclusion so I am seeking help here. I am developing simple Android app for education purpose I know Java programming. Please any one give me the steps to adopt in development to consume API signature from the webservice backend. If possible Local setup steps. I am using FrontEnd: Android widgets with http. I need backend setup information JAVA restful + MySql + Application server ? Advance thanks
has title: how to setup web service server with MySql for java developer
score: -1

http://stackoverflow.com/comment/34844109
has text: I just tried with a '/' but no luck. This is how I encode: RequestMessage reqMsg = RequestMessage.parse(is); // gets the uri from the parsed request message uri = reqMsg.getURI(); String encodedUri = URLEncoder.encode(uri, "UTF-8"); And how I request: PUT /test spaces.txt HTTP/1.1
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22841652
type: AnswerComment

http://stackoverflow.com/comment/34990880
type: AnswerComment
type: Comment
score: 0
has text: @riship89 See the javadoc (and quotes) and [this previous question](http://stackoverflow.com/questions/22848738/can-somebody-explain-this-target-pointcut-designators/22849166#22849166).
comment on: http://stackoverflow.com/a/22923392

http://stackoverflow.com/a/22891081
has comment: http://stackoverflow.com/comment/34932231
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22891072
has body: It seems like you forgot to complete the expression other.[j] in the line if( this.contents[i] == other.[j]) { I guess it is expected to be other.contents[j]
downvote count: 0
has comment: http://stackoverflow.com/comment/34932179
has comment: http://stackoverflow.com/comment/34932138
type: Answer

http://stackoverflow.com/comment/34986967
type: QuestionComment
has text: @LuiggiMendoza I can see in the console it is defining beans [userDetailsLoader, .....] root of context hierarchy. That means the file is for testing right?
comment on: http://stackoverflow.com/q/22921071
score: 0
type: Comment

http://stackoverflow.com/comment/34783491
type: AnswerComment
comment on: http://stackoverflow.com/a/22808933
type: Comment
score: 1
has text: plus: (((d.multiply(e)).mod(phi1)).equals(BigInteger.ONE)) is equal to d.multiply(e).mod(phi1).equals(BigInteger.ONE), you can refactor it so it'll be easier to read

http://stackoverflow.com/q/22934817
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/35010888
has comment: http://stackoverflow.com/comment/35013084
has comment: http://stackoverflow.com/comment/35012846
linked to: http://stackoverflow.com/q/3393649
accepted answer: http://stackoverflow.com/a/22941068
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35014935
type: Question
tagged with: hashmap
has title: Java SQL what is the best way to save class with HashMap attribute in MySQL database
has comment: http://stackoverflow.com/comment/35011112
has comment: http://stackoverflow.com/comment/35010775
has comment: http://stackoverflow.com/comment/35012756
has answer: http://stackoverflow.com/a/22941068
has comment: http://stackoverflow.com/comment/35010900
score: 0
has comment: http://stackoverflow.com/comment/35012935
has body: I don't know what's the best way to save a HashMap in the database (the HashMap can be very big) so I my first idea is to save the HashMap as a blob (in a column), an other idea was to save every value in the HashMap corresponding to the key but this would make it to large I thought. My example class: public class MyObject { private int id; private HashMap&lt;Integer, CustomHash&gt; hashes; // getters and setters } I also heard of serializing the class and save it in the database. Any suggestions? Also no use of ORM only plain JDBC EDIT: how to save hashmap into clob? CREATE TABLE IF NOT EXISTS myobjects ( id int GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, hashes clob NOT NULL ); My statement: PreparedStatement ps = null; try { ps = this.connection.prepareStatement("INSERT INTO myobjects (hashes) VALUES (?)"); ps.setClob(1, (Clob) myObject.getHashes()); ps.executeUpdate(); } catch(SQLException sqlEx) { sqlEx.printStackTrace(); } finally { DAOUtility.close(this.connection, ps); } The error: HashMap cannot be cast to Clob
linked to: http://stackoverflow.com/q/5776331

http://stackoverflow.com/q/22941330
tagged with: rest
has comment: http://stackoverflow.com/comment/35022931
tagged with: jax-rs
favorite count: 0
has comment: http://stackoverflow.com/comment/35026584
upvote count: 1
has body: I've written some services to provide compilation of latex documents via REST and am quite stuck now that it's kind of finished. :/ While developing it, I was testing it using TestNG and RestAssured and it worked like a charm but now I'm trying to run it on its own. I'm not really sure where the problem is, so I try to paste all essential stuff and explain it a bit. The problem is that when I let the run the server in a main method all alone, the following exeption will occur. (Bonus question: Can I even run it that way or must if be deployed on an application server as war, could it be also run as jar from the command line simply invoking it with java -jar x.jar?) Console Output JAVA_HOME=/usr/lib/jvm/java-7-oracle /usr/local/netbeans-7.4/java/maven/bin/mvn "-Dexec.args=-classpath %classpath de.uniluebeck.compilatex.RestServer" -Dexec.executable=java -Dexec.classpathScope=runtime org.codehaus.mojo:exec-maven-plugin:1.2.1:exec Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts. --- exec-maven-plugin:1.2.1:exec (default-cli) @ CompiLaTex --- Exception in thread "main" java.lang.NoClassDefFoundError: org/glassfish/jersey/server/ResourceConfig at de.uniluebeck.compilatex.RestServer.<init>(RestServer.java:31) at de.uniluebeck.compilatex.RestServer.main(RestServer.java:42) Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.server.ResourceConfig at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 2 more This is what the class for the server instanciatio…
has answer: http://stackoverflow.com/a/23161536
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35025141
tagged with: java
has comment: http://stackoverflow.com/comment/35027645
type: Question
tagged with: jersey
has title: Jersey ResourceConfig not found when starting HTTP server
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35025677
score: 1
accepted answer: http://stackoverflow.com/a/23161536
has comment: http://stackoverflow.com/comment/35025448
has comment: http://stackoverflow.com/comment/35024966
has comment: http://stackoverflow.com/comment/35026142

http://stackoverflow.com/comment/35029736
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22944196
has text: Camel is a great enterprise integration framework. Excellent documentation, easy to get up and running, integrates with EVERYTHING.
type: AnswerComment

http://stackoverflow.com/a/22839570
has body: Sounds like a homework question so here is the logic input: List of Arrays, Array output: List List Compiar getList(L, A): | newL &lt;- new List | for each Array a in L do | | for int i &lt;- 0 to A.size() | | | Array n = new Array | | | for int j &lt;- 0 to a.size() | | | | if compairitor(A.get(i), a.get(j)) = 0 // compairitor is used to compair values | | | | | n.add(a.get(j) | | | | end-if | | | end-for | | | newL.add(n) | | end-for | end-for-each | return newL end Use this method to replase the old list ex List old = getList(L, Comparison array)
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22839264
downvote count: 0
type: Answer

http://stackoverflow.com/q/22897550
accepted answer: http://stackoverflow.com/a/22897577
tagged with: nodes
type: Question
has answer: http://stackoverflow.com/a/22897577
score: -1
has title: Getting 0.0's returned from my object
answer count: 1
downvote count: 1
favorite count: 0
upvote count: 0
type: AnsweredQuestion
tagged with: java
has body: I have 3 classes, Node, HiddenLayer, and InputNode class. My HiddenLayer and InputNode classes are subclasses of the Node class and they would share the output() method from the Node class (polymorphism). My question is: why is my object returning 0's in the HiddenLayer class? Attached is my code: Node.java public class Node { protected double number; public double output(){ return number; } } HiddenLayer.java public class HiddenLayer extends Node { protected Node[] input; public HiddenLayer(Node[] nodes) { this.input = nodes; } //Some activation functions which can be called upon. class ActivationFunction { //Sigmoid activation function public double sigmoid(double x) { return (1.0 / (1 + Math.pow(Math.E, -x))); } public double deriveSigmoid(double d){ return d * (1.0 - d); } // Hyperbolic Tan Activation Function public double hyperTanFunction(double x) { return (Math.pow(Math.E, x) - Math.pow(Math.E, -x)) / (Math.pow(Math.E, x) + Math.pow(Math.E, -x)); } public double deriveHyperTanFunction(double d){ return (1.0 - Math.pow(hyperTanFunction(d), 2.0)); } } //Output method for the HiddenNode class which will sum up all the input nodes for //a specific hidden node public double output(){ /*Here we will be implementing the following function * Sigma(x[i] * weights[i]) = net * Pass net into the hyberbolic tangent function to get an output between -1 to 1 * We will pass net into the activation function in the train method of Neural Network */ //Store inputs into s temp double array. double[] tempArray = new double[input.length]; for (int j = 0; j &lt; input.length; j++){ tempArray[j] = input[j].output(); System.out.println(tempArray[j]); } //Setup a double sum variable to represent net double net = 0; //Setup for loop to loop over input nodes array for a hidden node for (int i = 0; i &lt; tempArray.length; i++){ net = net + tempArray[i]; } return net; } public static void main(String[] args) { InputNode node1 = new InputNode(28); InputNode node2 = new InputNode(0); Inpu…

http://stackoverflow.com/comment/34900387
type: QuestionComment
comment on: http://stackoverflow.com/q/22873376
type: Comment
has text: Are you using `<property name="appendAllowed" value="true" />` for `org.springframework.batch.item.file.FlatFileItemWriter`.
score: 0

http://stackoverflow.com/comment/34910228
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22879001
has text: http://stackoverflow.com/a/17141286/931982

http://stackoverflow.com/comment/35021068
type: Comment
type: QuestionComment
has text: I feel the mapping between Employees and Roles is somewhere wrong. Will update
score: 0
comment on: http://stackoverflow.com/q/22938574

http://stackoverflow.com/q/22955567
possible better answer: http://stackoverflow.com/a/22955657
tagged with: java
accepted answer: http://stackoverflow.com/a/22955622
has answer: http://stackoverflow.com/a/22955657
downvote count: 1
tagged with: jakarta-ee
has title: Java: Getting a substring from a string ending before a particular character
has body: I have a String Millett Angle-Loc Weaver Extension 1 inch Rings, Black, Medium, Front/Rear Exte I would like to extract "Millett Angle-Loc Weaver Extension 1 inch Rings, Black, Medium, Front/Rear" from this String, ie, the substring before the last " "(space/blank) (or first from right). Could someone please provide some help?
tagged with: substring
type: AnsweredQuestion
score: 1
tagged with: string
has answer: http://stackoverflow.com/a/22955622
favorite count: 0
tagged with: longest-substring
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/35048027

http://stackoverflow.com/q/22967097
answer count: 1
has title: JPA mapping of two tables using and when to use jointable
has body: This is more of a general 'understanding' question rather than a specific senario question. I have been lookiing at the ways in which JPA maps tables together and found two examples here that seem to work in different ways. One has a Set of Phone objects using @JoinTable to join STUDENT_PHONE to STUDENT by STUDENT_ID The other has a Set of StockDailyRecord but seems to just use mappedby stock and in the stock_detail table object have the @PrimaryKeyJoinColumn annotation. Simply trying to get an understanding of which method would be the prefered way and why? Method 1: @OneToMany(cascade = CascadeType.ALL) @JoinTable(name = "STUDENT_PHONE", joinColumns = { @JoinColumn(name = "STUDENT_ID") }, inverseJoinColumns = { @JoinColumn(name = "PHONE_ID") }) public Set&lt;Phone&gt; getStudentPhoneNumbers() { return this.studentPhoneNumbers; } Method 2: @Table(name = "stock", catalog = "mkyongdb", uniqueConstraints = { @UniqueConstraint(columnNames = "STOCK_NAME"), @UniqueConstraint(columnNames = "STOCK_CODE") }) @OneToMany(fetch = FetchType.LAZY, mappedBy = "stock") public Set&lt;StockDailyRecord&gt; getStockDailyRecords() { return this.stockDailyRecords; } @Table(name = "stock_detail", catalog = "mkyongdb") @OneToOne(fetch = FetchType.LAZY) @PrimaryKeyJoinColumn public Stock getStock() { return this.stock; }
type: AnsweredQuestion
tagged with: join
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22992044
type: Question
accepted answer: http://stackoverflow.com/a/22992044
tagged with: jpa
score: 0

http://stackoverflow.com/comment/34931617
comment on: http://stackoverflow.com/q/22890803
type: Comment
type: QuestionComment
has text: ammm... not exactly. For example I have local project that located an disc C:\, but my sever root folder is locating on disc D:\, so every time when I clicking Ctrl+S I want tool that will copy saved files from C to D.
score: 0

http://stackoverflow.com/comment/35016254
type: QuestionComment
comment on: http://stackoverflow.com/q/22937935
score: 0
has text: No u cant see it but you can export sqlite file in Sdcard.
type: Comment

http://stackoverflow.com/comment/34955667
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22903842
type: Comment
has text: I always avoid Nesting as much as I can. But if it is at the cost of making my single if condition too complex, I don't mind nesting it out. but In your case, it is not complex condition, so better to use `&&`.

http://stackoverflow.com/comment/35032432
has text: If you've associated the listener with just one button, why do you need to check the source?
comment on: http://stackoverflow.com/q/22946634
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34987506
comment on: http://stackoverflow.com/a/22921105
score: 0
type: Comment
has text: I will post the other layout file. Yes, the stack trace is the error I am getting with this current build.
type: AnswerComment

http://stackoverflow.com/q/22833438
tagged with: maven-3
favorite count: 0
has body: I'm trying to discover the archtypes installed in my local repository. I read this is possible run the following command: mvn archetype:crawl Now when I run this command I get this error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:crawl (default-cli) on project standalone-pom: Execution default-cli of goal org.apache.maven.plugins:maven-archetype-plugin:2.2:crawl failed. NullPointerException -&gt; [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:crawl (default-cli) on project standalone-pom: Execution default-cli of goal org.apache.maven.plugins:maven-archetype-plugin:2.2:crawl failed. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.class…
has answer: http://stackoverflow.com/a/22839018
has answer: http://stackoverflow.com/a/37307626
score: 0
type: UnansweredQuestion
has title: NullPointerException archetype:crawl
tagged with: maven
upvote count: 1
downvote count: 1
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/22956403
score: 2
has body: I was able to solve the issue. Both the JRE which was running in command line and and in ide were same. But when Maven was getting built, that was pointing to 64 bit JRE. I made everything point to 32 bit then it worked. Similarly When I make everything to point to 64 bit, it works.!! Thanks everyone.
downvote count: 0
answers question: http://stackoverflow.com/q/22935500
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22935500

http://stackoverflow.com/a/22827325
score: 2
type: AcceptedAnswer
downvote count: 0
has body: Current camel property component doesn't support the nested properties, so I just fill a JIRA for it. As Camel property doesn't support the nested properties in the first place, you can define just define the property file like this, and set the environment from the system property and use {{someproperty}} to reference the properties. someproperty={{{{environment}}.someproperty}} # LOCAL SERVER junit.someproperty=junit # LOCAL SERVER local.someproperty=local # TEST test.someproperty=test # PROD prod.someproperty=prod
type: Answer
accepted answer of: http://stackoverflow.com/q/22814272
answers question: http://stackoverflow.com/q/22814272
upvote count: 2

http://stackoverflow.com/comment/34801738
has text: Thanks for your response.Is there any other options which can make the address "http://204.34.34.45:8080" to work apart from enabling the firewall. If enabling the firewall is the only option left, do you know how to enable the firewall for that port..
type: Comment
comment on: http://stackoverflow.com/a/22818527
type: AnswerComment
score: 0

junit
type: Tag
tags question: http://stackoverflow.com/q/22951392
tags question: http://stackoverflow.com/q/22844420
tags question: http://stackoverflow.com/q/22943216
tags question: http://stackoverflow.com/q/22919106
tags question: http://stackoverflow.com/q/22940909
tags question: http://stackoverflow.com/q/22957039
tags question: http://stackoverflow.com/q/22843417
tags question: http://stackoverflow.com/q/22880758
tags question: http://stackoverflow.com/q/22950850
tags question: http://stackoverflow.com/q/22919570
tags question: http://stackoverflow.com/q/22954567
tags question: http://stackoverflow.com/q/22832635
tags question: http://stackoverflow.com/q/22831523
tags question: http://stackoverflow.com/q/22963358
tags question: http://stackoverflow.com/q/22923861
tags question: http://stackoverflow.com/q/22835455
tags question: http://stackoverflow.com/q/22868429
tags question: http://stackoverflow.com/q/22945386
tag name: junit
tags question: http://stackoverflow.com/q/22943101
tags question: http://stackoverflow.com/q/22818032
tags question: http://stackoverflow.com/q/22823958
tags question: http://stackoverflow.com/q/22896023
tags question: http://stackoverflow.com/q/22940467
tags question: http://stackoverflow.com/q/22825471
tags question: http://stackoverflow.com/q/22917585
tags question: http://stackoverflow.com/q/22914883
tags question: http://stackoverflow.com/q/22861662
tags question: http://stackoverflow.com/q/22840220
tags question: http://stackoverflow.com/q/22870664
tags question: http://stackoverflow.com/q/22916118
tags question: http://stackoverflow.com/q/22962721
tags question: http://stackoverflow.com/q/22841990
tags question: http://stackoverflow.com/q/22944526
tags question: http://stackoverflow.com/q/22886097

http://stackoverflow.com/q/22820047
downvote count: 3
has answer: http://stackoverflow.com/a/22822824
has comment: http://stackoverflow.com/comment/34803963
type: Question
upvote count: 0
has body: private void signoutbutton1ActionPerformed(java.awt.event.ActionEvent evt) { String sql = "select * from userlogin where Username=? and Password=? and Hasmac='false' and Blacklisted='false' and Level='student' or Level='teacher' or Level='admin'"; try { String value6 = txt_sou.getText(); pst = conn.prepareStatement(sql); pst.setString(1, txt_sou.getText()); pst.setString(2, signoutpassword.getText()); rs = pst.executeQuery(); if (rs.next()) { //this sql query will not run// sql = "update userlogin set Hasmac='true' where username='" + value6 + "'"; //yet this runs// this.dispose(); { } } else { errorsignout.setText("Error: User Information Not Found"); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }
answer count: 1
accepted answer: http://stackoverflow.com/a/22822824
tagged with: sqlite
favorite count: 0
has title: Second SQL query not running
score: -3
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22896636
answers question: http://stackoverflow.com/q/22896285
score: -1
downvote count: 1
type: Answer
upvote count: 0
has body: I modified your tester() method and replaced your while with an if and moved your second if clause. public static void tester(String str, int left, int right) { if (str.charAt(left) == str.charAt(right) &amp;&amp; left &lt; right) { tester(str, left + 1, right - 1); } else { if (left &lt; right) { System.out.println("That string is NOT a palindrome."); } else { System.out.println("That string IS a palindrome."); } } }

http://stackoverflow.com/comment/34991547
comment on: http://stackoverflow.com/a/22922807
type: AnswerComment
has text: Thank you for your suggestion. I added `this.add(label);` `label.setBounds(130, 10, 140, 80)` prior to this and it still does not display the image.
score: 0
type: Comment

http://stackoverflow.com/q/22911722
has comment: http://stackoverflow.com/comment/34969638
possible better answer: http://stackoverflow.com/a/22911823
score: 16
has answer: http://stackoverflow.com/a/22911823
has comment: http://stackoverflow.com/comment/34968608
linked to: http://stackoverflow.com/q/8991103
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22911923
favorite count: 0
has answer: http://stackoverflow.com/a/58348964
type: Question
has body: The title above sums up my question, to clarify things an example is: array[0] = 1 array[1] = 3 array[2] = 7 // largest array[3] = 5 so the result I would like is 2, since it contains the largest element 7.
has comment: http://stackoverflow.com/comment/34968542
has answer: http://stackoverflow.com/a/59213964
has answer: http://stackoverflow.com/a/22912004
has comment: http://stackoverflow.com/comment/34968580
has comment: http://stackoverflow.com/comment/34968734
upvote count: 19
has answer: http://stackoverflow.com/a/58348822
has answer: http://stackoverflow.com/a/59213134
has comment: http://stackoverflow.com/comment/34969334
answer count: 9
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/22911923
linked to: http://stackoverflow.com/q/8920353
has answer: http://stackoverflow.com/a/70772072
has comment: http://stackoverflow.com/comment/34968644
has comment: http://stackoverflow.com/comment/34970181
has title: How to find array index of largest value?
has answer: http://stackoverflow.com/a/22911932
tagged with: arrays
has comment: http://stackoverflow.com/comment/34968582

http://stackoverflow.com/a/22837392
score: 1
answers question: http://stackoverflow.com/q/22837086
has comment: http://stackoverflow.com/comment/34840143
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22837086
type: Answer
has body: boolean result[] = new boolean[&lt;num of columns&gt;]; for (int i = 0; i &lt; result.length; ++i) result[i] = true; for (int row = 0; row &lt; arrayA.length; ++row) { for (int col = 0; col &lt; arrayA[row].length; ++col) result[col] &amp;= arrayA[row][col] == 0; } for (int row = 0; row &lt; arrayB.length; ++row) { for (int col = 0; col &lt; arrayB[row].length; ++col) result[col] &amp;= arrayB[row][col] == 0; } for (int i = 0; i &lt; 6; ++i) System.out.println(result[i]); now each cell(column) in the result array will indicate which column contains zeros for both arrays. *Note: * This assums as you said that both arrays have the same number of columns EDIT due to comment: If you want to delete columns whose values are in a certain inclusive range use this condition : result[col] &amp;= arrayA[row][col] &gt;= minRange &amp;&amp; arrayA[row][col] &lt;= maxRange; for an exclusive range just remove the = sign and do the same for the second array
upvote count: 1

http://stackoverflow.com/comment/34977045
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22915991
has text: Bathsheba's and chubbsondubs' answers. Also, refer to the official javadoc of [`Random`](http://docs.oracle.com/javase/7/docs/api/java/util/Random.html) class.
type: Comment

http://stackoverflow.com/comment/34942500
has text: well it's explicitly mentioned in the assignment not to rely on reflect. just doesn't make sense.. sorry to bother you guys..
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22896741

http://stackoverflow.com/q/22914838
has body: Is there a way to add a logger instance with Spring ? And is there a way to trace each method calls in my custom code ? I usually do this : package my.java.code; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class A { // How to add this line with Spring ? private static final Logger logger = LoggerFactory.getLogger(A.class); public void A() { // How to add this line with Spring ? logger.trace(""); // Do something... } public void A(Object o) { // How to add this line with Spring ? logger.trace("{}", o); // Do something... } public void method1() { // How to add this line with Spring ? logger.trace(""); // Do something... } public void method2(Object o) { // How to add this line with Spring ? logger.trace("{}", o); // Do something... } } Is there a way to simplify this with Spring ? Goal is : avoid repeatitive code
score: 0
accepted answer: http://stackoverflow.com/a/24071369
has comment: http://stackoverflow.com/comment/34974480
answer count: 1
tagged with: trace
has answer: http://stackoverflow.com/a/24071369
linked to: http://stackoverflow.com/q/13182205
tagged with: spring
has title: Add logger with Spring
has comment: http://stackoverflow.com/comment/34974836
tagged with: logging
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34976152
type: Question

http://stackoverflow.com/comment/34917138
type: Comment
comment on: http://stackoverflow.com/a/22836177
has text: **R.java was modified** is warning when you change something in the `R.java` file by opening it and editing by hand. You should not do this, as it's generated automatically and hold references on various resources used by your Activities. Don't worry, this kind of warning won't break your app.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34999555
type: QuestionComment
score: 1
has text: Is your Queue supposed to be a Queue or is is supposed to be a PriorityQueue? They do two different things.
type: Comment
comment on: http://stackoverflow.com/q/22928255

http://stackoverflow.com/q/22919535
has comment: http://stackoverflow.com/comment/34984852
linked to: http://stackoverflow.com/q/17674634
has comment: http://stackoverflow.com/comment/34985586
has comment: http://stackoverflow.com/comment/34984435
upvote count: 1
tagged with: uri
has title: Uri.parse: NullPointerException (Android, Java)
favorite count: 0
has comment: http://stackoverflow.com/comment/34983752
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/34983503
linked to: http://stackoverflow.com/q/12230942
has comment: http://stackoverflow.com/comment/34983409
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35021845
type: Question
has comment: http://stackoverflow.com/comment/34983643
has comment: http://stackoverflow.com/comment/34989642
has comment: http://stackoverflow.com/comment/34984033
has body: I have following Code Bitmap cs = null; v1.setDrawingCacheEnabled(true); v1.buildDrawingCache(true); cs = Bitmap.createBitmap(v1.getDrawingCache(true)); Canvas canvas = new Canvas(cs); v1.draw(canvas); canvas.save(); v1.setDrawingCacheEnabled(false); String path = Images.Media.insertImage(getContext().getContentResolver(), cs, "MyImage", null); Uri file = Uri.parse(path);//This is line 140 OutputStream outStream = null; try { outStream = getContext().getContentResolver().openOutputStream(file); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } cs = Bitmap.createScaledBitmap(cs, cs.getWidth()*2, cs.getHeight()*2, true); cs.compress(Bitmap.CompressFormat.JPEG, 100, outStream); //file senden Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.putExtra(Intent.EXTRA_STREAM, file); sharingIntent.setType("image/jpeg"); getContext().startActivity(Intent.createChooser(sharingIntent,"Erfolg teilen!")); On my phone and another all works perfect, but 2 Samsung devices it gives me an error. I don't have any of these 2 devices here, so I tried it with an Emulator and than the LogCat gave me following errors: E/AndroidRuntime(373): FATAL EXCEPTION: main E/AndroidRuntime(373): java.lang.NullPointerException: uriString E/AndroidRuntime(373): at android.net.Uri$StringUri.&lt;init&gt;(Uri.java:422) E/AndroidRuntime(373): at android.net.Uri$StringUri.&lt;init&gt;(Uri.java:412) E/AndroidRuntime(373): at android.net.Uri.parse(Uri.java:384) E/AndroidRuntime(373): at com.kila.StatistikDialog.onClick(StatistikDialog.java:140) E/AndroidRuntime(373): at android.view.View.performClick(View.java:3100) E/AndroidRuntime(373): at android.view.View$PerformClick.run(View.java:11644) E/AndroidRuntime(373): at android.os.Handler.handleCallback(Handler.java:587) E/AndroidRuntime(373): at android.os.Handler.dispatchMessage(Handler.java:92) E/AndroidRuntime(373): at android.os.Looper.loop(Looper.java:126) E/AndroidRuntime(373): at android.app.A…

http://stackoverflow.com/comment/34853735
has text: so by "should get rid of ListWrapper and sipmly put your tasks directly into the threadpool", did you mean I don't actually need a "tasklist" shared by all the threads, and what I should do is to assign each single task to a 'Runnable'?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22847674
type: AnswerComment

http://stackoverflow.com/a/22831692
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22831599
score: 0
has comment: http://stackoverflow.com/comment/34825039
upvote count: 1
downvote count: 1
type: Answer
has body: String keys[]= "1) KEY, 2)Key , 3) Key : 4) Key: 5) Key. 6) Key".split(",|:|\\."); // In regex '|' means or. So you can split by ',' or ':' or '.' for(String s:keys) System.out.println(s); Output 1) KEY 2)Key 3) Key 4) Key 5) Key 6) Key
has comment: http://stackoverflow.com/comment/34824922
has comment: http://stackoverflow.com/comment/34824955
accepted answer of: http://stackoverflow.com/q/22831599

http://stackoverflow.com/comment/34889440
has text: @ZacPowell, see additional info.
type: Comment
comment on: http://stackoverflow.com/a/22867786
score: 0
type: AnswerComment

http://stackoverflow.com/a/22919542
has comment: http://stackoverflow.com/comment/88800765
upvote count: 2
answers question: http://stackoverflow.com/q/22919096
type: Answer
score: 2
downvote count: 0
has body: public String join(String str1, String str2){ String str3=""; if(str1.length()&gt;=str2.length()){ for(int i=0;i&lt;str1.length();i++){ str3 += s1.charAt(i); str3 += s2.charAt(i); } } else if(str2.length()&gt;=str1.length()){ for(int i=0;i&lt;str2.length();i++){ str3 += s1.charAt(i); str3 += s2.charAt(i); } } return str3; } That's easier

http://stackoverflow.com/q/22817190
accepted answer: http://stackoverflow.com/a/22817287
has body: double x = 4.0; long y = 10; byte z = 8; char c = 'd'; System.out.println (y*++z / (z-- -6.0) + 'd'*0.5); The result is 80.0, but I don't know why? d is ASCII-Code Number 100. First term is 80 second term is 2 third term is 50 ?
has answer: http://stackoverflow.com/a/22817285
has title: Java output from (y*++z / (z-- -6.0) + 'd'*0.5);
downvote count: 6
has answer: http://stackoverflow.com/a/22817351
tagged with: ascii
upvote count: 3
has comment: http://stackoverflow.com/comment/34799474
answer count: 3
favorite count: 0
score: -3
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34799007
possible better answer: http://stackoverflow.com/a/22817285
has answer: http://stackoverflow.com/a/22817287

http://stackoverflow.com/comment/34959533
comment on: http://stackoverflow.com/q/22906131
score: 0
type: Comment
type: QuestionComment
has text: yep, agree. still looking for it

http://stackoverflow.com/a/22817090
has body: I don't know about an in-depth explaination but why not using inheritance in this case is easy. Because Java doesn't support multiple inheritance. Imagine that after creating your 4 classes (NonFlyingDuck FlyWithWingsDuck or SqueakingDuck, MuteQuackingDuck) you need to add another behavior ? (like I don't know, CodingDuck). Well you'll end with 8 classes, 2 for each of your CodingDuckBehavior (there are ducks who know how to and others who don't). But why stop here ? You may have multiple implementations of each behavior which renders inheritance impracticable. If you can put your hands on Head First Design Patterns, I found their Strategy pattern example really well thought (and it gives you example of what can go wrong going the inheritance path).
answers question: http://stackoverflow.com/q/22816843
has comment: http://stackoverflow.com/comment/34798502
has comment: http://stackoverflow.com/comment/34798380
score: 0
type: Answer

custom-exceptions
type: Tag
tags question: http://stackoverflow.com/q/22850087
tag name: custom-exceptions
tags question: http://stackoverflow.com/q/22927532
tags question: http://stackoverflow.com/q/22903147

http://stackoverflow.com/q/22876579
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/22876597
has body: I have some double numbers that I need to apply '|', but I am getting a compilation error like the following. double x1 = -95.1274171592; double x2 = -1518.4102607642; double x3 = -346.63776359; double x = x1 | x2 | x3; --&gt;&gt; The operator | is undefined for the argument type(s) doubel, double I am wondering if there is a way to apply '|' to double numbers and get the result. Thanks.
has comment: http://stackoverflow.com/comment/34906663
type: Question
accepted answer: http://stackoverflow.com/a/22876602
has answer: http://stackoverflow.com/a/22876628
possible better answer: http://stackoverflow.com/a/22876597
tagged with: java
downvote count: 0
has title: java compilation error for bitwise "OR" for double type
favorite count: 0
has answer: http://stackoverflow.com/a/22876602
answer count: 3
has comment: http://stackoverflow.com/comment/34906164

http://stackoverflow.com/q/22919591
has answer: http://stackoverflow.com/a/64130104
tagged with: java
has comment: http://stackoverflow.com/comment/34996154
type: Question
has title: Robot.keyPress does'nt work for VK_ALT_GRAPH (Invalid key code)
has comment: http://stackoverflow.com/comment/35029173
tagged with: keypress
answer count: 2
has body: I'm working on a remoting app.(mouse - keyboard) I just showing fastly my issue... It's working for 'A' or some basic characters. case "a": robot.keyPress(KeyEvent.VK_A); But I did'nt make '@' character. My way is look like this. case "@": robot.keyPress(KeyEvent.VK_ALT_GRAPH); robot.keyPress(KeyEvent.VK_Q); robot.keyRelease(KeyEvent.VK_ALT_GRAPH); I see the exception when I use VK_ALT_GRAPH; Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Invalid key code at sun.awt.windows.WRobotPeer.keyPress(Native Method) at java.awt.Robot.keyPress(Unknown Source) Is that a bug? How can I press '@' char? Also like this, I cant do these ; $ , # , ? , [ , ] , {, } , ' , * ...
downvote count: 0
tagged with: awtrobot
favorite count: 0
has answer: http://stackoverflow.com/a/54125148
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35033016
score: 2
tagged with: keyevent

http://stackoverflow.com/a/22825920
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22825870
has body: The path "C:\Program Files\Java\jre7" is not the path to an executable file, hence the error. if you want to execute the java executable, then you need to actually provide the full path to it, probably "C:\Program Files\Java\jre7\bin\java.exe."
answers question: http://stackoverflow.com/q/22825870
score: 0

http://stackoverflow.com/comment/34835915
has text: I don't think it is a good practice to use dots in resource names. You should use underscores instead, like qr_scanner_pressed.png.
score: 1
comment on: http://stackoverflow.com/q/22838251
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22831029
upvote count: 3
has body: A) public class SomeClass { private SomeClass() { } public String someMethod() { return ""; } } B) public class SomeOtherClass{ private SomeOtherClass(){ } public String someOtherMethod(){ return ""; } } I have joined a new team and will be working on a project which follows the A) convention. However, I have always been the B) java style person and am way more comfortable with B). 1)On the checked out code, is there a way I could convert the java code style in my eclipse to B) 2)And also ensure the project->Team->Synch with Repo ignores this style change when checking for updates ? 3)Before comitting, I want to switch the code back to the commonly followed style and check it in. I synch for changes every morning and commit changes throughout the day. Is creating a new profile in the preferences->code style->Formatter the only way ? I also looked at http://astyle.sourceforge.net/ but I am somehow confident there is a simpler eclipse solution to this. How could I achieve this in the simplest possible way ? I am using eclipse kepler
has comment: http://stackoverflow.com/comment/34829051
answer count: 1
has answer: http://stackoverflow.com/a/22832516
has comment: http://stackoverflow.com/comment/34825374
favorite count: 0
type: UnansweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34828701
tagged with: java
has title: How to do code format switching in eclipse?
tagged with: eclipse
type: Question

http://stackoverflow.com/q/22939813
type: UnansweredQuestion
upvote count: 1
has title: Java how to compare 2 ArrayList of different objects
has answer: http://stackoverflow.com/a/22939936
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22939929
type: Question
answer count: 2
downvote count: 0
favorite count: 0
tagged with: arraylist
tagged with: compare
has body: I have a problem trying to get an araylist of "tags" in String from 2 ArrayList of objects. I have tried the following but looks like my ideal output is not what I have expected. Here is the code: public class TestList { public static void main(String []args) { Tag tag1 = new Tag(); tag1.setId(15); tag1.setTag("Test"); Tag tag2 = new Tag(); tag2.setId(15); tag2.setTag("Oracle"); Tag tag3 = new Tag(); tag3.setId(16); tag1.setTag("OHNO CANNOE"); List&lt;Tag&gt; tagList = new ArrayList&lt;Tag&gt;(); tagList.add(tag1); tagList.add(tag2); tagList.add(tag3); System.out.println(tagList.size()); AnotherTest test1 = new AnotherTest(); test1.setId(15); test1.setTestcol("Another test col"); AnotherTest test2 = new AnotherTest(); test2.setId(15); test2.setTestcol("HAHAHA"); List&lt;AnotherTest&gt; anotherTests = new ArrayList&lt;AnotherTest&gt;(); anotherTests.add(test1); anotherTests.add(test2); System.out.println(anotherTests.size()); List&lt;String&gt; getTaglist = new ArrayList&lt;String&gt;(); for(AnotherTest anotherTest : anotherTests) { for(Tag tag: tagList) { if(tag.getId()==anotherTest.getId()) { //getTaglist = new ArrayList&lt;String&gt;(); getTaglist.add(tag.getTag()); } } } for (String str: getTaglist) { System.out.println(str); //this gets: //OHNO CANNOE //Oracle //OHNO CANNOE //Oracle } } } Why am I not getting "Test" &amp; "Oracle" as my expected result (I am comparing with id ==15 for both lists). Am I missing anything?

http://stackoverflow.com/comment/35099415
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22952721
has text: Finally I could deploy them separately and communication was handled with spring http invoker. Now another problem, I am using tomcat container authentication with springs preAuthenticatedAuthenticationProvider to authenticate my web service. Now I need a way to pass this authentication to my business logic. any idea?
score: 0

http://stackoverflow.com/comment/35075965
type: AnswerComment
has text: Sorry I don't know. I don't know the API's Microsoft made available for Windows Explorer but I'd imagine that any solution has to start in native code, even a Java solution would technically have part of the solution still using JNI or some other native code means I would think.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22943843

http://stackoverflow.com/q/22948655
downvote count: 1
tagged with: prepared-statement
type: Question
has answer: http://stackoverflow.com/a/22948788
tagged with: java
has title: Benefit of Prepared Statement
possible better answer: http://stackoverflow.com/a/22948788
accepted answer: http://stackoverflow.com/a/22948671
answer count: 2
tagged with: sql
favorite count: 0
linked to: http://stackoverflow.com/q/8263371
has comment: http://stackoverflow.com/comment/35036188
has body: Can someone provide some reasoning of why it is better to use a PreparedStatement rather than making a String with the SQL statement set to that variable? Thanks
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22948671
has comment: http://stackoverflow.com/comment/35036206
score: 0
upvote count: 1

http://stackoverflow.com/comment/35060006
comment on: http://stackoverflow.com/q/22960974
has text: @Thresh: no, the resulting combinations should all have a length of 12 (the length of the original list)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22940550
answers question: http://stackoverflow.com/q/22940216
type: Answer
has body: Your Java client reads the data from the socket using in.readLine(); which basically reads the data until it finds a line separator or carriage return character. I am not so familiar with C++, but it seems that your C++ server only sends "hello" without the line separator. This makes the Java client waits forever. To fix this problem, you can send "hello\n" or "hello\r\n" from your C++ server.
score: 3
downvote count: 0
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22940216
type: AcceptedAnswer

http://stackoverflow.com/q/22954862
has body: the user must input a set of numbers of type double that we must then find the number that equalizes the numbers here is a link to the question https://www.dropbox.com/s/0hlps5r8anhjjd8/group.jpg I tried to solve it myself, I did the basics, but for the actual solution I don't even know where to start ?_? any hint would be much helpful Here my attempt: import java.util.Scanner; public class test { public static void main(String[] args){ Scanner input = new Scanner(System.in); int arr =1000000; while(arr &gt; 10000) { System.out.println("enter number of students that are providing the money"); arr = input.nextInt(); //user input for the size of the array } double size[] = new double[arr]; //array creation , size based on user input for (int i =0; i&lt;size.length;i++) { //to input values into the array System.out.println("enter amount of money"); size[i] = input.nextDouble(); //input values into the array } for(int i=0; i&lt;size.length;i++) { //prints out the array System.out.println(size[i]); } } } Thank you in advance
answer count: 1
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/35047156
has answer: http://stackoverflow.com/a/22957420
has comment: http://stackoverflow.com/comment/35047281
type: UnansweredQuestion
type: Question
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/35046757
has title: finding a number that would equalize a set of numbers through addition or subtraction
has comment: http://stackoverflow.com/comment/35047537

http://stackoverflow.com/comment/35057404
comment on: http://stackoverflow.com/q/22960974
has text: @onesixtyfourth That's *permutations*. Depending on what OP wants, they may have misused the term *combinations*.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34829836
score: 0
comment on: http://stackoverflow.com/q/22834653
type: Comment
type: QuestionComment
has text: Because that's perfectly valid code?

median
tags question: http://stackoverflow.com/q/22888902
type: Tag
tag name: median

http://stackoverflow.com/comment/34958556
has text: again same.no any change.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22903912
type: Comment

http://stackoverflow.com/a/23387590
has comment: http://stackoverflow.com/comment/130220927
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/117105808
answers question: http://stackoverflow.com/q/22938124
has body: The default value of a union corresponds to the first schema of the union (Source). Your union is defined as ["long", "null"] therefor the default value must be a long number. null is not a long number that is why you are getting an error. If you still want to define null as a default value then put null schema first, i.e. change the union to ["null", "long"] instead.
type: Answer
has comment: http://stackoverflow.com/comment/56839187
has comment: http://stackoverflow.com/comment/103442761
accepted answer of: http://stackoverflow.com/q/22938124
score: 107
upvote count: 107

http://stackoverflow.com/comment/104241655
has text: Because, apparently, default constructors cannot be added to interfaces, that means that default methods cannot create new state on an instance, but simply provide utility functionality which can be implemented with the state already exposed by the non-default interface methods...
type: Comment
comment on: http://stackoverflow.com/q/22810921
score: 0
type: QuestionComment

http://stackoverflow.com/q/22825033
accepted answer: http://stackoverflow.com/a/22829226
has comment: http://stackoverflow.com/comment/34820100
tagged with: textures
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: sprite
type: Question
has body: I am currently experiencing issues when drawing and scaling sprites. I am loading my assets from a texture-atlas, which I packed no problem with the LibGDX texture packer gui tool. My texture atlas image currently looks like this. These images are supposed to be buttons, but as you can see, the image is very small, so when the sprites are loaded, they load a sprite of say, 34x16 pixels. When I render these buttons, on a canvas of 1920x1080, they are much too small. I use sprite.scale(int scale) to scale the sprites, but when I scale them, they appear blurry. What I would like to happen, is when they are scaled, each pixel is scaled proportionally, keeping the pixelated effect on the button, rather than a blurry resized image from a really small texture. I currently render the sprites using sprite.render(SpriteBatch batch). Is this the proper way of rendering a sprite, after they are loaded using atlas.createSprite(String name)? I am new to using sprites, and loading textures from a texture-atlas, so i am wondering if this is the correct way of doing things. Also, when I initialize my game, I load numerous different Sprite objects from a TextureAtlas. Each sprite holds a texture that will represent a game object, however it is my understanding that you render a sprite using sprite.render(SpriteBatch batch), so therefore I could only use a sprite, loaded from the TextureAtlas for one game object, because I would also have to set the scale, and position of the sprite, as it represents the game object. I am used to loading a Texture, then rendering this texture using batch.render(), at a given position, but I don't see how this is possible if I am using a sprite. Even if I use batch.render(Sprite, x, y), I am unable to scale the sprite properly, because as I mentioned before, I would like to scale the sprite while maintaining a pixelated effect, and even so, using the Sprite.scale() method, this would scale the Sprite object as a whole, making it impossible to use the S…
has answer: http://stackoverflow.com/a/22829226
tagged with: libgdx
tagged with: opengl
tagged with: java
has title: LibGDX Scaling and Rendering Sprites from TextureAtlas
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/22949422
answers question: http://stackoverflow.com/q/22946521
downvote count: 0
score: 1
type: AcceptedAnswer
has body: I've identified what is happening. When I loaded my test context configuration I was loading a file that imported all 5 of my message-driven-channel-adapters. As Gary stated, each idle thread must start a transaction. So the adapters all started transactions but only one actually received a message. I found that modifying my test context to only load the specific adapter/route resulted in only the single thread being used. 2014-04-08 17:16:38,322 [DEBUG] org.springframework.transaction.jta.JtaTransactionManager - Creating new transaction with name [org.springframework.jms.listener.DefaultMessageListenerContainer#0]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT (org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:366)) 2014-04-08 17:16:38,492 [DEBUG] com.inventory.InventoryRouter - Routing jms_type: rxAddToCountWell (com.inventory.InventoryRouter.route(InventoryRouter.java:25)) 2014-04-08 17:16:38,555 [DEBUG] org.springframework.retry.support.RetryTemplate - Retry: count=0 (org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:251)) 2014-04-08 17:16:38,595 [DEBUG] com.inventory.AddToCountWellHandler - Entered formatCountwellMessage... (com.inventory.AddToCountWellHandler.formatCountwellMessage(AddToCountWellHandler.java:31)) 2014-04-08 17:16:42,198 [DEBUG] com.inventory.AddToCountWellHandler - Leaving formatCountwellMessage (com.inventory.AddToCountWellHandler.formatCountwellMessage(AddToCountWellHandler.java:38)) 2014-04-08 17:16:42,205 [DEBUG] org.springframework.transaction.jta.JtaTransactionManager - Initiating transaction commit (org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:753)) 2014-04-08 17:16:42,210 [DEBUG] org.springframework.transaction.jta.JtaTransactionManager - Creating new transaction with name [org.springframework.jms.listener.DefaultMessageListenerContainer#0]: PROPAGATION_R…
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/22946521

http://stackoverflow.com/comment/35020912
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22940304
score: 0
has text: Please paste the error and `test-context.xml`.

http://stackoverflow.com/a/22911633
has comment: http://stackoverflow.com/comment/35005809
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22910169
upvote count: 3
score: 3
has body: A possible solution (idea 1): To detect whether your app is running back- or foreground, you can simply set a boolean in onPause/onResume: @Override protected void onResume() { super.onResume(); runningOnBackground = false; } @Override protected void onPause() { super.onPause(); runningOnBackground = true; } When you start a new intent from an notification this method gets called: (if you are using singleTop), with the boolean you can determine what to do in the onNewIntent method. @Override protected void onNewIntent (Intent intent){ if(runningOnBackground){ //do this } else{ //do that } } Hope it helps!

http://stackoverflow.com/q/22818319
linked to: http://stackoverflow.com/q/21974361
has answer: http://stackoverflow.com/a/74455291
has comment: http://stackoverflow.com/comment/34800790
upvote count: 2
answer count: 3
tagged with: data-structures
favorite count: 0
linked to: http://stackoverflow.com/q/10741902
has answer: http://stackoverflow.com/a/22818399
possible better answer: http://stackoverflow.com/a/22818399
score: 2
has title: Collection that prevents duplicates but preserves reversible duplicate insertion order?
downvote count: 0
has body: Is there a collection that preserves reversible duplicate insertion order? Specifically, if I insert the following items: 1 2 3 1 I want to be able to iterate over them and receive them in the following order: 1 3 2 That is, I want them in descending insertion order with duplicate insertions causing a reorder. Guava's LinkedListMultimap is the closest I've found, but it doesn't support descending traversal. Java's LinkedHashSet doesn't work because it doesn't allow descending traversal. I could also use an LRU cache, but most LRU libraries I've found don't support retrieving objects in LRU order. Does this thing have a standard name?
tagged with: collections
has answer: http://stackoverflow.com/a/22818503
accepted answer: http://stackoverflow.com/a/22818503
has comment: http://stackoverflow.com/comment/34800817
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34800814
tagged with: guava
tagged with: java

http://stackoverflow.com/comment/34792741
score: 1
comment on: http://stackoverflow.com/a/22813523
has text: No you need the anchors too. Otherwise the first substring to meet its criteria (one or more of these chars) hits the "pass" button. The anchors effectively tell the matcher the whole string must consist of only these chars.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22924252
accepted answer: http://stackoverflow.com/a/23092763
score: 0
tagged with: arrays
answer count: 1
tagged with: parsing
has answer: http://stackoverflow.com/a/23092763
tagged with: thesaurus
tagged with: dictionary
type: AnsweredQuestion
tagged with: java
has body: I'm creating a visual thesaurus which will act as a watered down version shown here: https://www.visualthesaurus.com/ I'm a new programmer and this will be one of my first projects. I'm using Moby Grady's Thesaurus text file for my thesaurus list but I'm running into issues. Moby Thesaurus is formatted so there's a root word, followed by a comma, followed by like or relating words, than a carriage feed/line break and than another root word... ex. Root word, like word, like word, like word The technique I'm using for find the synonyms at the moment goes like this: 1. Enter word to find 2. Start at line one, turn line into String array and than test to see if the wordToFind is in that line, if it is, print the line and search more lines for the wordToFind. I'm successfully printing out each line that holds my wordToFind but each of these words in the line are not good matches for synonyms. I'm asking for anybody with this kind of experience to help me come up with a way to get words more similar to my wordsToFind. import java.io.BufferedReader; import java.io.Console; import java.io.File; import java.io.FileReader; import java.util.Arrays; import java.util.Scanner; public class Thesaurus { File godFile = new File("C:\\Users\\Joe\\Documents\\moby.txt"); Console console = System.console(); String inputWord; Scanner reader; void bigBang() { try (Scanner inputScanner = new Scanner(new BufferedReader( new FileReader(godFile)))) { Scanner reader = new Scanner(System.in); System.out.print("Synonyms for word: "); String theWord = reader.next(); one: while (inputScanner.hasNextLine()) { String line = inputScanner.nextLine(); String[] splitLine = line.split(","); for (String word : splitLine) { if (word.equalsIgnoreCase(theWord)) { System.out.println("Word Found!"); System.out.println("Synonyms for " + theWord + ":"); System.out.print((Arrays.toString(splitLine))); } } } } catch (Exception e) { e.printStackTrace(); } } }
type: Question
has title: What is the best way to get just the synonyms from Moby Grady Thesaurus in Java?

http://stackoverflow.com/comment/34958643
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22903912
has text: @seema what u observed and paste here that error log. and ya u have declare that int i right and its 0 then why u have put condition if(i !=0) do u thing that it will execute that block. even u have not updated I.
type: AnswerComment

http://stackoverflow.com/comment/34915045
type: Comment
has text: Welcome to SO! Which line produces the exception? And please show us the stacktrace.
comment on: http://stackoverflow.com/q/22881496
score: 1
type: QuestionComment

http://stackoverflow.com/q/22854803
score: 4
tagged with: apache-poi
answer count: 0
has body: I have created an excel file with dropdown using Apache POI. The below is the code: { row.createCell(i).setCellValue(col[i]); //i -- loop counter CellRangeAddressList addressList = new CellRangeAddressList(1, 1000, i, i); DVConstraint dvConstraint = DVConstraint.createExplicitListConstraint( new String[]{"10", "20", "30"}); DataValidation dataValidation = new HSSFDataValidation(addressList, dvConstraint); dataValidation.setSuppressDropDownArrow(false); sheet.addValidationData(dataValidation); } This code does the validation of the data when we have entered manually. If i enter value = 40 in the cell (that i generated) manually, it throws an error. But the issue comes when i try to copy the value = 40 from some different place and then pasting the value in the same cell (excel). It works !! How do i validate "copy-paste" of the data value (from different source) in the excel dropdown. Please kindly help in this. I am clueless. Thanks in advance.
type: UnansweredQuestion
tagged with: excel
has comment: http://stackoverflow.com/comment/34868314
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/36568376
upvote count: 4
has comment: http://stackoverflow.com/comment/72540867
tagged with: validation
has title: "Copy-Paste" data validation from different source in Apache POI Excel
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34869748

http://stackoverflow.com/comment/34868771
type: Comment
type: QuestionComment
has text: do you want to align right format or pass the value..
score: 0
comment on: http://stackoverflow.com/q/22855661

http://stackoverflow.com/comment/34942129
type: Comment
has text: I think you misunderstood the assignment. There's no way you can load a class that does not exist. `Addresbook` must be a class that exists and implements `AddressBookDataStore`.
type: QuestionComment
comment on: http://stackoverflow.com/q/22896741
score: 0

http://stackoverflow.com/q/22937720
score: -6
favorite count: 0
possible better answer: http://stackoverflow.com/a/22937865
has comment: http://stackoverflow.com/comment/35016097
has title: Need some advice on split() method in Java
has answer: http://stackoverflow.com/a/22937944
has comment: http://stackoverflow.com/comment/35016265
has comment: http://stackoverflow.com/comment/35015875
has body: I am writing a program in which I have to split String. Suppose my String is: LXI H, 2000H, MOV M A How to split it using split function in Java. Please reply soon.
downvote count: 6
has answer: http://stackoverflow.com/a/22937792
accepted answer: http://stackoverflow.com/a/22937792
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35015876
has comment: http://stackoverflow.com/comment/35015956
tagged with: split
has answer: http://stackoverflow.com/a/22937865
has comment: http://stackoverflow.com/comment/35015873
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/35015949
tagged with: string

http://stackoverflow.com/q/22863106
favorite count: 0
tagged with: flappy-bird-clone
score: 2
type: AnsweredQuestion
downvote count: 0
has body: Okay, I have Game, Bird, and Board classes. I have pipe creation, deletion, and movement code in my Game class. I was advised to not make a Pipe class and to create a pipe object. Without the pipe code, my game runs smoothly, although no pipes appear. When I have the pipe code, the program runs but does not make a window appear. I'll show you the Game constructor and the pipe code. public Game(int a) { super("Game"); setLayout(new BorderLayout()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); this.board = new Board(this); add(board, BorderLayout.CENTER); bird = new Bird(); bird.setArr(); System.out.println("Bird made"); /*setPipeHeight(a); setArr1(); setArr2(); System.out.println("Pipe made"); */ //It continues, but this is the section I am looking at } Now the pipe code public void setPipeHeight (int h){ System.out.println("Set height"); height = h; //Set coords setArr1(); setArr2(); /*for (int i = 0; i &lt; arrX1.length; i++){ for (int j = 0; j &lt; arrY1.length; j++){ } }*/ } public void setArr1(){ System.out.println("Set arr1"); int x = (Board.numCols - 1) - width; for (int i = 0; i &lt; width + 1; i++){ for (int j = 0; j &lt; height + 1; j = j + height){ int h = height; while (h &gt;= 0){ Board.grid[x][h] = 3; } } } } public void setArr2(){ System.out.println("Set arr2"); int tillTop = Board.numRows - (height + separation); for (int i = 0; i &lt; width + 1; i++){ for (int j = 0; j &lt; tillTop + 1; j = j + tillTop){ int h = height; while (h &gt;= 0){ Board.grid[x][h] = 3; } } } } public void movePipe(){ System.out.println("Move pipe"); x--; setArr1(); setArr2(); } When I do not comment out anything, it says it's running, but does not create a window. In the Game class, when I comment out these lines, the window appears but the bird does not move downward. /*setPipeHeight(a); setArr1(); setArr2(); System.out.println("Pipe made"); */ When I comment out the rest of the pipe code, I get a functioning game minus the pipes appearing
has answer: http://stackoverflow.com/a/22863177
accepted answer: http://stackoverflow.com/a/22863177
tagged with: loops
type: Question
has title: Strangely Malfunctioning Flappy Bird Code
tagged with: java
upvote count: 2
answer count: 1
tagged with: arrays

http://stackoverflow.com/q/22910226
has answer: http://stackoverflow.com/a/22910379
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: swt
has body: I want to capture Shift+Left Mouse Up event in SWT. I just want to print some sample message only while holding shift key down and releasing the left mouse button.
type: Question
accepted answer: http://stackoverflow.com/a/22910379
downvote count: 0
answer count: 1
has title: How to listen key and mouse event at a time in SWT(Shift+ Left MouseUp)?
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/34907976
type: AnswerComment
has text: @MadProgrammer: Well Swing Timer is not as fast as this method. And the use of `getGraphics()` is not recommended for Swing based components, but I am getting the graphics of an `Image`. That's a totally different thing. And this code is independent of any third party library.
type: Comment
comment on: http://stackoverflow.com/a/22877595
score: 0

http://stackoverflow.com/q/22895991
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34940677
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34940740
has answer: http://stackoverflow.com/a/22896042
downvote count: 0
tagged with: arraylist
answer count: 3
score: 2
has answer: http://stackoverflow.com/a/22896108
tagged with: subtraction
possible better answer: http://stackoverflow.com/a/22896076
favorite count: 0
has answer: http://stackoverflow.com/a/22896076
accepted answer: http://stackoverflow.com/a/22896042
upvote count: 2
has body: Here is an example: public static ArrayList&lt;Integer&gt; position = new ArrayList&lt;Integer&gt;(); public static ArrayList&lt;Integer&gt; new_position = new ArrayList&lt;Integer&gt;(); Collections.copy(new_position, position); for (int j = 0; j &lt; position.size(); j++) { new_position.get(j) -=4; } I want to copy values and then from my new arraylist subtract 4. How can I make it ? I'm new in java. Also I've got an error such as: The left-hand side of an assignment must be a variable, it refers to nowe_pozycje.get(j) -=4;.
has title: How can I subtract from arraylist some values ?

http://stackoverflow.com/q/22957280
has body: I was trying to encrypt data with help of following function in a desktop application : public String[] binaryToText(String[] binary1,int lengthofshares) { String[] encrptedfinally=new String[lengthofshares]; for(int tt=0;tt&lt;lengthofshares;tt++){ String ss2=""; String ss=binary1[tt]; char mynextChar; for(int i = 0; i &lt; ss.length(); i += 8) //this is a little tricky. we want [0, 7], [9, 16], etc { System.out.print(Integer.parseInt(ss.substring(i, i+8), 2)+","); mynextChar = (char)Integer.parseInt(ss.substring(i, i+8), 2); System.out.println(mynextChar); ss2 += mynextChar; } encrptedfinally[tt]=ss2; } return encrptedfinally; } But when i used the same function in a web application it gives different results.The integer.parseInt statement returns the same value but the character in which it is typecasted gets changed. In web application some positions are replaced by question marks '?' Web application pic in which each row correspond to integer and then character it being typecasted to : http://postimg.org/image/ydn9h9nsf/ and in desktop application the values are : http://postimg.org/image/ww88p3ot5/ What can be the reason ?Please help.
tagged with: java
has comment: http://stackoverflow.com/comment/35052622
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/35051019
has comment: http://stackoverflow.com/comment/35052575
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35051410
has comment: http://stackoverflow.com/comment/35052431
has comment: http://stackoverflow.com/comment/35052155
favorite count: 0
has comment: http://stackoverflow.com/comment/35051372
has comment: http://stackoverflow.com/comment/35051090
has comment: http://stackoverflow.com/comment/35051226
has comment: http://stackoverflow.com/comment/35050976
has comment: http://stackoverflow.com/comment/35051193
score: -1
has answer: http://stackoverflow.com/a/22957387
has comment: http://stackoverflow.com/comment/35051283
has comment: http://stackoverflow.com/comment/35052384
has comment: http://stackoverflow.com/comment/35051014
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35052002
has comment: http://stackoverflow.com/comment/35051305
has title: Same function showing different results
downvote count: 1
has comment: http://stackoverflow.com/comment/35051044
tagged with: jakarta-ee

http://stackoverflow.com/comment/34939816
comment on: http://stackoverflow.com/q/22894727
has text: yes it is true , i'm adding the entities
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22841218
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/34841499
tagged with: out-of-memory
accepted answer: http://stackoverflow.com/a/22841339
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has title: OutOfMemoryError: PermGen space when starting an embedded Tomcat
tagged with: embedded-tomcat-7
type: Question
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34841554
has answer: http://stackoverflow.com/a/22841339
has body: I have a library (vraptor-test) that does unit testing at my webservices in my maven project. In onder to run these tests, this library starts an embedded Tomcat. Tomcat tomcat = new Tomcat(); I have checked the dependency tree, and the list below representss tomcat related jars added to my project by the test library: +- org.apache.tomcat:tomcat-catalina:jar:7.0.23:compile [INFO] | | +- org.apache.tomcat:tomcat-servlet-api:jar:7.0.23:compile [INFO] | | +- org.apache.tomcat:tomcat-juli:jar:7.0.23:compile [INFO] | | +- org.apache.tomcat:tomcat-annotations-api:jar:7.0.23:compile [INFO] | | +- org.apache.tomcat:tomcat-api:jar:7.0.23:compile [INFO] | | \- org.apache.tomcat:tomcat-util:jar:7.0.23:compile [INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.23:compile [INFO] | \- org.apache.tomcat:tomcat-jasper:jar:7.0.23:compile [INFO] | +- org.apache.tomcat:tomcat-jsp-api:jar:7.0.23:compile [INFO] | +- org.apache.tomcat:tomcat-el-api:jar:7.0.23:compile [INFO] | +- org.eclipse.jdt.core.compiler:ecj:jar:3.7:compile [INFO] | \- org.apache.tomcat:tomcat-jasper-el:jar:7.0.23:compile When I run my test classes the error below pops up and the test doesn't even complete: SEVERE: A child container failed during start java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: PermGen space Usually, I would make changes to setenv.bat under tomcat folder to increase the PermGem space, but, since I'm running an embedded Tomcat, I can't find its folder, only its jars. I've tried increasing JVM memory in Eclipse (Window -> Preferences -> Java -> Installed JREs -> jdk -> Edit -> Default Vm Arguments) to -Xmx1024M -Xms1024M -XX:PermSize=2048m -XX:MaxPermSize=2048m but I'm still getting the same error. Where can I change permgem space of my embedded tomcat?

http://stackoverflow.com/q/22847844
tagged with: libgdx
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22855342
answer count: 1
has title: LibGDX Java game: Creating a stopwatch
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34859459
has body: I am creating a game using LibGDX for android. The goal of the game is to dodge as many falling objects as you can while a timer keeps track of how long you have been playing. Once the player contacts a falling object, the game is over and the screen is set to a GameOver screen. My problem is figuring out the best way to create a stopwatch to track the players progress. I have looked into the timer class built into Java, but I don't know if that is the best component to use. Does anyone have any insight? Thanks much, guys!
tagged with: timer
has answer: http://stackoverflow.com/a/22855342
has comment: http://stackoverflow.com/comment/34853695
type: AnsweredQuestion

http://stackoverflow.com/comment/35001968
has text: Typo in zone id (ZoneIf)
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/22929435

http://stackoverflow.com/q/22851792
tagged with: loops
possible better answer: http://stackoverflow.com/a/22852103
type: Question
has comment: http://stackoverflow.com/comment/34861311
has comment: http://stackoverflow.com/comment/34861363
tagged with: arrays
tagged with: compilation
accepted answer: http://stackoverflow.com/a/22851827
answer count: 2
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/34861241
favorite count: 0
score: -4
has body: First off, my program is not compiling. Any ideas? I have no idea why and my Eclipse program isn't working... Also, how do I get my "isLucky" method to loop through my array? And did I print out my results correctly in the main method? import java.util.Scanner; public class FunArrays { public static void main(String[] args) { luckyNumber1 = 7; luckyNumber2 = 13; luckyNumber3 = 18; int[] a=new int[10]; Scanner sc=new Scanner(System.in); System.out.println("Please enter numbers..."); for(int j = 0; j &lt; a.length; j++) a[j] = sc.nextInt(); boolean b = isLucky(a); int result; if(b) result = sum(a); System.out.println(sum(a)) else result = sumOfEvens(a); System.out.println(sumOfEvens(a)) } public static int sum(int [ ] value) { int i, total = 0; for(i=0; i&lt;10; i++) { total = total + value[ i ]; } return (total); } static int sumOfEvens(int array[]) { int sum = 0; for(int i = 0; i &lt; array.length; i++) { if(array[i] % 2 == 0) sum += array[i]; } return sum; } public static boolean isLucky (int[] array) { if ( array[i] == 7 || array[i] == 13 || array[i] == 18 ) return true; else return false; } // write the static methods isLucky, sum, and sumOfEvens }
linked to: http://stackoverflow.com/q/19459510
has answer: http://stackoverflow.com/a/22851827
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22852103
has title: Java program. How do I loop my "isLucky" method through my array? Also, how do I print my results correctly in the main method?
tagged with: java

http://stackoverflow.com/q/22881937
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34915541
has answer: http://stackoverflow.com/a/22882577
tagged with: swing
possible better answer: http://stackoverflow.com/a/22882333
has answer: http://stackoverflow.com/a/22882333
has body: I created a JFrame with a size of 400x400 pixels. But every time I run my application, it has another size (410 x 410), and sometimes it has 400 x 400 pixels. The code: panel = new JPanel() { private static final long serialVersionUID = -620625052080099140L; @Override public void paint(Graphics graphics) { super.paint(graphics); Graphics2D g = (Graphics2D) graphics; } }; panel.setSize(sizeX, sizeY); panel.setDoubleBuffered(true); frame= new JFrame("Simulation"); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.add(panel); frame.getContentPane().setPreferredSize(new Dimension(sizeX, sizeY)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true);
tagged with: java
has title: JFrame: 'Random' size?
has comment: http://stackoverflow.com/comment/34915950
accepted answer: http://stackoverflow.com/a/22882577
type: AnsweredQuestion
type: Question

http://stackoverflow.com/comment/34950738
type: Comment
comment on: http://stackoverflow.com/a/22901340
score: 1
type: AnswerComment
has text: @DrLivingston It is implemented as a heap: see the Javadoc.

http://stackoverflow.com/comment/34933593
type: QuestionComment
type: Comment
has text: Read [How to Use Internal Frames](http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html). Find sample code on Google or try [http://way2java.com/swing/jdesktoppane/](http://way2java.com/swing/jdesktoppane/)
comment on: http://stackoverflow.com/q/22891869
score: 0

http://stackoverflow.com/comment/34966179
type: Comment
has text: The driver has a connection pool, which can be configured via MongoOptions to have a number of established idle connections open at all times to facilitate faster querying. You are correct in saying that you should not need to close this pool until your application is terminating.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22904509

http://stackoverflow.com/a/22835683
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22835563
has comment: http://stackoverflow.com/comment/34834756
has body: I'd bet your client jar doesn't include the *.java source files. GWT needs both compiled classes and source files (primarily source files). See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/library.html
answers question: http://stackoverflow.com/q/22835563
has comment: http://stackoverflow.com/comment/34835396
type: Answer
has comment: http://stackoverflow.com/comment/34831906
upvote count: 2
has comment: http://stackoverflow.com/comment/34832861
score: 2

http://stackoverflow.com/q/22897006
type: Question
has title: How do I within SQLite, return a row based on 3 values rather than just one? (Already done code for 1)
score: 0
has comment: http://stackoverflow.com/comment/34942735
tagged with: sql
tagged with: sqlite
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: Within SQLite, I can search a table for a particular row which contains 1 values for instance a player name but I want to return a row based on 3 values for instance Player name, Team name and favorite color etc. How do I alter below code to do this? Code for searching based upon one value is below: public BackupDatastore getentry(String value, String columnName) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_Name, new String[] { KEY_ID, KEY_Team_Name, KEY_Ref_Name, KEY_Date, KEY_Player_1, KEY_Player_2, KEY_Player_3, KEY_Player_4, KEY_Player_5, KEY_Player_6, KEY_Player_7 , KEY_Player_8}, columnName + "=?", new String[] { value }, null, null, null, null); if (cursor != null) { boolean move = cursor.moveToFirst(); //false value means the query returned 0 results if(!move) { return BackupDatastore.kEmptyData; } } BackupDatastore entry = new BackupDatastore(Integer.parseInt(cursor.getString(0)), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getString(4), cursor.getString(5), cursor.getString(6), cursor.getString(7), cursor.getString(8), cursor.getString(9), cursor.getString(10), cursor.getString(11)); // return entry return entry; }
has answer: http://stackoverflow.com/a/22897178
tagged with: java
tagged with: mysql

http://stackoverflow.com/q/22960667
has title: How to get link with multiline caption in vaadin framework
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35063793
tagged with: frameworks
score: 1
tagged with: java
tagged with: vaadin
has comment: http://stackoverflow.com/comment/35062842
type: Question
upvote count: 1
tagged with: web
favorite count: 0
has comment: http://stackoverflow.com/comment/35103783
has body: i have a requirement of having a link component with mutliline caption new Users??? //line 1 of same link Register Here //line 2 of same link i am using reindeer theme for my application how to do it ????

http://stackoverflow.com/q/22861131
has comment: http://stackoverflow.com/comment/34877595
type: Question
has comment: http://stackoverflow.com/comment/34877776
tagged with: jpanel
has title: How to layout this GUI?
score: 0
has body: I am creating a GUI in java. Currently i have an empty JFrame and am trying to add a JPanel to it. The JPanel contains buttons, text etc. However none of this is being properly displayed. My code is as follows: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class memoDisplayUI { JFrame frame = new JFrame(); JPanel panel = new JPanel(); JTextArea jTextBox = new JTextArea(); JScrollPane scroll = new JScrollPane(); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { memoDisplayUI frame = new memoDisplayUI(); frame.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public memoDisplayUI() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame.getContentPane().setBackground(new Color(255, 255, 255)); frame.getContentPane().setLayout(null); frame.setBounds(100, 100, 270, 400); frame.setUndecorated(true); //REMOVES MENU BAR frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel lblMemos = new JLabel("MEMOS"); lblMemos.setForeground(new Color(100, 149, 237)); lblMemos.setFont(new Font("Moire", Font.BOLD, 30)); lblMemos.setBounds(16, 16, 234, 37); panel.add(lblMemos); JButton button = new JButton(""); button.setBackground(new Color(100, 149, 237)); button.setBounds(7, 350, 40, 40); panel.add(button); button.setIcon(new ImageIcon("back.png")); JButton button_1 = new JButton(""); button_1.setBackground(new Color(100, 149, 237)); button_1.setBounds(113, 350, 40, 40); panel.add(button_1); button_1.setIcon(new ImageIcon("Edit.png")); JButton button_2 = new JButton(""); button_2.setBackground(new Color(100, 149, 237)); button_2.setBounds(220, 350, 40, 40); panel.add(button_2); button_2.setIcon(new ImageIcon("memo.png")); JButton btnExit = new JButton(""); btnExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.exi…
tagged with: user-interface
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/34877527
has comment: http://stackoverflow.com/comment/34877349
has comment: http://stackoverflow.com/comment/34877259
answer count: 0
tagged with: java

http://stackoverflow.com/q/22944524
has title: Compare two Excel sheet and find out mismatches using a Java program
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35028836
has comment: http://stackoverflow.com/comment/35028634
has comment: http://stackoverflow.com/comment/35028823
tagged with: excel
answer count: 0
has comment: http://stackoverflow.com/comment/35028717
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35028739
tagged with: forms
type: Question
tagged with: comparison
has comment: http://stackoverflow.com/comment/35028861
has body: I have two similar Excel sheets, i.e. column name and rows contents are the same. I have to write a Java program to compare those two Excel sheets and generate simple HTML form for showing the mismatches in it. Example in Excel sheet position (1 row, 3 column) contain value 15 and other excel has of 20. So I have to generate the HTML form (UI ) or Simple report with which column has mismatches and what value in it Please help me on this.Your help is highly appreciated
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/35029247

sorting
tags question: http://stackoverflow.com/q/22842976
tags question: http://stackoverflow.com/q/22873026
tags question: http://stackoverflow.com/q/22905788
tags question: http://stackoverflow.com/q/22901651
tags question: http://stackoverflow.com/q/22922506
tags question: http://stackoverflow.com/q/22898596
tags question: http://stackoverflow.com/q/22868117
tags question: http://stackoverflow.com/q/22826953
tags question: http://stackoverflow.com/q/22850664
tags question: http://stackoverflow.com/q/22812349
tags question: http://stackoverflow.com/q/22927129
tags question: http://stackoverflow.com/q/22828888
tags question: http://stackoverflow.com/q/22880571
tags question: http://stackoverflow.com/q/22902338
tags question: http://stackoverflow.com/q/22826397
tags question: http://stackoverflow.com/q/22827673
tags question: http://stackoverflow.com/q/22868901
tags question: http://stackoverflow.com/q/22821534
tags question: http://stackoverflow.com/q/22825395
tags question: http://stackoverflow.com/q/22852113
tags question: http://stackoverflow.com/q/22914628
tags question: http://stackoverflow.com/q/22902840
tags question: http://stackoverflow.com/q/22966195
tags question: http://stackoverflow.com/q/22895518
tags question: http://stackoverflow.com/q/22853775
tags question: http://stackoverflow.com/q/22868371
tags question: http://stackoverflow.com/q/22874756
type: Tag
tags question: http://stackoverflow.com/q/22929423
tags question: http://stackoverflow.com/q/22859464
tags question: http://stackoverflow.com/q/22872946
tags question: http://stackoverflow.com/q/22956562
tags question: http://stackoverflow.com/q/22926170
tags question: http://stackoverflow.com/q/22952159
tags question: http://stackoverflow.com/q/22931177
tags question: http://stackoverflow.com/q/22874129
tags question: http://stackoverflow.com/q/22860833
tag name: sorting
tags question: http://stackoverflow.com/q/22888883
tags question: http://stackoverflow.com/q/22946232
tags question: http://stackoverflow.com/q/22899372
tags question: http://stackoverflow.com/q/22833047
tags question: http://stackoverflow.com/q/22874117
tags question: http://stackoverflow.com/q/22898530
tags question: http://stackoverflow.com/q/22865420
tags question: http://stackoverflow.com/q/22858074

http://stackoverflow.com/comment/34856524
has text: I solved the problem thanks to user: peter.petrov who pointed out which line was was giving the wrong value. It appears that I had the images saved in the src folder instead of the bin folder. Moving them fixed the problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22849049
type: QuestionComment

http://stackoverflow.com/q/22904611
favorite count: 0
type: Question
tagged with: android
tagged with: android-intent
has answer: http://stackoverflow.com/a/22904648
score: -1
tagged with: java
tagged with: sharedpreferences
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/22904648
type: AnsweredQuestion
has title: Android: Shared preferences not working
upvote count: 0
has body: I currently have the following SharedPreferences set up like the following: public class MainActivity extends Activity implements OnClickListener { Button openedLockers, closedLockers, checkout, admin; SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit(); I also have another SharedPreferences for something else: Private void runOnce() { // TODO Auto-generated method stub SharedPreferences settings = getSharedPreferences("PREFS_NAME", 0); mboolean = settings.getBoolean("FIRST_RUN", false); if (!mboolean) { // do the thing for the first time settings = getSharedPreferences("PREFS_NAME", 0); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("FIRST_RUN", true); editor.commit(); prepopulate(); } else { // other time your app loads } } Then I call it: public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { case R.id.setIp: AlertDialog alert = new AlertDialog.Builder(MainActivity.this) .create(); alert.setTitle("Enter new ip"); alert.setMessage("Enter the new ip"); final EditText input = new EditText(this); alert.setView(input); alert.setButton("submit", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub String value = input.getText().toString(); editor.putString("IP", value); editor.commit(); SharedPreferences preferences = getPreferences(MODE_PRIVATE); String tut = preferences.getString("IP", ""); ip = tut; } }); break; } return false; } However when I run the application I get the following: 04-07 12:49:30.085:W/dalvikvm(12538): threadid=1: thread exiting with uncaught exception (group=0x41679c08) 04-07 12:49:30.085: E/AndroidRuntime(12538): FATAL EXCEPTION: main 04-07 12:49:30.085: E/AndroidRuntime(12538): Process: com.samsunglockercenter, PID: 12538 04-07 12:49:30.085: E/AndroidRuntime(12538): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.samsunglockerc…

http://stackoverflow.com/comment/82186223
has text: Whichever method is used, to check that it worked, enter the following in the Matlab prompt: `java.lang.Runtime.getRuntime().maxMemory()`. This will give you a number in bytes, which should be similar to the `-Xmx` number you've specified.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/42219222

http://stackoverflow.com/a/32953309
downvote count: 0
answers question: http://stackoverflow.com/q/22817259
has body: This is an issue with the OS. Unfortunately, it just doesn't seem to work. If you don't want people looking at your app from the recents for some reason, you can put getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE) As the first line in your onCreate() method of the activity.
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/q/22823339
tagged with: java
has title: Weird behavior with Graphstream Mouse Listener and Swing JMenuBar
downvote count: 0
favorite count: 0
tagged with: graphstream
type: UnansweredQuestion
answer count: 0
tagged with: jmenubar
tagged with: mouselistener
score: 1
has body: I'm making a program which creates and displays graphs. I have a class which handles a graph and implements a mouse listener (Graphstream ViewerListener). In order to grab the events, you need to use a loop and call a pump() method until you're done. To display the graph, the Graphstream library has a View object which extends and can be used as a regular Jpanel, just set the View object as a content pane in the JFrame. My class works fine when used with a JFrame with no menu bar. But when i set a JMenuBar at the JFrame, the problems start. I call the method inside my graph class, it gets inside the loop, but the ViewerListener doesn't work, like it's not listening for events. Why? This is my class code, unnecessary stuff omitted public class GeneratedGraph implements ViewerListener{ public String[] getNodes(){ boolean flag=true; startEndNodes[0]=null; startEndNodes[1]=null; arrayposition=0; while(flag){ System.out.println("Inside the loop"); fromViewer.pump(); try { Thread.sleep(250); } catch (InterruptedException e) { e.printStackTrace(); } if(startEndNodes[0]!=null &amp;&amp; startEndNodes[1]!=null){ flag=false; } } System.out.println("Outside the loop"); return startEndNodes; } public void buttonPushed(String id) { //This method fires up when you click on a node System.out.println("Button pushed on node "+id); startEndNodes[arrayposition]=id; arrayposition++; if(arrayposition&gt;1){ arrayposition=0;} } } Now, to put things into perspective, this WORKS, gets in, grabs the nodes, and exits the loop fine. (unnecessary code again omitted) public class main extends implements ActionListener { public static void main(String args[]){ JFrame mainFrame = new JFrame("Graph"); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GeneratedGraph myGraph = new GeneratedGraph(mainFrame); myGraph.option1(5,6); //a method which creates a graph myGraph.show(); mainFrame.pack(); mainFrame.setVisible(true); String s[] = myGraph.getNodes(); } } But when i add this, it doesn't. …
upvote count: 1
tagged with: swing
type: Question

http://stackoverflow.com/comment/34916852
type: AnswerComment
has text: @arindrajit Yes I'm here. Sorry, but I did not wait all day long of problems from stackoverflow. Your misstake is insinde your client program. There is a loop `while ((b = bfINPUT.read()) != -1) {`. This loop waits untill the server close the input stream (but this should never happens). Your client never leave this loop. That's the reason we need different threads for reading an writing, because both could happen at the same time. Hope that helps.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22881978

http://stackoverflow.com/comment/34845526
type: AnswerComment
has text: you would be safer using `"".equals(distanceTF.getText())`
comment on: http://stackoverflow.com/a/22843486
type: Comment
score: 0

http://stackoverflow.com/comment/34847434
has text: The way the original array is initialized (which is different than how most people would do it), you've got the indexes of the 2-D array in the wrong order--should be `statesAndCapitols[0][i]` and `statesAndCapitols[1][i]`.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22844485

http://stackoverflow.com/comment/34859732
type: Comment
type: QuestionComment
has text: Are you sure you are reading the input using `FileManager` correctly?
score: 0
comment on: http://stackoverflow.com/q/22850822

http://stackoverflow.com/comment/35107889
type: Comment
comment on: http://stackoverflow.com/a/22988951
has text: data.get(position).getSONG_MP3()= your song url - see updated code, in your case that will be urlStr
type: AnswerComment
score: 0

http://stackoverflow.com/q/22867418
score: 0
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22867706
tagged with: utf-8
has body: Thi is a fundamental questuion about how java works and so i dont have any code to support it. I am new to java development and want to know how the different number systems, charecter sets like UTF 8 and unicode come together in Java. Lets say a user creates a new string and int with the same value. int i=100; String S="100"; The hardware of a computer understands zeros and ones. so it has to be converted to binary?(correct me if im wrong). this conversion should be done by the JVM(correct me if im wrong)? and to represent charecters of different languages into charecters that can be typed into the keyboard (english) UTF-8 and such conversions are used(correction needed)? now how does this whole flow fit into the bigger picture of running a java web application? how does a string/int get converted to a binary for the machine's hardware to understand? how does it get converted to UTF-8 for a browser to understand? and what are the default number format and charecterset in java? if im reading contents of a file? will they be read into binary or utf-8?
tagged with: binary
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22869449
has title: default number system and charecter set in java

http://stackoverflow.com/comment/34877014
type: Comment
score: 3
comment on: http://stackoverflow.com/q/22860639
type: QuestionComment
has text: Right-click in the your IDE, choose "Generate equals and hashCode", and examine the correct implementation produced by your IDE. Or use `Objects.hash(x, y)`.

svnkit
tags question: http://stackoverflow.com/q/22941286
type: Tag
tag name: svnkit

http://stackoverflow.com/a/22833360
accepted answer of: http://stackoverflow.com/q/22833135
has comment: http://stackoverflow.com/comment/34827827
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/34829358
upvote count: 1
has body: Your onActivityResult() should lie in FragmentActivity because you are calling startActivityResult() from that class only.
answers question: http://stackoverflow.com/q/22833135
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22809397
score: 0
has body: GSON properly handles nested objects if the field types are set correctly. No extra code is needed. Take a look at the user guide
answers question: http://stackoverflow.com/q/22809249
type: Answer

http://stackoverflow.com/comment/34976204
comment on: http://stackoverflow.com/a/22914912
has text: i change it but the same thing it give to creat a methode modele
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22965975
has comment: http://stackoverflow.com/comment/35067020
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/35068018
has answer: http://stackoverflow.com/a/22989029
tagged with: java-compiler-api
tagged with: classpath
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35066863
accepted answer: http://stackoverflow.com/a/22989029
downvote count: 0
has title: How to set up classpath of JavaCompiler to multiple .jar files using wildcard
favorite count: 0
possible better answer: http://stackoverflow.com/a/22967016
linked to: http://stackoverflow.com/q/1237093
has answer: http://stackoverflow.com/a/22967016
has body: I am using JavaCompiler of javax.tools to compile some java code and I am trying to use wildcard in my classpath in order to include all the .jar files but I fail. Here is my code: String classpath = "C:\tomcat6\webapps\myapp/WEB-INF/lib/javax.ws.rs-api-2.0-m10.jar;" + "C:\\tomcat6\\webapps\\myapp/WEB-INF/lib/javax.persistence-2.1.0.jar"; Iterable&lt;String&gt; options = Arrays.asList("-d", classesBaseDir, "-classpath", classpath); JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, options, null, file); boolean result = task.call(); The code above works just fine. But when I am trying to change the classpath to String classpath = "C:\\tomcat6\\webapps\\myapp/WEB-INF/lib/*"; it fails with compiler.err.doesnt.exist|package javax.ws.rs does not exist ... symbol: class GET location: class com.my.oasis.resources.TestClass 09/04/2014 14:27:09:030 | COMPILER_DIAGNOSTIC | compileResource() - compiler.err.cant.resolve.location|cannot find symbol ... I have also tried the following alterations String classpath = "\"C:\\tomcat6\\webapps\\myapp/WEB-INF/lib/*\""; String classpath = "'C:\\tomcat6\\webapps\\myapp/WEB-INF/lib/*'"; but none of them worked. Any ideas? Thanks Note: the reason why the path includes slashes and backslashes is because the my program identifies the environment in runtime and auto completes the path. Edit: I am using tomcat 6 and java 1.7.0_21

http://stackoverflow.com/comment/34988683
type: AnswerComment
comment on: http://stackoverflow.com/a/22921915
has text: how would I do this for both for loops?
type: Comment
score: 0

http://stackoverflow.com/a/23002916
accepted answer of: http://stackoverflow.com/q/22832054
answers question: http://stackoverflow.com/q/22832054
score: 0
type: AcceptedAnswer
has body: package com.hb.util; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.awt.image.FilteredImageSource; import java.awt.image.ImageFilter; import java.awt.image.ImageProducer; import java.awt.image.RGBImageFilter; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import org.apache.commons.io.FileUtils; import org.fusesource.hawtbuf.ByteArrayInputStream; public class ImageCompressingUtils { public static void main(String[] args) { String path = "F:/2huazhuangpin990x395.jpg"; long c = System.currentTimeMillis(); ImageCompressingUtils.compress(path, "F:/1.png", "png", 0.8); System.out.println("elapse time:" + (System.currentTimeMillis() - c) / 1000.0f + "s"); } public static BufferedImage getTransparentScaledImage(BufferedImage originalImage, int finalWidth, int finalHeight) { int originalWidth = originalImage.getWidth(); int originalHeight = originalImage.getHeight(); if (originalWidth == 0 || originalHeight == 0 || (originalWidth == finalWidth &amp;&amp; originalHeight == finalHeight)) { return originalImage; } BufferedImage intermediateImage = new BufferedImage(finalWidth, finalHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D gi = intermediateImage.createGraphics(); gi.setComposite(AlphaComposite.SrcOver); gi.setColor(new Color(0, 0, 0, 0)); gi.fillRect(0, 0, finalWidth, finalHeight); gi.drawImage(originalImage.getScaledInstance(finalWidth, finalHeight, Image.SCALE_SMOOTH), 0, 0, null); gi.dispose(); return intermediateImage; } public static Image makeColorTransparent(Image im, final Color color) { ImageFilter filter = new RGBImageFilter() { public int markerRGB = color.getRGB() | 0xFF000000; public final int filterRGB(int x, int y, int rgb) { if ((rgb | 0xFF000000) == markerRGB) { return 0x00FFFFFF &amp; rgb; } else { return rgb; } } }; ImageProducer ip = new FilteredImageS…
type: Answer

http://stackoverflow.com/comment/91222447
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/52136243
has text: While this code may answer the question, providing information on how and why it solves the problem improves its long-term value
score: 0

http://stackoverflow.com/comment/34805720
has text: @John: You shouldn't need an explicit constructor there unless it's something to do with `Task<Integer>`, but we'd really need to see the full code to know more. Likewise I can't tell anything about `progressProperty()` based on this code, but it's really nothing to do with the topic of this question. Please stick to one question per post - Stack Overflow isn't really designed for "question creep" like this.
type: Comment
comment on: http://stackoverflow.com/a/22819047
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34982431
score: 0
type: QuestionComment
type: Comment
has text: please try what I have tried coding..Can you please suggest something better
comment on: http://stackoverflow.com/q/22917572

http://stackoverflow.com/a/22956701
answers question: http://stackoverflow.com/q/22956260
has body: I would not assume the JavaScriptExecutor failed to execute your Script first, but see if the Script is working as expected. Try to set break point at "e.click();" and then start debugging, after that try to run your Script (which is "arguments[0].click();" in your case) in browser console and see what happened. If you have confirmed the script is good, then try to put break point at your executeScript and make sure that line of code have been run successfully.
type: Answer
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/35066731
type: Comment
type: QuestionComment
has text: Your problem is about Java, not, JavaScript. In fact, your problem is about where you have placed your resources files (JS, CSS, images, etc). Please remove the unrelevant code (Servlet doesn't play any role here, neither web.xml) and post the relevant HTML code that is generated and how your files are distributed in your application.
comment on: http://stackoverflow.com/q/22965738
score: 0

http://stackoverflow.com/comment/34835445
type: Comment
score: 0
has text: I guess you are running your application in server (for example, Tomcat) but the libraries added to Eclipse project classpath are not copied to Tomcat 'libs' catalog and not shipped with your war file (you can verify this from exploded catalog in webapps under your application folder -> then 'WEB-INF'/lib. As a quick fix you can add the jar files into Tomcat lib catalog and they will be available to all web applications deployed to your server by default.
comment on: http://stackoverflow.com/a/22837133
type: AnswerComment

http://stackoverflow.com/q/22920070
tagged with: class
type: Question
score: 0
answer count: 1
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34984502
has body: I have a Task class and a Dev class. I am assigning tasks to devs, and am logging which tasks are assigned to each dev in an ArrayList contained within Dev. This is my method in Task that assigns the particular task to the particular dev, with the Task constructor below it: public void setAssignedDev(Dev dev){ this.assignedDev=dev; dev.addToTasksAssigned(this); } public Task(String newProject,String newDescription, float newEarliestStartTime,float newDuration,float newLatestFinishTime,boolean newIsTaskReferenced,ArrayList&lt;Dev&gt; newListDevs){ project=newProject; description=newDescription; earliestStartTime=newEarliestStartTime; duration=newDuration; latestFinishTime=newLatestFinishTime; isTaskReferenced=newIsTaskReferenced; newListDevs=new ArrayList&lt;Dev&gt;(); }; The setAssignedDev() method triggers the ArrayList&lt;Task&gt; in Dev to log the task, and then the list is sorted: public Dev(String newName){ name=newName; tasksAssigned=new ArrayList&lt;Task&gt;(); } public void addToTasksAssigned(Task task){ this.tasksAssigned.add(task); //sort list by allotted start time Collections.sort(tasksAssigned, new Comparator&lt;Task&gt;(){ @Override public int compare(Task t1, Task t2){ if(t2.getAllottedStartTime()&gt;t1.getAllottedStartTime()){return +1;} if(t2.getAllottedStartTime()&lt;t1.getAllottedStartTime()){return -1;} else {return 0;} } }); To test this I have initialised some instances of the classes and then printed the tasksAssigned ArrayList. Main method below: Dev chris=new Dev("Chris"); Dev dave=new Dev("Dave"); Task task1=new Task("LCN","",3f,1f,5f,false, new ArrayList&lt;Dev&gt;(Arrays.asList(chris,dave))); task1.setAllottedStartTime(3.5f); Task task2=new Task("Project","",0f,3.5f,6f,false,new ArrayList&lt;Dev&gt;(Arrays.asList(chris))); task2.setAllottedStartTime(0f); task1.setAssignedDev(chris); task2.setAssignedDev(chris); System.out.println(chris.getTasksAssigned()); Now when I run this the system prints out: [[Task-null], [Task-null]] Tasks are bei…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35046592
tagged with: object
has title: An ArrayList containing objects I have constructed is printing these as null
tagged with: java
has answer: http://stackoverflow.com/a/22920897

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/22923957
tags question: http://stackoverflow.com/q/22892461
type: Tag

http://stackoverflow.com/comment/34891659
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22868629
score: 1
has text: @JasonC if i manually set it off screen, it will draw partially, but during the game this should never happen, thats what this `if ball.get() ...` is for. If the ball gets close enough to the edge that the texture would have to get offscreen, it should stop and draw at `0` position on `Y axis`. For some reason when ball position changes sligthly (and `if( ... == true )`), it jumps from 1st `else` case to the 2nd `else` case and then back again, this where the flickering comes from

http://stackoverflow.com/comment/34812234
has text: I am req. to pass it through as a parameter
type: Comment
comment on: http://stackoverflow.com/a/22824037
score: 0
type: AnswerComment

http://stackoverflow.com/a/22820021
has body: I would recommend you read on how JBoss classloader works. I.e how it delegates to other classloaders You can add the class to the java classpath on the filesystem but it depends on how the above works, which file gets loaded first. A warning, do not mix different versions of the class by using the above classloaders. The problems that you can run into can be very hard to solve.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22819693

http://stackoverflow.com/comment/85702288
has text: After selecting use as source folder option, the structure of folder is created but while updating the maven project it is giving error : Unable to update maven configuration for the following projects. Cannot nest 'Foldername/src/main/java' inside 'Foldername/src'. To enable the nesting exclude 'main/' from 'SelectExample/src'
type: AnswerComment
comment on: http://stackoverflow.com/a/22915508
type: Comment
score: 0

http://stackoverflow.com/comment/34934389
type: QuestionComment
has text: Why aren't anyone answering my questions? :O
score: 0
comment on: http://stackoverflow.com/q/22892326
type: Comment

http://stackoverflow.com/q/22940392
tagged with: guava
tagged with: java
has title: What is the C# equivalant of Java's SettableFuture and ListenableFuture?
type: Question
tagged with: c#
score: 5
upvote count: 5
accepted answer: http://stackoverflow.com/a/22940530
tagged with: .net
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm porting Java code that uses the concurrent Guava library to C#. I came across many uses of SettableFuture and ListenableFuture. Is there a C# class that comes very close to this pattern? Or do there exist C# wrappers for it? Because I want to change the flow of the code as less as possible.
tagged with: porting
has answer: http://stackoverflow.com/a/22940530
type: AnsweredQuestion

http://stackoverflow.com/comment/34815303
type: Comment
type: QuestionComment
has text: +1. I've often wondered if there's a better way to deal with methods that throw UnsupportedEncodingException when all I want is the mandatorily-supported UTF-8. (My solution so far has been to use `Throwables.propagate`, which is not too bad, but still.)
comment on: http://stackoverflow.com/q/22826408
score: 0

http://stackoverflow.com/comment/35087389
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22957718
type: Comment
has text: It seems that IE doesn't support document.evaluate.

http://stackoverflow.com/comment/57821872
comment on: http://stackoverflow.com/q/22842743
score: 0
type: Comment
type: QuestionComment
has text: Possible duplicate of [What should I set JAVA\_HOME to on OSX](http://stackoverflow.com/questions/1348842/what-should-i-set-java-home-to-on-osx)

http://stackoverflow.com/q/22833135
has comment: http://stackoverflow.com/comment/34827651
has comment: http://stackoverflow.com/comment/34827511
has body: I want to startActivityResult() but onActivityResult() is not called... In my Fragment : ivAvatar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ChangeAvatar.onClickAvatar(getActivity(), ivAvatar); pathAvatar = ChangeAvatar.getPathAvatar(); } }); In my class ChangeAvatar.java : public class ChangeAvatar { public static FragmentActivity activity; private static Uri mCapturedImageURI; private static ImageView ivAvatar; private static String pathAvatar; private static final int CAPTURE_PICTURE = 0; private static final int SELECT_PICTURE = 1; private static final int SELECT_PICTURE_GOOGLE = 2; public ChangeAvatar () { } public static void onClickAvatar(FragmentActivity a, ImageView iv) { ivAvatar = iv; activity = a; final CharSequence[] items = { "Prendre une photo", "Choisir une image", "Annuler" }; AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity); // set title alertDialogBuilder.setTitle("Avatar :"); // set dialog message alertDialogBuilder.setCancelable(false).setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { if (item == 0) { ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.TITLE, ""); mCapturedImageURI = activity.getContentResolver().insert( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 170); intent.putExtra("aspectY", 170); intent.putExtra("outputX", 5000); intent.putExtra("outputY", 5000); activity.startActivityForResult(Intent.createChooser(intent, "Appareil photo"), CAPTURE_PICTURE); } if (item == 1) { Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); intent.setType("image/*"); activity.startActivityForResult(Intent.createChooser(intent, "Choisir une ap…
tagged with: android
has answer: http://stackoverflow.com/a/22833360
possible better answer: http://stackoverflow.com/a/22833456
has comment: http://stackoverflow.com/comment/34827948
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22833456
type: Question
accepted answer: http://stackoverflow.com/a/22833360
tagged with: java
has title: onActivityResult() is not called in another class
score: 0
has comment: http://stackoverflow.com/comment/34827457
answer count: 2

http://stackoverflow.com/comment/34788365
type: QuestionComment
comment on: http://stackoverflow.com/q/22811668
score: 0
has text: So, tell us what's the idea behind? You only want to get the first result? How about a `break` statement in the `if`?
type: Comment

http://stackoverflow.com/q/22909112
has title: Java Heap Space error is occurring
answer count: 3
possible better answer: http://stackoverflow.com/a/22909223
has answer: http://stackoverflow.com/a/22910606
downvote count: 0
has answer: http://stackoverflow.com/a/22909223
favorite count: 0
accepted answer: http://stackoverflow.com/a/22910606
tagged with: heap-memory
tagged with: android
has body: Java Heap Space error occurring in my system. I tried lot of solutions from Stack Overflow but nothing is working. When i am working when pressing OK then (No error in my project) My eclipse.ini Is: -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.v20120913-144807 -product com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256M -showsplash com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.6 -Declipse.buildId=v22.3.0-887826 -XX:MaxPermSize=512M My RAM:4GB Please help me to solve this issue.
has answer: http://stackoverflow.com/a/22909202
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/22862099
type: Question
score: 0
tagged with: cloud
answer count: 1
has body: I am developing a hospital information system which does a lot of stuff such as capturing patient and medical practitioner's details. The system is supposed to generate daily reports which should be stored safely. What I want the system to do is to store those generated reports in say dropbox without having to open the browser and entering url (usual way) but using a few clicks within the app so that backup can be done.
has title: Any suggestions on how I can integrate cloud storage with my native Java application in Windows
accepted answer: http://stackoverflow.com/a/22862717
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22862717
tagged with: java

http://stackoverflow.com/comment/34876798
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22860682
has text: Definitely check any recursive code, also the error should tell you the line that the problem is happening on, if you could post us the code at that point we might be able to help

http://stackoverflow.com/comment/34943842
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22897582
has text: thanks for the help guys, the reason I was confused is I'm working on updating some code for work, and it looks like there's some unnecessary stuff, so i was trying to understand why its there
score: 0

http://stackoverflow.com/comment/34825667
score: 0
has text: There is a `TYPE_INT_RGB` in the code, and not `TYPE_INT_ARGB`. Apart from that: Why are you creating a scaled instance at all? You can direcly paint the original image (with the desired size) into the target image.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22832054

http://stackoverflow.com/a/22849421
type: Answer
has body: Exception in thread "main" org.apache.jena.riot.RiotNotFoundException: Not found: jungle.n3 The file is not found in the current directory. Fixing the many copies of Java may help - some of those older copies may need "file:" on the front but newer versions do not.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22846026
upvote count: 1

http://stackoverflow.com/q/22909732
type: AnsweredQuestion
tagged with: java
has body: I am new to Java and I want to call my saved pipeline using GATE JAVA API through Eclipse I am not sure how I could do this although I know how to create new documents etc FeatureMap params = Factory.newFeatureMap(); params.put(Document.DOCUMENT_URL_PARAMETER_NAME, new URL("http://www.gate.ac.uk")); params.put(Document.DOCUMENT_ENCODING_PARAMETER_NAME, "UTF-8"); // document features FeatureMap feats = Factory.newFeatureMap(); feats.put("date", new Date()); Factory.createResource("gate.corpora.DocumentImpl", params, feats, "This is home"); //End Solution 2 // obtain a map of all named annotation sets Document doc = Factory.newDocument("Document text"); Map &lt;String, AnnotationSet&gt; namedASes = doc.getNamedAnnotationSets(); System.out.println("No. of named Annotation Sets:" + namedASes.size()); // no of annotations each set contains for (String setName : namedASes.keySet()) { // annotation set AnnotationSet aSet = namedASes.get(setName); // no of annotations System.out.println("No. of Annotations for " +setName + ":" + aSet.size());
has title: Calling Existing PipeLine in GATE
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22916003
score: 0
possible better answer: http://stackoverflow.com/a/22929212
has answer: http://stackoverflow.com/a/22929212
tagged with: gate
accepted answer: http://stackoverflow.com/a/22916003

http://stackoverflow.com/q/22923228
tagged with: java
downvote count: 3
type: Question
has body: i want to browse web pages and i want my intent take a value from EditText i already declare tf1 as a new EditText and link it with the one in my activity , but my problem is in a concatenation My EditText with Uri here is my code: b2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub String url = "http://" + tf1 + " "; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } });
has answer: http://stackoverflow.com/a/22923302
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/22923290
favorite count: 0
has title: Concatenate in android
type: UnansweredQuestion
tagged with: android
score: -3
tagged with: android-intent

http://stackoverflow.com/q/22850205
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has title: Mapping Mime Type attribute for Simple-Framework
has answer: http://stackoverflow.com/a/22867199
answer count: 1
downvote count: 0
tagged with: deserialization
has body: I am using the Simple-Framework to do deserialization of an atom feed that I use the Volley library to retrieve. The entries come in the following formats: &lt;link href="http://www.example.com/story.html" length="35743" type="html" rel="enclosure" title="" /&gt; &lt;link href="http://www.example.com/image.jpeg" length="35743" type="image/jpeg" /&gt; The basic class model for this is as follows: @Root(strict=false) public class ItemLink{ @Attribute String href; @Attribute String length; @Attribute ContentTypeModel; } The type attribute is mapped to an enumeration: public enum ContentTypeModel { html, MP4, plaintext } The items that have the image/jpeg mime type cause errors because they do not exist in the enumeration, however there is an issue with the "/" character which is invalid java syntax. How can I map this type while still using the enumeration? Is it possible to use @Path and then do parsing with an XPath? I'd like to avoid this but if it's the only way then I will use it.
accepted answer: http://stackoverflow.com/a/22867199
tagged with: simple-framework
has comment: http://stackoverflow.com/comment/34888395
tagged with: android
favorite count: 0
upvote count: 1

http://stackoverflow.com/q/22919364
accepted answer: http://stackoverflow.com/a/59982542
tagged with: io
has body: I'm working on a data analytics project where we are representing a lot of the basic entities you find in a language. I'd like to find a better way to print out their object graphs though for debugging purposes though. So, for example, we might have: Function: Average Description: some description Overload #1: parameter-set: paramset-a columns: currency: string value: double scale: integer result-set: result-set-a preference: first-find Overload #2: ... Overload #3: ... My Question Let's say, in the above example, Function is my root object. Function has some attributes and a series of overloads, each with their own attributes and child objects. Is there a library that can help me to print the object graph under a root function, in a well-formatted way? PS: The above example is relatively trivial; in many of our cases, the object hierarchies are 6-10 levels deep, and that's when the real problem comes in.
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34988207
has answer: http://stackoverflow.com/a/59982542
downvote count: 0
has comment: http://stackoverflow.com/comment/34984176
tagged with: logging
type: Question
has comment: http://stackoverflow.com/comment/34987155
tagged with: java
tagged with: object-graph
upvote count: 2
has title: Pretty-print object hierarchy in Java?
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/35036571
type: QuestionComment
has text: Actually, I was planning on looking at the JLS to see if I could figure out the rules and how they apply in this situation. I should have an answer by ... November, if I'm lucky.
score: 0
comment on: http://stackoverflow.com/q/22945870
type: Comment

http://stackoverflow.com/q/22891638
upvote count: 1
type: Question
score: 1
tagged with: java
has title: java.lang.IllegalStateException exception occured in JBoss 7
has comment: http://stackoverflow.com/comment/34935640
downvote count: 0
tagged with: jboss7.x
favorite count: 0
has comment: http://stackoverflow.com/comment/34949335
tagged with: jaas
has body: I developed a simple web application using the following technologies JSF 2.0 , EJB 3, JPA and also JAAS for user login validation. I structured my app in three projects: one is EJB project which contains the business and model, the second one is the view part of the project which is a Dynamic Web Project that includes ManagedBeans and JSF pages. And the last one is an EAR project which unite both projects. Ear project was successfully deployed in JBoss 7 but when I try to access a page I get the following error: 21:04:29,671 ERROR [org.apache.catalina.connector.CoyoteAdapter] (http--127.0.0.1-8080-1) An exception or error occurred in the container during the request processing: java.lang.IllegalStateException at org.jboss.msc.value.InjectedValue.getValue(InjectedValue.java:47) at org.jboss.as.connector.deployers.processors.CachedConnectionManagerSetupProcessor$CachedConnectionManagerSetupAction.setup(CachedConnectionManagerSetupProcessor.java:74) at org.jboss.as.web.ThreadSetupBindingListener.bind(ThreadSetupBindingListener.java:50) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:125) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51] Web.xml <?xml version="1.0" encoding="UTF-8"?> ITSupportView javax…
has comment: http://stackoverflow.com/comment/34937280
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22868429
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22869127
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26938925
answer count: 2
has comment: http://stackoverflow.com/comment/34891071
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/34891162
favorite count: 0
tagged with: rest
upvote count: 6
has comment: http://stackoverflow.com/comment/34891112
has comment: http://stackoverflow.com/comment/34891647
has body: I am trying to working with project to create junit test for the spring rest webservice. This work fine with the get method but it did works with the post json as input. Here is the code with get method. if anyone help with rest post json junit testing it will appreciated. @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(locations=("/spring/application-config.xml")) public class LoginServiceFacadeTestImpl extends AbstractTest { @Autowired private WebApplicationContext wac; private MockMvc mockMvc; @Before public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); } @Test public void testSearchProductByNameFound() throws Exception { String keyword = ""; this.mockMvc.perform(get("/perlogin") .param("q", keyword) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.name").value(keyword)); } } But I am getting the error as follows Time elapsed: 5.477 sec &lt;&lt;&lt; FAILURE! java.lang.AssertionError: Status expected:&lt;200&gt; but was:&lt;404&gt; at org.springframework.test.util.AssertionErrors.fail(AssertionErrors.java:60) at org.springframework.test.util.AssertionErrors.assertEquals(AssertionErrors.java:89) at org.springframework.test.web.servlet.result.StatusResultMatchers$5.match(StatusResultMatchers.java:549) at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:141) at com.db.mybank.backend.services.presentation.impl.test.LoginServiceFacadeTestImpl.testSearchProductByNameFound(LoginServiceFacadeTestImpl.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at o…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34890536
score: 6
tagged with: spring
has title: Spring rest junit post with json

http://stackoverflow.com/q/22850157
tagged with: image
has title: Can i set the width to 100%?
score: 0
has body: I use HTML to show image and text in the TextView. In this case can i set width = 100%? Here is my code: public class ImageGetter implements Html.ImageGetter { @Override public Drawable getDrawable(String source) { Drawable drawable = getResources().getDrawable(R.drawable.cs2); if (source.equals("img1")) { drawable = getResources().getDrawable(R.drawable.img1); drawable.setBounds(0, 0, width, 150); } return drawable; } }
answer count: 1
tagged with: textview
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22850242
tagged with: android-layout

http://stackoverflow.com/comment/34949743
type: Comment
has text: Yes, there is, but why bother?
comment on: http://stackoverflow.com/a/22900740
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34792726
type: QuestionComment
comment on: http://stackoverflow.com/q/22813848
has text: Or if there's code you want to execute conditionally, use a conditional (i.e. an `if` statement)
score: 0
type: Comment

http://stackoverflow.com/comment/34831598
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22834614
type: QuestionComment
has text: I didn't downvote, but I updvoted it right now, as I think, your question is well stated and also contains compilable and runnable code. Trying to answer now ...

http://stackoverflow.com/comment/35460375
score: 0
type: AnswerComment
has text: Ok - I can confirm the answer derived in your question here: http://stackoverflow.com/questions/23141302/possible-to-use-google-modules-with-google-plugin-for-eclipse gets you to a point where you have a development environment in which multiple modules share the same local_db.bin. Thanks!
type: Comment
comment on: http://stackoverflow.com/a/23024113

http://stackoverflow.com/comment/34904678
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22875677
type: Comment
has text: @user3224584: I've edited my answer. If you need further help, consider creating and posting a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).

http://stackoverflow.com/q/22912015
downvote count: 0
score: 6
tagged with: maven
tagged with: gradle
has answer: http://stackoverflow.com/a/22912124
accepted answer: http://stackoverflow.com/a/22912124
type: AnsweredQuestion
tagged with: java
has title: Android/gradle: not able to use repository
type: Question
answer count: 1
upvote count: 6
favorite count: 0
has body: I tried to remove my jar* libraries and add them as maven-repository-dependencies. It looks very promising, but I am not able to do it. I tested it with a single library (gson) and now my gradle.build looks like this: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android' dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile 'com.google.code.gson:gson:2.2.4' } android { compileSdkVersion 18 buildToolsVersion "18.1.0" defaultConfig { minSdkVersion 10 targetSdkVersion 18 } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } instrumentTest.setRoot('tests') debug.setRoot('build-types/debug') release.setRoot('build-types/release') } } But a simple sudo gradle build returns the following error: FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android'. &gt; Failed to notify project evaluation listener. &gt; Could not resolve all dependencies for configuration ':_DebugCompile'. &gt; Could not find com.google.code.gson:gson:2.2.4. Required by: :android:unspecified * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 3.541 secs I am connected to the internet and I am using ubuntu.
tagged with: android

http://stackoverflow.com/comment/35041053
comment on: http://stackoverflow.com/q/22951011
type: Comment
type: QuestionComment
has text: Basically a new hashtable is constructed, using the entries in the old one. There are ways to do it such that the work is distributed over several accesses, or it can all be done at once. The actual rehash is essentially O(n) for your standard hash scheme.
score: 1

http://stackoverflow.com/comment/35009900
comment on: http://stackoverflow.com/q/22933898
score: 0
type: Comment
type: QuestionComment
has text: It would be somewhat less clear-cut - there *can* be situations where it's worth setting fields to null. It's still rare in a good design though.

http://stackoverflow.com/comment/34879951
score: 0
type: AnswerComment
has text: sorry im new to thsi so i went and checked the pastebin link thats why i couldnt find any edit. also yeah it did work , i had allready deffined the variale compras at the begining thats why it wasnt woking , thank you so much for the help :)
type: Comment
comment on: http://stackoverflow.com/a/22858614

http://stackoverflow.com/a/22932568
type: AcceptedAnswer
type: Answer
score: 3
upvote count: 3
has body: You need to tell Wicket to update the export after the change in the dates; so modify the update method in both dates field: @Override protected void onUpdate(AjaxRequestTarget paramAjaxRequestTarget) { endDateValue = endDate.getDate(); exportButtonVisibility(); paramAjaxRequestTarget.add(exportButton); // Add this line }
accepted answer of: http://stackoverflow.com/q/22931377
downvote count: 0
answers question: http://stackoverflow.com/q/22931377

http://stackoverflow.com/a/22853525
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22852074
has comment: http://stackoverflow.com/comment/34869317
score: 1
has body: To get a list of checked checkboxes, you can use: var checkedBoxes = document.querySelectorAll('input:checked'); but IE 8 and lower don't support that, but you can use querySelectorAll with a class (see below). You can then do processing based on the returned NodeList. Given simple function that goes from an element up to a parent with a provided tag name, the rest is easy: // Starting from root, go up to an element with tagName // and return it. Otherwise return undefined function upTo(tagName, root) { if (!root) return; tagName = tagName.toLowerCase(); while ((root = root.parentNode)) { if (root.tagName && root.tagName.toLowerCase() == tagName) { return root; } } } You can then do: function deleteRow(el) { var row = upTo('tr', el); if (row) row.parentNode.removeChild(row); } Some test HTML: Delete row If you want to have a checkbox on each row and then use a single button to delete all the checked ones, you can do something like: function deleteRows() { var flags = document.querySelectorAll('.deleteRowFlag'); for (var i=0, iLen=flags.length; i<iLen; i++) { if (flags[i].checked) { deleteRow(flags[i]); } } } And use it like: foo bar Delete checked rows

http://stackoverflow.com/q/22930254
possible better answer: http://stackoverflow.com/a/22930802
answer count: 3
has answer: http://stackoverflow.com/a/22930428
has answer: http://stackoverflow.com/a/22930802
upvote count: 0
has comment: http://stackoverflow.com/comment/35003228
favorite count: 0
has body: This is my java class public class dateparse { public static void main(String args[]) throws ParseException { Date dd=new Date(); int year = Calendar.getInstance().get(Calendar.YEAR); int month=0; int calc_days=0; String d1 = dd.getDate()+"/"+dd.getMonth()+"/"+year; String d2 = "19/1/2014"; SimpleDateFormat s1 = new SimpleDateFormat("dd/mm/yyyy"); SimpleDateFormat s2 = new SimpleDateFormat("dd/mm/yyyy"); Date dateOne = new SimpleDateFormat("dd/mm/yyyy").parse(d1); Date dateTwo = s2.parse(d2); long diff = dateOne.getTime() - dateTwo.getTime(); calc_days= (int) (diff / 1000 / 60 / 60 / 24 / 1); } } I am trying to find the difference between current date and the date specified with respect to seconds,minutes,hours,days,months and years.Here my input date is 19th Feb 2014.I want to show the difference in no of days(e.g. 10 days) or months+days(e.g.1 month and 2 days) or year+month+days(e.g. 1 year and 2 months and 4 days).But when I run this code it returns difference as -10 days.
accepted answer: http://stackoverflow.com/a/22930428
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/17940200
has comment: http://stackoverflow.com/comment/35003100
tagged with: simpledateformat
has title: Unable to find difference between two dates w.r.t time,seconds,months and years?
score: -1
has answer: http://stackoverflow.com/a/22938898
duplicate of: http://stackoverflow.com/q/17940200

http://stackoverflow.com/q/22935036
tagged with: geo
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/35013754
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22936659
type: Question
tagged with: math
has body: I've found many examples with converting coordinates to pixel for specific picture size. But that is not what I need. I need to convert geo coordinates (latitude and longitude) to screen pixels with defined ratio pixels/degree without binding to picture size. It needed for drawing programmatically few lines on canvas (10-15 kilometers length of each line and 80x80 kilometers whole map). How can I do that?
has answer: http://stackoverflow.com/a/22936659
has comment: http://stackoverflow.com/comment/35011442
answer count: 2
upvote count: 1
has title: How to convert geo coordinates to pixels with fixed ratio?
possible better answer: http://stackoverflow.com/a/23112138
favorite count: 0
tagged with: geometry
has answer: http://stackoverflow.com/a/23112138
has comment: http://stackoverflow.com/comment/35012275

http://stackoverflow.com/comment/34945573
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22898564
has text: but, the new matrix should have the previous value for transposeImage[j][i], isn't it ?
type: AnswerComment

http://stackoverflow.com/a/22876708
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22876596
type: Answer
accepted answer of: http://stackoverflow.com/q/22876596
upvote count: 2
has body: Java does not automatically figure out the encoding of a string. The String(byte[]) constructor constructs a new String by decoding the specified array of bytes using the platform's default charset.` In your case the UTF-16 bytes are being interpreted as UTF-8 and you end up with garbage. Use new String(raw, Charset.forName("UTF-16")) to rebuild the String.

http://stackoverflow.com/q/22959554
type: Question
has answer: http://stackoverflow.com/a/22959789
has title: Null Pointer Exception when switching android activities
has comment: http://stackoverflow.com/comment/35054651
score: 0
tagged with: nullpointerexception
answer count: 2
has body: I am developing a code to run a view pager after a splash screen. I have written the code to connect the 2 activities but I keep getting a nullPointerException when I run my program. 1st activity: package lk.sidadiya.sidadiya; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; public class SplashScreen extends Activity { // Splash screen timer private static int SPLASH_TIME_OUT = 3000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new Handler().postDelayed(new Runnable() { /* * Showing splash screen with a timer. This will be useful when you * want to show case your app logo / company */ @Override public void run() { // This method will be executed once the timer is over // Start your app main activity Intent i = new Intent(SplashScreen.this, WelcomeScreen.class); startActivity(i); // close this activity finish(); } }, SPLASH_TIME_OUT); } } 2nd activity: package lk.sidadiya.sidadiya; import lk.sidadiya.tabswipe.adapter.TabsPagerAdapter; import lk.sidadiya.sidadiya.R; 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; public class WelcomeScreen extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; // Tab titles private String[] tabs = { "Top Rated", "Games", "Movies" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_screen); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setHomeButtonEnabled(false); actionBar.setNavig…
tagged with: splash-screen
tagged with: android-activity
has comment: http://stackoverflow.com/comment/35054686
type: UnansweredQuestion
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/22959643

http://stackoverflow.com/comment/34949151
type: AnswerComment
has text: Ok nevermind sending me the code, I know what the problem is. We are splitting the line using comma, but there appears to be larger values than in the example above that use comma as separator so we can't use that. Change the line String[] elements = p.getData().split(","); to this instead: String[] elements = p.getData().split("$");
comment on: http://stackoverflow.com/a/22899182
type: Comment
score: 0

http://stackoverflow.com/comment/34867212
has text: post your stack trace
type: QuestionComment
comment on: http://stackoverflow.com/q/22855318
type: Comment
score: 0

http://stackoverflow.com/comment/34948793
has text: How many players do you think will be served at a time?
score: 0
comment on: http://stackoverflow.com/q/22900261
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22966452
has comment: http://stackoverflow.com/comment/35067863
has comment: http://stackoverflow.com/comment/35068015
accepted answer of: http://stackoverflow.com/q/22966382
type: Answer
answers question: http://stackoverflow.com/q/22966382
has comment: http://stackoverflow.com/comment/35067887
has comment: http://stackoverflow.com/comment/35068035
upvote count: 9
has body: You're absolutely right. The moment newObject is exposed to other threads as the new value of someObject, those other threads are now using a completely different mutex, and so can be executing the "mutually exclusive" code concurrently. A common solution is to just provide a different mutex and synchronize on that: private final Object someObjectMutex = new Object();
score: 9
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35067485

http://stackoverflow.com/comment/34820601
type: Comment
has text: Yes I think I am using utf-8 encoding. Raj: I try your link to set system encoding but also with no success. Jon: How I can log Unicode values ?
type: QuestionComment
comment on: http://stackoverflow.com/q/22828995
score: 0

http://stackoverflow.com/a/22878198
answers question: http://stackoverflow.com/q/22877860
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34908986
accepted answer of: http://stackoverflow.com/q/22877860
has body: Ok, you can browse complete code at my GitHub account. It is working but I would personally used JPA for persistence. Let start with controller, which contains doPost method. It just takes request parameters, constructs some bean and calls DAO to persist it to database. Once done, it sets a bean as request attribute and dispatches call to jsp. It means that once you open this jsp again, this bean will be not gone. Use session to store it across multiple calls. public class Controller extends HttpServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String phone = request.getParameter("phone"); // todo check parameters User user = new User(name, phone); DAO dao = new DAO(); dao.saveUser(user); request.setAttribute("USER", user);// consider using session // TODO handle errors RequestDispatcher dispatcher = request.getRequestDispatcher("register/index.jsp"); dispatcher.forward(request, response); } } web.xml is easy: RegistrationController cz.literak.sandbox.so.register.Controller RegistrationController /RegistrationController DAO uses old plain JDBC to store the object in database table. I would favour using DataSource instead. static { try { Class.forName("org.mariadb.jdbc.Driver"); // Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } } public User findUser(String phone) { // todo return null; } // DDL: CREATE TABLE user (name VARCHAR(100), phone VARCHAR(100)) public boolean saveUser(User user) throws ServletException { try ( Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "secret"); PreparedStatement ps = con.prepareStatement("INSERT INTO user VALUES(?,?)")) { ps.setString(1, user.getName()); ps.setString(2, user.getPhone()); return ps.execute(); } catch (SQLException e) { throw new ServletException("DB operation failed", e); } } And finally jsp. It …
score: 1
has comment: http://stackoverflow.com/comment/34909950
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34970586

http://stackoverflow.com/comment/34838430
score: 0
type: QuestionComment
type: Comment
has text: you have to search for JTable in JComboBox, but could be possible with standard renderer
comment on: http://stackoverflow.com/q/22839163

http://stackoverflow.com/q/22917135
tagged with: spring
has comment: http://stackoverflow.com/comment/34979075
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34978957
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/34979037
has answer: http://stackoverflow.com/a/22917632
has title: When to use multiple main methods?
type: Question
has answer: http://stackoverflow.com/a/22919890
answer count: 2
has comment: http://stackoverflow.com/comment/34978783
downvote count: 0
has body: I am confused when it is proper to use an application with multiple entry points, or I guess an application with multiple interconnected modules. I have a network application (Netty) as well as a web application (spring). I can bundle them together, in effect tightly coupling them together, or I can modularize them to operate interdependently of each other while still working together to make the application whole. Is there any specific reason for making an application a single entity vs multiple entities? Is it "desired" to have a self contained application (eg. One main method)?
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: netty
has comment: http://stackoverflow.com/comment/34979041

http://stackoverflow.com/q/22959646
favorite count: 0
has answer: http://stackoverflow.com/a/22959781
has answer: http://stackoverflow.com/a/22959879
tagged with: android
has answer: http://stackoverflow.com/a/22960085
answer count: 4
accepted answer: http://stackoverflow.com/a/22959781
possible better answer: http://stackoverflow.com/a/22959879
has comment: http://stackoverflow.com/comment/35054727
upvote count: 1
tagged with: achartengine
tagged with: timestamp
type: AnsweredQuestion
has title: java date and time from timestamp
score: 1
has answer: http://stackoverflow.com/a/22960389
tagged with: java
tagged with: date
has body: I am working on android app with achartengine where I am making a TimeSeries linegraph. I have stored all my variables inside an Arraylist. Since I need correct date object to insert in the time axis of my chart I am using, int count = list.size(); Date[] dt = new Date[count]; for(int i=0;i&lt;count;i++){ long a = Long.parseLong(list.get(i).get("time")); dt[i] = new Date(a); } Here long a has the timestamp . With above piece of code. I am able to get dt as 09-Apr-2014 but I need the date to be shown as 09-Apr 12:55 . How can I do that, I tried using the folllowing SimpleDateFormat sdfDate = new SimpleDateFormat("MM-dd HH:mm"); Date now = new Date(); String strDate = sdfDate.format(now); But Since strDate is a string I cannot use it as dt[i] = strDate which will throws an error as one is Date and another is String. How can I solve this ? Thanks
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/35054918

http://stackoverflow.com/q/22840322
tagged with: hash
tagged with: keystore
has answer: http://stackoverflow.com/a/75224386
upvote count: 6
answer count: 4
has answer: http://stackoverflow.com/a/32586331
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/66946759
tagged with: java
score: 6
tagged with: sha
type: Question
has body: I am interested in applying a SHA-1 hash with RSA signature to some data, but I need to do it in two steps - apply hash first and then sign the data. The Signature.sign() function appears to create a more complex (ASN.1?) data structure that is ultimately signed (see this question). How can I make the two equivalent without using any external libraries like BouncyCastle? Apply hash and sign in single step with Signature: PrivateKey privatekey = (PrivateKey) keyStore.getKey(alias, null); ... sig = Signature.getInstance("SHA1withRSA", "SunMSCAPI"); sig.initSign(privatekey); sig.update(data_to_sign); byte[] bSignedData_CAPISHA1_CAPIRSA = sig.sign(); Apply hash via MessageDigest, then sign with Signature: PrivateKey privatekey = (PrivateKey) keyStore.getKey(alias, null); ... MessageDigest sha1 = MessageDigest.getInstance("SHA-1"); byte[] data_to_sign = sha1.digest(bdataToSign); Signature sig = Signature.getInstance("NONEwithRSA", "SunMSCAPI"); sig.initSign(privatekey); sig.update(data_to_sign); byte[] bSignedData_JAVASHA1_CAPIRSA = sig.sign(); ... I am looking for the following equivalency: bSignedData_JAVASHA1_CAPIRSA == bSignedData_CAPISHA1_CAPIRSA My ultimate goal is to create the hash and then sign with a PKCS11 token, but I require the signed data to be the same format as legacy data for verification purposes.
accepted answer: http://stackoverflow.com/a/22867916
tagged with: rsa
has title: How to make "MessageDigest SHA-1 and Signature NONEwithRSA" equivalent to "Signature SHA1withRSA "
has answer: http://stackoverflow.com/a/22867916
downvote count: 0
linked to: http://stackoverflow.com/q/521101
favorite count: 0
possible better answer: http://stackoverflow.com/a/32586331

http://stackoverflow.com/comment/34937280
score: 0
type: QuestionComment
type: Comment
has text: @MironBalcerzak thanks for your quick reply. I just added the full log and noticed another error arises when ear file is replaced. Also another issue that i've found was the web content from my war file was not deployed, so I moved all this content in my webapp folder and after a second deploy these files were successfully deployed as well.
comment on: http://stackoverflow.com/q/22891638

http://stackoverflow.com/a/22922341
type: Answer
has body: You could test the condition in the for loop using the ternary operator and only change the counter variable when the condition is true. This means that you would need to move the condition variable outside the loop. But you could write something like this for( int i = 0; i &lt; r; cond ? i++ : i ) { .... }
score: 0
answers question: http://stackoverflow.com/q/22921877

http://stackoverflow.com/comment/34991270
has text: Anyhow, as I said in my previous comment, your answer is also valid, as soon as it returns the instance managed, the work is done.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22855526

http://stackoverflow.com/comment/34926245
type: Comment
type: QuestionComment
has text: Yes, that's right, if a component higher in the z-order has a MouseListenr, mouse events won't be propagated to components below it, this is how it works. Have you consider adding a mouse listener to the view ports view instead?
comment on: http://stackoverflow.com/q/22887819
score: 0

http://stackoverflow.com/q/22811767
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22814940
type: Question
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/22814940
score: 0
tagged with: http://stackoverflow.com/tag/csv
has title: Writing array to csv java, with app running on multiple processors
has comment: http://stackoverflow.com/comment/34788584
tagged with: printwriter
has body: I have five arrays of (x,y) positions for five different particles. The arrays have the form: double [][] ProtonTracking = new double[1000][2]; (x,y) coordinates are stored in columns vertically like: ProtonTracking = (x1,y1) (x2,y2) (x3,y3) etc I am trying to write these (x,y) coordinates to a .csv file in order to plot them. I have tried to use PrintWriter to do this but I'm not sure how to use it. As an extra complication this code has been created to run on multiple processors and so I am confused as to where to create the file and where to close it. Each processor generates and simulates an individual particle and then would ideally write this data to .csv. Is it possible for multiple threads to write to a .csv file at the same time? Could anyone point me in the right direction?

http://stackoverflow.com/comment/34852422
score: 0
comment on: http://stackoverflow.com/q/22846970
type: Comment
has text: Why do you need to compare the class files? Different compiler settings (e.g., optimization levels, debug info, etc.) can change the .class file, making matching difficult... what specifically are you trying to archive by comparing the class files?
type: QuestionComment

connection
tags question: http://stackoverflow.com/q/22896896
type: Tag
tag name: connection
tags question: http://stackoverflow.com/q/22835494
tags question: http://stackoverflow.com/q/22935541

http://stackoverflow.com/comment/35005840
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22931743
has text: write it as an ans & i'll accept it.

http://stackoverflow.com/a/22898959
accepted answer of: http://stackoverflow.com/q/22898756
type: AcceptedAnswer
downvote count: 0
has body: From the changes you experience, it sounds like you are using frame as a unit of time measurement. Or, more precisely, you use pixel/frame(or something like that) for velocity and second for time. This might be OK for a simple game like yours, ones that are light enough on the system resources so that the delay between frames you specify in the code is practically the same as the real delay, meaning you are in complete control over the FPS. When the game get heavier and modern systems can no longer guarantee that property, you have a problem. The solution is usually not to separate the game and display loops to separate threads, but to not use frames as unit of measurement for game mechanics calculations. Instead, each frame measure the time from the previous frame and use that value for the calculations, eg. multiply it by the speed to know how much to move a game object in this frame. Not that separating those loops is such a bad idea. You don't get concurrency problems "all over the place", since the interaction between the game logic and the display shouldn't be "all over the place". The interaction should be one-way: the game loop writes data and the display loop reads it. That means you shouldn't have race conditions, but you can still get other multithreading hazards, which you can solve with volatile variables.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22898756

http://stackoverflow.com/comment/34983201
type: Comment
type: QuestionComment
has text: You are right. I edited the question and elaborated. Thanks.
score: 0
comment on: http://stackoverflow.com/q/22919496

http://stackoverflow.com/q/22922922
tagged with: jakarta-ee
tagged with: heroku
has answer: http://stackoverflow.com/a/22926388
has title: Raspberry PI measure POST request with JMeter
score: 0
tagged with: raspberry-pi
has body: I have simple Java EE application for measure by JMeter. Application run on heroku. I write name and surname into textbox on JSP. These are send on server by POST request. Server saves person and return same page with update list of persons. This is functionality which I measure in JMeter. This is result graph: I know why Average grows. Because list of person is bigger with each next request. So sending data to client are bigger with each next request and responses are slowly. But why average grows until from approximately half of graph? List yet gain from start testing. I measure on Raspberry PI. On desktop average grows from the start.
answer count: 1
tagged with: jmeter
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/34895504
type: QuestionComment
has text: What's the content of your key?
comment on: http://stackoverflow.com/q/22870655
score: 0
type: Comment

http://stackoverflow.com/a/22851883
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22851439
has body: the reason why header repeating is because you do not reinitialize variable(beginRow and divider) when you call printTable Method, variable String beginRow = " * |"; String divider = "-------"; is redefined you need to reintialize variable(beginRow, divider) look fllowing code which i modified private void printTableHeader() { for(int i = 1; i &lt; column + 1; i++) { beginRow+=" "+i; divider+="-----"; } System.out.println(beginRow); System.out.println(divider); beginRow = " * |"; divider = "-------"; }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22851439

http://stackoverflow.com/q/22889942
type: UnansweredQuestion
has body: I have a CSV file like Data Dun&amp;BradStreet Dunkin &amp; Donut Here Data is the 'header' of the column. I am using the encoding and replacement as String encodedUrl = URLEncoder.encode(data[i], "UTF-8"); String data = encodedUrl.replaceAll("%2B","+"); Desired Result Data Dun&amp;BradStreet Dunkin+%26+Donut Output Data Dun%26BradStreet Dunkin+%26+Donut How to keep '&amp;' if there are no spaces when '&amp;' is present? Any help is appreciated. Thanks in advance.
upvote count: 1
has comment: http://stackoverflow.com/comment/34930278
has answer: http://stackoverflow.com/a/22894156
score: 1
tagged with: java
has title: How to replace a particular string in java?
type: Question
answer count: 2
tagged with: regex-lookarounds
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22890014
tagged with: regex
has comment: http://stackoverflow.com/comment/34930307
has comment: http://stackoverflow.com/comment/34930084

http://stackoverflow.com/comment/34905784
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22876378
has text: I admit your solution is better than mine. +1

http://stackoverflow.com/comment/35677580
type: AnswerComment
comment on: http://stackoverflow.com/a/22824636
score: 0
type: Comment
has text: Or, instead of `p -> p.getName()`, you could use a method reference `Person::getName`. It might be a bit more readable.

http://stackoverflow.com/q/22918830
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22922277
has answer: http://stackoverflow.com/a/23112835
has comment: http://stackoverflow.com/comment/34983625
type: Question
has comment: http://stackoverflow.com/comment/39090670
tagged with: java
tagged with: abap
has comment: http://stackoverflow.com/comment/34981938
has comment: http://stackoverflow.com/comment/34986014
has comment: http://stackoverflow.com/comment/35080599
score: 0
answer count: 2
tagged with: ide
has body: First post here so excuse any mistakes. A little background: I work in a company that uses SAP for daily work, I use it for daily work. I have some programming skills, I know some C, Java an VBA. What I need: I want to make a program that interacts with SAP in order to automate some of the tasks that me and the ppl on my department do. I can't use the SAP macro tool because I need info from outside SAP, like e-mail and excel. Its of no use to ask for help from the SAP admins and developers on the company because it is a massively huge company and i doubt that i will get any attention. I need to know with which program, net beans, code block and that kind of stuff, i can begin because its impossible to get the ABAP workbench, and in which language. I can learn any programming language that is needed, i just need some guidance. I know that there is a SAP plugin for eclipse that allows java development but that is also paid. I need an open, free solution here. I can't get nor i need development access on SAP, all i want to do is a program that will automate several actions and roles, like a macro, but that can interact with other programs like Excel and e-mail. Thanks in advance, and ask away if i did not made my self clear
has title: SAP programming without ABAP Workbench

http://stackoverflow.com/comment/34944250
has text: You need to *parse* that string to extract the data.
type: QuestionComment
comment on: http://stackoverflow.com/q/22897903
score: 0
type: Comment

http://stackoverflow.com/a/22948791
accepted answer of: http://stackoverflow.com/q/22948737
has comment: http://stackoverflow.com/comment/35037281
has comment: http://stackoverflow.com/comment/35037183
answers question: http://stackoverflow.com/q/22948737
has body: Either titu_anun is null or titu_anun.getText() returns null. Use the debugger or some log messages to figure out which one is null. Edit: See ZouZou's comment on your question for the quick answer.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35037160
type: Answer

http://stackoverflow.com/comment/34932108
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22868788
type: AnswerComment
has text: it is working after using startActivity. Thanks a lot :)

http://stackoverflow.com/a/22865083
has comment: http://stackoverflow.com/comment/34932174
downvote count: 0
type: Answer
has body: According to the documentation the Member category field controls the type of the activity member. To create a Member group you should leave the contributor email empty, the contributor name should be the group name and the userid should be mapped to the group id My test env has no groups so I can't confirm with groups directly, but setting as category "community" and userid a community Uuid I managed to add a community as a member to an activity. Caveat Emptor: When I tried to retrieve the single member from connections using the community member id I got instead the full list of activity members. That also happens when using the REST API by itself with the Location URL returned with the 201 Created result, so it's something happening from the connections side. But as long as creation is concerned, this should be possible.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22851337
has comment: http://stackoverflow.com/comment/35239271

http://stackoverflow.com/comment/34943036
comment on: http://stackoverflow.com/a/22896459
has text: Hi, Thanks for your post. I followed the following steps. >open eclipse >go to help >Eclipse Market Place> search for m2Eclipse >select the product maven integrated with eclipse JUNO After installation I was able to see the Maven option in Windows --> Preferences
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22906263
answers question: http://stackoverflow.com/q/22906028
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35043277
type: Answer
has body: The error message means that Java can't find the class in question. Make sure it's on the classpath of your web app. That said, you may run into problems later: Linux web servers often don't have an attached display so no X server is running. That will make it hard to start a browser :-) If that's the case for you, look up Google for "selenium xvnc" or "selenium headless"
has comment: http://stackoverflow.com/comment/35048512
accepted answer of: http://stackoverflow.com/q/22906028
score: 0

http://stackoverflow.com/comment/35022931
has text: You do not have Jersey's dependency in your `pom.xml`, which depends on exactly what you want to do (on how you run the JAX-RS application). Simply check the examples from GitHub (there is also the entire source code of Jersey 2.X):https://github.com/jersey/jersey/tree/master/examples/
comment on: http://stackoverflow.com/q/22941330
score: 0
type: Comment
type: QuestionComment

exception
tags question: http://stackoverflow.com/q/22959427
tags question: http://stackoverflow.com/q/22927532
tags question: http://stackoverflow.com/q/22962792
tags question: http://stackoverflow.com/q/22879684
tags question: http://stackoverflow.com/q/22920943
tags question: http://stackoverflow.com/q/22892760
tags question: http://stackoverflow.com/q/22892461
tags question: http://stackoverflow.com/q/22880901
tags question: http://stackoverflow.com/q/22913119
tags question: http://stackoverflow.com/q/22870364
tags question: http://stackoverflow.com/q/22816422
tags question: http://stackoverflow.com/q/22860865
tags question: http://stackoverflow.com/q/22898906
tags question: http://stackoverflow.com/q/22894809
tags question: http://stackoverflow.com/q/22896308
tags question: http://stackoverflow.com/q/22941415
tags question: http://stackoverflow.com/q/22967263
tags question: http://stackoverflow.com/q/22927392
tags question: http://stackoverflow.com/q/22908072
type: Tag
tags question: http://stackoverflow.com/q/22862117
tags question: http://stackoverflow.com/q/22944978
tags question: http://stackoverflow.com/q/22866136
tags question: http://stackoverflow.com/q/22946232
tags question: http://stackoverflow.com/q/22891574
tags question: http://stackoverflow.com/q/22913316
tags question: http://stackoverflow.com/q/22964985
tags question: http://stackoverflow.com/q/22861931
tags question: http://stackoverflow.com/q/22933080
tags question: http://stackoverflow.com/q/22958624
tags question: http://stackoverflow.com/q/22961140
tags question: http://stackoverflow.com/q/22831641
tags question: http://stackoverflow.com/q/22831322
tags question: http://stackoverflow.com/q/22863893
tags question: http://stackoverflow.com/q/22852425
tags question: http://stackoverflow.com/q/22954815
tags question: http://stackoverflow.com/q/22914565
tags question: http://stackoverflow.com/q/22926420
tags question: http://stackoverflow.com/q/22899876
tags question: http://stackoverflow.com/q/22950442
tags question: http://stackoverflow.com/q/22817852
tags question: http://stackoverflow.com/q/22861107
tags question: http://stackoverflow.com/q/22931394
tags question: http://stackoverflow.com/q/22838951
tags question: http://stackoverflow.com/q/22893136
tags question: http://stackoverflow.com/q/22832640
tags question: http://stackoverflow.com/q/22815199
tags question: http://stackoverflow.com/q/22812742
tags question: http://stackoverflow.com/q/22828881
tag name: exception
tags question: http://stackoverflow.com/q/22914895
tags question: http://stackoverflow.com/q/22857120
tags question: http://stackoverflow.com/q/22951606
tags question: http://stackoverflow.com/q/22831895
tags question: http://stackoverflow.com/q/22826408
tags question: http://stackoverflow.com/q/22952963
tags question: http://stackoverflow.com/q/22902663
tags question: http://stackoverflow.com/q/22920383
tags question: http://stackoverflow.com/q/22945673
tags question: http://stackoverflow.com/q/22866179

http://stackoverflow.com/comment/34819919
type: QuestionComment
comment on: http://stackoverflow.com/q/22828941
has text: Is there a quick way to get super instance without **new**? No. You might want to add a copy-constructor in the `Base`.
score: 0
type: Comment

http://stackoverflow.com/comment/35003702
has text: The way I've implemented, none really, but what you could do is instead of using a `List` of `Point`s, is literally just keep using `lineTo` in the `GeneralPath` each time the player is moved. It will depend in you want to know how many points there are and how much access you want to them...
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22928302
type: Comment

http://stackoverflow.com/comment/34958867
comment on: http://stackoverflow.com/a/22903912
type: Comment
has text: @seema just for checking try to remove it once. of change it to if(i==0) so it will execute once so atleast u will have idea. :)
score: 0
type: AnswerComment

http://stackoverflow.com/q/22944511
type: Question
has answer: http://stackoverflow.com/a/22944642
downvote count: 0
has answer: http://stackoverflow.com/a/22944702
favorite count: 0
has comment: http://stackoverflow.com/comment/35028471
tagged with: arraylist
tagged with: file-io
has body: I have try many things, and I am so stuck in this problem. I have to read from a text file, and throw it inside an arraylist in a private method. And then make a new method that will print the arraylist out. This is what I have tried so far. I get this error: fileHandling.java:11: readArray(java.util.ArrayList&lt;java.lang.String&gt;) in fileHandling cannot be applied to () readArray(); ^ 1 error My code: import java.util.Scanner; import java.io.*; import java.util.*; public class fileHandling { private ArrayList&lt;String&gt; Person; public static void main(String[] args)throws Exception { readArray(); } private ArrayList readFile() throws Exception { File file = new File("person.rtf"); Scanner scanner = new Scanner(file); while(scanner.hasNextLine()) { String str = scanner.nextLine(); Person.add(str); } return Person; } public void readArray(ArrayList&lt;String&gt; Person) { for(int i =0; i &lt; Person.size(); i++) { System.out.println(Person.get(i)); } } } I think the error is when I called my method, what is going inside the brackets?
answer count: 4
has comment: http://stackoverflow.com/comment/35028461
has answer: http://stackoverflow.com/a/22944692
possible better answer: http://stackoverflow.com/a/22944642
upvote count: 1
has answer: http://stackoverflow.com/a/22944619
accepted answer: http://stackoverflow.com/a/22944619
has title: Read from text file, and return into arraylist in private method
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/22832192
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22832396
tagged with: happens-before
has comment: http://stackoverflow.com/comment/34831245
type: Question
has answer: http://stackoverflow.com/a/22832396
has body: I would like to establish a simple "protocol" between two threads of using an arbitrary object, not specifically geared towards multi-threading, in a thread-safe manner. The protocol shall be that only ever one of the threads owns the object and only the owner may read/write the object. I read the information about happens-before here, but are not quite sure whether the discussion relates only to individual fields or to whole objects. Are the following two solutions correct for the "ownership protocol"? 1) Use of a BlockingQueue such that the object is passed over to the other thread through the queue. 2) The "arbitray object" is not so arbitrary anymore in that I introduce a volatile boolean ownedByThreadA; with ownedByThreadA being true initially and Thread A is using the object. When done, Thread A writes false into ownedByThreadA. Thread B polls the variable similar to this while (data.ownedByThreadA) { doOtherThings(); } dealWith(data); I am rather sure that (1) is a correct solution. I am not so sure for for (2). In particular for (2) I wonder if just one volatile suffices for a correct solution, given the "user protocol" is obeyed.
answer count: 2
has comment: http://stackoverflow.com/comment/34829690
upvote count: 1
has comment: http://stackoverflow.com/comment/34833732
favorite count: 0
has comment: http://stackoverflow.com/comment/34827677
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34825622
has answer: http://stackoverflow.com/a/22837269
has title: Java happens-before clarification and how to safely pass an object back and forth between two threads
accepted answer: http://stackoverflow.com/a/22837269
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/34844687
type: QuestionComment
has text: @Dyna you can mark that as answer it appears to have worked.
comment on: http://stackoverflow.com/q/22842833
score: 0
type: Comment

http://stackoverflow.com/comment/34989787
comment on: http://stackoverflow.com/q/22921485
score: 0
has text: @Luser_k Yes, I am absolutely sure. I have logged things out.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22947858
answers question: http://stackoverflow.com/q/22947561
has body: If you have a string stringA containing your part number, you can use matches on it like this: stringB.matches(".*" + Pattern.quote(stringA) + ".*"); The reason for Pattern.quote is that certain characters are special characters in a regular expression, and Pattern.quote adds extra commands to the regex to make sure those characters are not treated as special. Letters and digits aren't special, though, so if you know that stringA contains only letters and digits, you can skip Pattern.quote: stringB.matches(".*" + stringA + ".*"); If you have multiple strings that you want to check against, you could loop do the above match one part number at a time. Or you can join them all together like this: stringB.matches(".*(3H0875AA|3J1127XQ|4X0078BA).*"); which will check for any of those part numbers. If you have an array of those strings, you can do this in Java 8: String[] partNumbers; stringB.matches(".*(" + String.join("|", partNumbers) + ").*"); if all the part numbers contain only letters and digits. Or you can use a stream to use Pattern.quote and join everything together with |: stringB.matches(".*(" + Arrays.stream(partNumbers).map(Pattern::quote).collect(Collectors.joining("|")) + ").*"); Or in Java 7 you can construct a string using StringBuilder and using a loop to append all the part numbers with Pattern.quote and insert | between the parts.
type: Answer
score: 0

http://stackoverflow.com/a/22875979
has comment: http://stackoverflow.com/comment/34935275
has comment: http://stackoverflow.com/comment/35011867
accepted answer of: http://stackoverflow.com/q/22863842
answers question: http://stackoverflow.com/q/22863842
has comment: http://stackoverflow.com/comment/34909038
has comment: http://stackoverflow.com/comment/35093951
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34909196
has comment: http://stackoverflow.com/comment/34967272
has comment: http://stackoverflow.com/comment/35010251
type: Answer
has comment: http://stackoverflow.com/comment/34935849
has comment: http://stackoverflow.com/comment/34932590
has comment: http://stackoverflow.com/comment/34932548
has comment: http://stackoverflow.com/comment/34909030
has comment: http://stackoverflow.com/comment/35010474
has comment: http://stackoverflow.com/comment/34909044
score: 1
has comment: http://stackoverflow.com/comment/35011885
has comment: http://stackoverflow.com/comment/35011957
upvote count: 1
has comment: http://stackoverflow.com/comment/35011906
has comment: http://stackoverflow.com/comment/34935414
has comment: http://stackoverflow.com/comment/34935624
has comment: http://stackoverflow.com/comment/34997801
has body: I had played with this project a little after your previous questions. I'm sure this isn't the most optimized way to do this, but without knowing how you plan to implement the game logic, I think this is flexible enough to adapt. The following is your custom View class, which I've renamed Board, in keeping with Java naming conventions. public class Board extends View { Paint pBack = new Paint(); Paint pDot = new Paint(); Paint pLine = new Paint(); int cols = 5; int rows = 6; // Default initialization = false boolean[][] dots = new boolean[cols][rows]; int canWidth = 0; int canHeight = 0; float xStep = 0; float yStep = 0; float[] xCoords = new float[cols]; float[] yCoords = new float[rows]; public Board(Context context) { super(context); pBack.setARGB(255, 255, 102, 0); pDot.setARGB(255, 255, 255, 255); pLine.setStrokeWidth(5); pLine.setARGB(255, 90, 10, 0); } public void setDots(boolean[][] dotSelected) { this.dots = dotSelected; } public boolean[][] getDots() { return dots; } protected void onSizeChanged(int w, int h, int oldw, int oldh) { canWidth = w; canHeight = h; xStep = canWidth / (cols + 1); yStep = canHeight / (rows + 1); for (int y = 0; y &lt; rows; y++) { yCoords[y] = (y + 1) * yStep; } for (int x = 0; x &lt; cols; x++) { xCoords[x] = (x + 1) * xStep; } } protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawPaint(pBack); // Grid, lines and box markings for (int y = 0; y &lt; rows; y++) { canvas.drawLine(xStep, yCoords[y], cols * xStep, yCoords[y], pDot); for (int x = 0; x &lt; cols; x++) { if (y == 0) { canvas.drawLine(xCoords[x], yStep, xCoords[x], rows * yStep, pDot); } if (dots[x][y]) { boolean left = x &gt; 0 &amp;&amp; dots[x - 1][y]; boolean up = y &gt; 0 &amp;&amp; dots[x][y - 1]; if (left) { canvas.drawLine(xCoords[x], yCoords[y], xCoords[x - 1], yCoords[y], pLine); } if (up) { canvas.drawLine(xCoords[x], yCoords[y], xCoords[x], yCoords[y - 1], pLine); } if (left &amp;&amp; up &amp;&amp; dots[x - 1][y - 1]) { canvas.drawCircle(x…

http://stackoverflow.com/comment/34994973
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22925241
has text: @GameKyuubi Could you solve the problem using your method? I added my code on the post, hashmap is all I can think of :(

http://stackoverflow.com/comment/34932839
score: 0
comment on: http://stackoverflow.com/q/22891421
type: Comment
type: QuestionComment
has text: In that case how should I do to return to my previous class?

http://stackoverflow.com/comment/34867910
type: Comment
type: QuestionComment
has text: Don't copy a piece of code that you don't understand.
comment on: http://stackoverflow.com/q/22855749
score: 0

http://stackoverflow.com/comment/34928616
type: Comment
comment on: http://stackoverflow.com/a/22889216
has text: sorry, that confused me, I use notepad++, I'm new to java
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34862135
comment on: http://stackoverflow.com/a/22852281
type: Comment
score: 0
type: AnswerComment
has text: So the "private static String getInput()" is its own Method i think i said that right?

http://stackoverflow.com/comment/34834113
type: Comment
comment on: http://stackoverflow.com/a/22835592
has text: [not fishy, nice bug](http://stackoverflow.com/questions/22741215/how-to-use-key-bindings-instead-of-key-listeners) binarry difference between api and returns from print_out
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34883364
has text: @OlegEstekhin I often recommend "US-ASCII" in these situations, since people anticipate a one-to-one correspondence between the number of characters in their password and the number of bytes in their key. Anyway, the biggest crime here is deriving a password from raw string bytes and not using a more secure method.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22864105

http://stackoverflow.com/a/22879467
has body: Define the flow of you pages and destroy the session if the user does not follow the flow.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22879367

http://stackoverflow.com/q/22956559
has answer: http://stackoverflow.com/a/65842177
score: 0
has answer: http://stackoverflow.com/a/40943008
has answer: http://stackoverflow.com/a/22956679
tagged with: applet
has title: Start: Applet is not initialized
favorite count: 0
has body: I am beginner to Applets. Here is code for a basic applet to display string. package firstjavaapplet; import java.awt.Graphics; // program uses class Graphics import javax.swing.JApplet; // program uses class JApplet public class FirstJavaApplet extends JApplet { // draw text on applet’s background @Override public void paint( Graphics g ) { // call superclass version of method paint super.paint( g ); // draw a String at x-coordinate 25 and y-coordinate 25 g.drawString( "Welcome to Java Programming!", 25, 25 ); } // end method paint public static void main(String[] args) { FirstJavaApplet obj = new FirstJavaApplet(); } } Following is HTML file I am using to include applet in webpage. &lt;body&gt; &lt;applet code = "FirstJaveApplet.class" width = "300" height = "300"&gt; &lt;/applet&gt; &lt;/body&gt; &lt;/html&gt; When I run Applet in appletviewer FirstJaveApplet.html , I get following: String is not being displayed rather "Start: applet is not initialized."
has answer: http://stackoverflow.com/a/43276740
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40340215
has answer: http://stackoverflow.com/a/33855127
has comment: http://stackoverflow.com/comment/35050535
tagged with: java
has answer: http://stackoverflow.com/a/32937548
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/73283582
type: Question
tagged with: debugging
has answer: http://stackoverflow.com/a/22980364
has answer: http://stackoverflow.com/a/69378928
has answer: http://stackoverflow.com/a/22956860
has answer: http://stackoverflow.com/a/45964260
answer count: 13
has answer: http://stackoverflow.com/a/37258586

http://stackoverflow.com/a/53263206
answers question: http://stackoverflow.com/q/22935500
type: Answer
score: 0
has body: Even it matters which bit jar you have linked for SWT jar library support, recommended one is to have OS, JVM and Jar all three for 64 or 32 bit aligned all same OS bit version.

http://stackoverflow.com/comment/35016920
has text: Your example uses `"Sec"`, not `"sec"`. `String.replace()` is a case-sensitive method.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22938097

http://stackoverflow.com/comment/66995623
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22936215
has text: he did not asked even a single space, why are you adding single space. It should be str.replaceAll("[^a-zA-Z]+", "")

http://stackoverflow.com/q/22886591
has comment: http://stackoverflow.com/comment/34924169
score: 1
tagged with: java
has body: //Class PrintTask sleeps between0-5 seconds import java.util.Random; public class PrintTask implements Runnable{ private final int sleeptime; private final String taskname; private final static Random generator= new Random(); public PrintTask(String name) { taskname=name; sleeptime=generator.nextInt(5000); } public void run() { try { System.out.printf("%s going to sleep for %d ms.\n", taskname,sleeptime); Thread.sleep(sleeptime); } catch(InterruptedException exception) { System.out.printf("%s %s\n", taskname,"terminated prematurely due to interruption"); } System.out.printf("%s done sleeping\n",taskname); } } //Creation and start of three threads import java.lang.Thread; public class Threads { public static void main(String[] args) { System.err.println("Creating threads"); Thread thread1=new Thread(new PrintTask("task1")); Thread thread2=new Thread(new PrintTask("task2")); Thread thread3=new Thread(new PrintTask("task3")); thread1.start(); thread2.start(); thread3.start(); System.err.println("Tasks Started. Main Ends. \n"); } } Some Results task2 going to sleep for 320 ms. task1 going to sleep for 3054 ms. task3 going to sleep for 1821 ms. task2 done sleeping task3 done sleeping task1 done sleeping task2 going to sleep for 1338 ms. task3 going to sleep for 2825 ms. task1 going to sleep for 3461 ms. task2 done sleeping task3 done sleeping task1 done sleeping My question is why does the message "task" going to sleep for ** ms, is not appearing in the correct order like this: (sometimes it might appear in the "correct" order) task1 going to sleep for **** ms. task2 going to sleep for **** ms. task3 going to sleep for **** ms. but it seems to be appearing in a random order. I am new to threading so please answer me as simple as you can. Thank you!
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22886718
possible better answer: http://stackoverflow.com/a/22886980
has comment: http://stackoverflow.com/comment/34924287
has answer: http://stackoverflow.com/a/22886980
has comment: http://stackoverflow.com/comment/34924151
has comment: http://stackoverflow.com/comment/34924215
has answer: http://stackoverflow.com/a/22886718
has title: Java Threads New thread order
upvote count: 1
favorite count: 0
tagged with: multithreading
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/22920343
tagged with: file-io
accepted answer: http://stackoverflow.com/a/22920511
tagged with: netbeans
has comment: http://stackoverflow.com/comment/34985154
has comment: http://stackoverflow.com/comment/34986076
has comment: http://stackoverflow.com/comment/34985058
has comment: http://stackoverflow.com/comment/34985019
score: 0
tagged with: file
type: Question
type: AnsweredQuestion
tagged with: java
has title: How to read in txt file outside of project folder with Java Netbeans
answer count: 1
has answer: http://stackoverflow.com/a/22920511
has body: I want to read in/access a txt file outside of my main project folder in Netbeans. For example, Project Folder -&gt;src -&gt;bin Txt File My project folder and txt file are on the same level(in the same folder). The project is located in Documents/ComputerPrograms/489/ProjectName The txt file is located in Documents/ComputerPrograms/489/txtFile.txt Usually I would use ./txtfile.txt if the txt file was located within the Project Folder. Also, I want to do this using a relative path not an absolute path.

http://stackoverflow.com/q/22949979
answer count: 2
has title: How to close JFrame after user inactivity?
downvote count: 0
has body: How would I go about closing a JFrame after user inactivity? So far I have, Thread.sleep(10000); I would greatly appreciate it if someone could give me code to do this? I am new to Java and want to know more about system security
has comment: http://stackoverflow.com/comment/35038400
tagged with: user-inactivity
tagged with: thread-sleep
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35038468
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22950080
upvote count: 1
has comment: http://stackoverflow.com/comment/35038430
tagged with: swing
has answer: http://stackoverflow.com/a/22950410
tagged with: java
has comment: http://stackoverflow.com/comment/35038936
has comment: http://stackoverflow.com/comment/35038794
type: Question

http://stackoverflow.com/q/22928450
has comment: http://stackoverflow.com/comment/35000673
has body: I've looked through a few previous questions regarding this but haven't been able to get an answer that fixed my question. I'm creating a simple program and my button is throwing a null pointer exception. At first I thought this was the xml file, eclipse is adding in a @+id/anything anytime I modify fields (not in the id section), but when I fixed those errors it still does it. Any idea what it might be, I've attached the code and xml file. Thanks for the help. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } Button submit = (Button) findViewById(R.id.button1); } XML file &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.myproc.MainActivity$PlaceholderFragment" &gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="134dp" android:text="Button" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="93dp" android:text="Enter a number" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textView1" android:layout_centerHorizontal="true" android:layout_marginTop="16dp" …
has title: Android Development - Button throwing Null Pointer Exception
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/22928491
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34999858
type: Question
has comment: http://stackoverflow.com/comment/34999843
has comment: http://stackoverflow.com/comment/35000621
has comment: http://stackoverflow.com/comment/34999855
has answer: http://stackoverflow.com/a/22928491
has comment: http://stackoverflow.com/comment/35000002
answer count: 1

http://stackoverflow.com/a/22893421
has comment: http://stackoverflow.com/comment/34937895
has comment: http://stackoverflow.com/comment/34937036
has comment: http://stackoverflow.com/comment/34936339
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22893381
has comment: http://stackoverflow.com/comment/34936124
has comment: http://stackoverflow.com/comment/34937249
has comment: http://stackoverflow.com/comment/34940859
has comment: http://stackoverflow.com/comment/34938503
has body: To the contrary, Collections.synchronizedCollection() is generally not sufficient because many operations (like iterating, check then add, etc.) need additional, explicit synchronization. If every access to the collection is already done through properly synchronized methods, then wrapping the collection again into a syncronized proxy is useless.
type: Answer
has comment: http://stackoverflow.com/comment/34936461
answers question: http://stackoverflow.com/q/22893381
upvote count: 3
has comment: http://stackoverflow.com/comment/34938115
has comment: http://stackoverflow.com/comment/34936168
score: 3

http://stackoverflow.com/comment/35059562
has text: Welcome to SO. Please see - http://stackoverflow.com/help/how-to-ask
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22961938
type: Comment

http://stackoverflow.com/comment/34960687
score: 2
has text: Wow, a question with 0 upvotes and 7 answers with 0 upvotes.. gotta be some sort of record!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22906907

http://stackoverflow.com/comment/35149263
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22899297
type: Comment
has text: @UserFuser Oh... I thought I could do that for comments too.... Thanks a lot then! I accepted it :D

http://stackoverflow.com/comment/34837521
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22839182
has text: What will this change?
type: AnswerComment

http://stackoverflow.com/q/22917585
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35004278
has comment: http://stackoverflow.com/comment/35004591
type: Question
has comment: http://stackoverflow.com/comment/35006302
has comment: http://stackoverflow.com/comment/34979904
has comment: http://stackoverflow.com/comment/35003873
has comment: http://stackoverflow.com/comment/35002746
tagged with: java
has comment: http://stackoverflow.com/comment/35002639
has body: I would like to mock the make a JUnit test of the following method toXml: void toXml(Object obj){ ByteArrayOutputStream out = null; try{ JAXBContext ctx = getContext(obj.getClass()); Marshaller marshaller = ctx.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); marshaller.setAttachmentMarshaller(new AttachmentMarshallerImpl()); out = new ByteArrayOutputStream(); marshaller.marshal( obj, out ); }catch( JAXBException e ){ throw new RuntimeException("Problem in parsing", e); } } I have tried the following: @Test public void testToXml() throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); SystemPointDto systemPointDto = new SystemPointDto(); verify((marshaller), atLeast(1)).marshal(systemPointDto, out); } However I am getting a NullPointerException when I run the test. I am a newbie in testing probably the answer is very easy. Could you please advice? Thanks in advance. EDIT: The mocking code as asked in the comments is: @Mock AttachmentMarshallerImpl attachmentMarshaller; @InjectMocks Marshaller marshaller; And this is the stack trace: initMocks(TestingIfTheMarshalGetsCalledWithoutExceptionTest.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.Par…
has comment: http://stackoverflow.com/comment/34984584
tagged with: mockito
tagged with: junit
tagged with: jpa
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22932072
has comment: http://stackoverflow.com/comment/35002822
has comment: http://stackoverflow.com/comment/35004007
has comment: http://stackoverflow.com/comment/35010805
has title: how to mock a method belonging to JPA libraries
has comment: http://stackoverflow.com/comment/35003916

http://stackoverflow.com/a/22914317
score: -6
type: Answer
answers question: http://stackoverflow.com/q/22912900
has body: In Maven project source file store inside src/main/java , src/main/resources and test class store inside src/test/java. In Maven generated code (Compile code) stored into target/ folder. When you build your Maven project, all generated code to be updated in target folder.
upvote count: 1
downvote count: 7

http://stackoverflow.com/comment/121442361
type: Comment
comment on: http://stackoverflow.com/a/68715007
has text: consider adding some comments and explanations along with the solution code.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34999969
has text: Works for me. try `C:/Logo1.png`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22928116
type: Comment

http://stackoverflow.com/comment/34951829
comment on: http://stackoverflow.com/a/22901924
type: AnswerComment
score: 0
type: Comment
has text: Oh i figured it out. Apparently I can set maxValue to Double.NaN on the else statement. Thank you for ur help with the rest of the code though!

http://stackoverflow.com/a/43568405
type: Answer
has body: Configuring spring data JPA using XML and annotations //This is the two way to configure spring data JPA @EnableJpaRepositories (basePackages= "Repository Bean is located in package", entityManagerFactoryRef= "Here is your configuration of EntityManagerFactoryBean") &lt;jpa:repositories base-package= "Repository Bean where package" Entity-manager-factory-ref= "Here is your configured EntityManagerFactoryBean" &gt;&lt;/jpa:repositories&gt; // Sample code： @Configuration @EnableTransactionManagement @EnableJpaRepositories(basePackages="com.zxg.springdata", entityManagerFactoryRef="factoryBean") public class SpringDataConfig { @Bean public LocalContainerEntityManagerFactoryBean factoryBean ( ComboPooledDataSource dataSource, JpaVendorAdapter jpaVendorAdapter ){ LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean (); FactoryBean.setDataSource (dataSource); FactoryBean.setJpaVendorAdapter (jpaVendorAdapter); FactoryBean.setPackagesToScan ("com.zxg.springdata"); Return factoryBean; } }
answers question: http://stackoverflow.com/q/22864261
score: 0

http://stackoverflow.com/q/22887400
has title: Is there an equivalent to Java -Xmx for python?
has body: I am used to running .command scripts with terminal that use java, which allocates an amount of memory by the arguments -Xmx and -Xms. I am now using a .sh script with python and can't seem to figure out what the equivalent is. EDIT: Let me explain a little more. Is it possible to do that in the shell script or am I stuck decompiling Python scripts?
score: 2
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34925747
type: Question
has comment: http://stackoverflow.com/comment/34925785
linked to: http://stackoverflow.com/q/2308091
downvote count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/34925680
favorite count: 0
duplicate of: http://stackoverflow.com/q/2308091
upvote count: 2
type: UnansweredQuestion
tagged with: python

http://stackoverflow.com/comment/45700832
type: QuestionComment
comment on: http://stackoverflow.com/q/22886083
score: 0
has text: I use nohup for testing purposes.
type: Comment

http://stackoverflow.com/comment/34923409
comment on: http://stackoverflow.com/a/22883515
type: AnswerComment
score: 0
type: Comment
has text: That worked, thanks! Is this strictly a Mockito limitation? I didn't come across anything in their documentation regarding mocks retaining the annotations of their classes.

http://stackoverflow.com/q/22824809
tagged with: jdbc-odbc
has body: I have scenario below I have all my files (HW2.java and 3 jar files for JDBC/ODBC) in folder src. I am running the following commands but still getting errors but the above code runs fine in eclipse, the problem comes only when code in run via command line: src&gt; javac -cp ".:*.jar" HW2.java src&gt;java -cp ".:*.jar" HW2 window building 10 20 300 400 Error: Could not find or load main class HW2 src&gt; java HW2 window building 10 20 300 400 java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost: 1521:orcl at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at HW2.DBconnect(HW2.java:22) Could anyone tell me how to run correctly?
upvote count: 0
has comment: http://stackoverflow.com/comment/34812902
score: -1
has title: Running java file
answer count: 2
tagged with: jdbc
has comment: http://stackoverflow.com/comment/34829627
favorite count: 0
has answer: http://stackoverflow.com/a/22824977
linked to: http://stackoverflow.com/q/1237093
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34824451
has answer: http://stackoverflow.com/a/22831707
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/comment/34845788
score: 0
has text: yeah but then its all in one line... and \t doesnt work
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22843630

http://stackoverflow.com/a/22887940
answers question: http://stackoverflow.com/q/22887763
score: 0
type: Answer
has body: Try this one Note:You have missed modulus % operator String expression = "2/3*1%(2+11)"; Pattern pt = Pattern.compile("[-+*/()%]"); Matcher mt = pt.matcher(expression); int lastStart = 0; while (mt.find()) { if (lastStart != mt.start()) { System.out.println("number:" + expression.substring(lastStart, mt.start())); } lastStart = mt.start() + 1; System.out.println("operator:" + mt.group()); } if (lastStart != expression.length()) { System.out.println("number:" + expression.substring(lastStart)); } output number:2 operator:/ number:3 operator:* number:1 operator:% operator:( number:2 operator:+ number:11 operator:)

http://stackoverflow.com/comment/34837405
has text: Are you sure the "process" you get is not sh itself that has finished running freebcp but is still running itself? Why do you not call freebcp directly?
score: 0
comment on: http://stackoverflow.com/q/22838283
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34821139
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22829493
has text: @Radiodef: No it doesn't. If `avg[n]` is the average of the first `n` elements, then `avg[n] = ((n-1)*avg[n-1] + x[n-1])/n`.
score: 0

http://stackoverflow.com/q/22828675
tagged with: android
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22828982
tagged with: android-radiobutton
type: Question
has answer: http://stackoverflow.com/a/22828940
has title: How to set values for Radio button in android?
has comment: http://stackoverflow.com/comment/34819403
answer count: 3
has answer: http://stackoverflow.com/a/22828758
has body: I am getting the value from DB and setting it to the respective button in the below format. Is there any optimised way to do the same. All these radio buttons are inside a radio group. if (bundlevalue.get(3).equalsIgnoreCase("Mr.")) { rg_nametitle.check(R.id.mr); } else if (bundlevalue.get(3).equalsIgnoreCase("Mrs.")) { rg_nametitle.check(R.id.mrs); } else if (bundlevalue.get(3).equalsIgnoreCase("Ms.")) { rg_nametitle.check(R.id.ms); } else { rg_nametitle.check(R.id.messrs); }
tagged with: android-radiogroup
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34994993
type: QuestionComment
has text: Consider upgrading to a real IDE and using a debugger. Alternatively, use pen and paper to trace execution.
type: Comment
comment on: http://stackoverflow.com/q/22925674
score: 0

http://stackoverflow.com/comment/131950760
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22831523
has text: In case, someone is here because he/she was trying to expect a different behavior for a mock than from the init/before behavior. You might need to add reset(mockObject) before expect().
type: Comment

http://stackoverflow.com/comment/34909188
type: Comment
type: QuestionComment
has text: Uncompilable code snippets are not an MCVE.. Please, follow the link, read about it.
score: 0
comment on: http://stackoverflow.com/q/22859420

http://stackoverflow.com/q/22944910
has comment: http://stackoverflow.com/comment/35029520
score: 0
has answer: http://stackoverflow.com/a/22944949
linked to: http://stackoverflow.com/q/1881922
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22945437
has title: What is the advantage of creating object with clone() over constructor?
has comment: http://stackoverflow.com/comment/137327291
type: Question
answer count: 2
has body: Whenever I'm doing shallow cloning then if my class consists of any user-defined reference type then there reference value will copied but not values, but if I'm writing String s="something", then even though s is an object but it is directly copied into the cloned object, why so? Does it mean pre-defined object will be copied but user-defined object reference will be copied?

http://stackoverflow.com/comment/34977078
has text: @Cruncher Why do I need an Installation setup to set all of the registry values? Can't i just set it from java?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22915392

http://stackoverflow.com/comment/35034730
comment on: http://stackoverflow.com/q/22947596
score: 0
type: Comment
type: QuestionComment
has text: Good, because that's the JavaDocs I referenced in my answer

http://stackoverflow.com/comment/34896432
type: Comment
comment on: http://stackoverflow.com/a/22871292
type: AnswerComment
has text: A good solution. However, I would suggested to use `string()` instead of `text()`, which is better in almost all cases (e.g. if you use `text() you might get back comments in your XML as result, which is almost never intended)
score: 0

http://stackoverflow.com/comment/34922900
score: 1
comment on: http://stackoverflow.com/q/22885896
type: Comment
type: QuestionComment
has text: Grapher 10 does not draw cubic splines. If you want cubic splines, then you get output that looks like JFreeChart. As JFreeChart's only spline renderer, [`XYSplineRenderer`](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/xy/XYSplineRenderer.html), uses cubic splines, you'd have to create your own renderer using a different type of spline if you are finding that cubic splines are not appropriate. I don't know what type Grapher uses.

http://stackoverflow.com/comment/35004877
has text: As @greg-449 already mentioned, there is a 32bit and a 64bit version of the Mac SWT library [here on the official website](http://download.eclipse.org/eclipse/downloads/drops4/R-4.3-201306052000/#SWT)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22926289
score: 0

http://stackoverflow.com/comment/34967490
type: AnswerComment
comment on: http://stackoverflow.com/a/22909974
score: 0
type: Comment
has text: Thank you, this came about because I used a sorted set (TreeSet) with a comparator, and it had the rather unexpected (to me) result that it deleted elements where comparator==0, whereas I thought it would only delete elements with equalsTo=true. Obviously, this is not a difficult thing to fix, but it was surprising to me.

http://stackoverflow.com/comment/34952321
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22902084
score: 0
has text: Yes, I don't know how to do relative path. As I said above, it seems to search the incorrect folder.

http://stackoverflow.com/comment/34991645
comment on: http://stackoverflow.com/q/22923454
has text: http://stackoverflow.com/a/3108582/2182351 . have some cutOff year and validate
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22953011
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22952505
has body: Here is a simple method (But I am not sure if it will work everywhere. Test it yourself) NB: Code is in Python, I don't do Java, sorry about that :( Load the grayscale image Apply Otsu's binarization import cv2 import numpy as np img = cv2.imread('test.png',0) ret, thresh = cv2.threshold(img, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU) Below is the thresholded image: Now you can try two methods: 3a. Median Blurring with a 3x3 kernel res = cv2.medianBlur(thresh,3) Result: 3b. Erosion with a 3x1 kernel (vertical). 3x1 because all the lines in your image are more-horizontal. It there are vertical lines in other images, you may need to take 3x3 kernel (not sure. Check it) kernel = np.ones((3,1)) cls = cv2.erode(thresh, kernel) If you think you are losing some parts of digits also, you can apply dilation after erosion, or replace everything with morphological opening function. Result: Finally, find contours. It will also pick up some noise left in the preprocessed image, but you can filter out them by checking their aspect ratio, area etc.
has comment: http://stackoverflow.com/comment/35047063
has comment: http://stackoverflow.com/comment/35050103

http://stackoverflow.com/a/22850112
has comment: http://stackoverflow.com/comment/95881373
score: 1
upvote count: 2
type: AcceptedAnswer
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/22849995
has body: Your test tries to use your singleton. So The JVM loads and initializes the enum. As part of this process, it calls your constructor to initialize the unique enum instance. The constructor throws an exception, preventing the class to be loaded correctly. Once the JVM has tried and failed to load the class, it won't try loading it anymore. Singleton is an anti-pattern. And doing that kind of process, leading to exceptions, in a singleton that is eagerly initialized when its class is loaded, is a really bad idea.
answers question: http://stackoverflow.com/q/22849995

http://stackoverflow.com/comment/34830973
type: QuestionComment
comment on: http://stackoverflow.com/q/22835214
score: 0
has text: It is fairly easy to understand if you remember few things: 1) in Java all variables are passed by value - i.e. you get a copy of the primitive data types and a copy of the reference to a complex data type. 2) `new` operator creates completely new object, it does **not** update the existing object.
type: Comment

http://stackoverflow.com/comment/35056232
type: Comment
comment on: http://stackoverflow.com/a/22960246
score: 0
has text: You have so much of stuff in one line? Anyway, I suspect there's nothing in the list `stocks` and you're trying to get the first element in `stocks.get(0)` without checking if its `empty()`. Or only 2 items thats why `stocks.get(2)` is throwing an exception.
type: AnswerComment

http://stackoverflow.com/comment/34817086
comment on: http://stackoverflow.com/q/22827441
score: 0
has text: Didn't I spend a LOT of time helping you with this a couple of days ago? Do you want somebody else to go through the same process all over again?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35068668
type: Comment
has text: @Ydder I was able to track down the source. See my edit.
score: 0
comment on: http://stackoverflow.com/a/22966339
type: AnswerComment

http://stackoverflow.com/q/22853226
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
tagged with: compatibility
has body: I'm developing an application that I plan to publicly release, or at least share with a group of people. The problem that I am facing as a developer is compatibility. On my machine, I am using the new Java 8, but I am afraid to use its new features, and in fact, I'm even afraid to use the new features in Java 7, like try-with-resources, in fear that the users will not have an up-to-date Java version, and consequently, will not be able to use my application. For example, my school's computers still use Java 6. First off, am I correct in thinking that? Or can code compiled with a newer JDK run on a machine with an older JRE? If I am correct, is there an established "rule" or standard for compatibility? Something like, "Make sure your code is compatible with a JRE that is two versions old!" Or is it purely a matter of the developer's judgement of when new features should be utilized for a released work? And just for emphasis, I am talking about just running the program. The user will never have to compile it. I know this is a bit open ended, but this is the best place that I could think of to ask. Thanks.
score: 4
has answer: http://stackoverflow.com/a/22853265
has comment: http://stackoverflow.com/comment/34863663
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34863661
favorite count: 0
has title: When is it soon enough to use new Java features?
has comment: http://stackoverflow.com/comment/34863658
accepted answer: http://stackoverflow.com/a/22853265

http://stackoverflow.com/comment/34863029
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22852856
has text: if you can post your code it would be easy for us to find the solution.
score: 0

http://stackoverflow.com/comment/35063536
comment on: http://stackoverflow.com/q/22962932
type: Comment
type: QuestionComment
score: 0
has text: Thing is that I don't even get the first message. How can avoid this "blocking" for a normal chat? All timeouts did was end the connection after set time

http://stackoverflow.com/q/22888173
has body: EDIT: ANSWERED in comments I have opened pandora's box worth of errors over the past few days and have boiled the source of my troubles down to my inability to correctly add the Google Play Services library into my project so I can have adMob ads. I should be able to go to Project>Properties>Android and then under Library hit add. However when I hit add, It's menu is all grayed out and I cant add, browse or do anything. I am using the new ADT bundle as of about April 2, "Build: v22.6.2-1085508". What exactly is wrong and how can I fix it? Thank you very much! Any help is greatly Appreciated!!
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34926948
type: Question
tagged with: adt
tagged with: eclipse
tagged with: google-play-services
has title: Can't add Library in eclipse android project ADT
score: 0
has comment: http://stackoverflow.com/comment/34948957
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/34942126
comment on: http://stackoverflow.com/q/22896401
has text: @trashgod what is a mcve?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35008177
comment on: http://stackoverflow.com/a/22932852
type: AnswerComment
has text: @MarkoTopolnik - I see.
score: 0
type: Comment

http://stackoverflow.com/comment/34861192
type: Comment
comment on: http://stackoverflow.com/a/22850775
has text: It all boils down to the degree of parallelism. One could have each task work on a line, then an enclosing task working on a file and the main method will spawn as many enclosing task as the number files, keeping in mind the memory requirements, @user1477957.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35050475
score: 1
type: QuestionComment
type: Comment
has text: oh, sorry for being sloppy there. maybe the [update](https://gist.github.com/berak/9830239) helps
comment on: http://stackoverflow.com/q/22948553

http://stackoverflow.com/a/47893045
upvote count: 1
has body: The user in your tomcat-users.xml should have manager-script and manager-jmx roles. It also should not have manager-gui role, as this is for users that will use the tomcat manager website, instead of a script that will deploy automatically.
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22946631
type: Answer
accepted answer of: http://stackoverflow.com/q/22946631

http://stackoverflow.com/q/22815795
has comment: http://stackoverflow.com/comment/34796357
possible better answer: http://stackoverflow.com/a/22816720
has comment: http://stackoverflow.com/comment/34795946
tagged with: user-interface
has answer: http://stackoverflow.com/a/22816720
score: 0
has title: Trying to find error in Java Swing program
tagged with: jframe
has answer: http://stackoverflow.com/a/22816822
tagged with: swing
has comment: http://stackoverflow.com/comment/34796442
type: Question
type: AnsweredQuestion
has body: So this is my program... It's a way to enter and list marathon runners. Now I'm getting an error when using the "Ny" button (http://gyazo.com/e29517af6befd6242d86e6fe1dc5aae1). Here's the error code: http://gyazo.com/9f80885d41db38cfa5502fe911f6a893. I think the problems is between the "Form" panel and the listener. There may be unreachable code somewhere? I had this working the other day but I lost the code. Now it doesn't work. The idea is that the "ny" button shows the user a panel "Form", but instead I get the rror. I'm a huge noob, so I expect it's some obvious syntax error I just can't seem to spot. Any feedback is appreciated. import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class Maraton extends JFrame{ JTextArea display; JButton visa; ArrayList &lt;Tävlande&gt; list = new ArrayList &lt;Tävlande&gt;(); Maraton(){ super("Kista Maraton"); display = new JTextArea(); display.setEditable(false); add(display, BorderLayout.CENTER); add(new JScrollPane(display),BorderLayout.CENTER); setLocationRelativeTo(null); setSize(300, 400); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel nedre = new JPanel (); JPanel höger = new JPanel(); add(nedre, BorderLayout.SOUTH); add(höger, BorderLayout.EAST); höger.setLayout(new BoxLayout(höger, BoxLayout.Y_AXIS)); nedre.setBackground( new Color(246,246,246) ); nedre.setBorder(BorderFactory.createLineBorder(new Color(200,200,200))); JButton ny = new JButton("Ny"); ny.addActionListener(new NyLis()); JButton visa = new JButton("Visa"); visa.addActionListener(new VisaLis()); visa.setEnabled(false); JButton nyTid = new JButton("Ny Tid"); nedre.add(ny); nedre.add(visa); nedre.add(nyTid); JRadioButton StartNrRb = new JRadioButton("Startnr"); JRadioButton NamnRb = new JRadioButton("Namn"); JRadioButton ÅlderRb = new JRadioButton("Ålder"); JRadioButton TidRb = new JRadioButton("Tid"); höger.add(StartNrRb); höger.add(NamnRb); höger.add(ÅlderRb); höger.add(TidRb); ButtonGroup bg1 = ne…
tagged with: java
has comment: http://stackoverflow.com/comment/34796427
answer count: 2
accepted answer: http://stackoverflow.com/a/22816822

http://stackoverflow.com/comment/34939146
type: Comment
comment on: http://stackoverflow.com/a/22895005
type: AnswerComment
score: 0
has text: you can suggest better ways all the time. :)

http://stackoverflow.com/comment/34882977
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22864017
has text: possible duplicate of [Why am I getting a compilation errors with a simple printf?](http://stackoverflow.com/questions/7774428/why-am-i-getting-a-compilation-errors-with-a-simple-printf)
type: Comment

http://stackoverflow.com/q/22844855
has answer: http://stackoverflow.com/a/22845281
has comment: http://stackoverflow.com/comment/34848901
type: Question
answer count: 2
has body: What I am ultimately trying to do is: 1)Go through operators ArrayList and find the * or / (whatever comes first) 2)Go to numbers ArrayList and do the operation * or / at index and index+1 3)Add the evaluated value and remove the numbers at index and index+1 4)Remove operator at index 5)Repeat loop until higher precedence operators are gone. 6)Do the same for operators of lower precedence (+ and -).
has comment: http://stackoverflow.com/comment/34848430
tagged with: arrays
downvote count: 0
possible better answer: http://stackoverflow.com/a/22845701
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/22845281
has answer: http://stackoverflow.com/a/22845701
has title: Trying to solve math equation whose operators and numbers are in two different lists
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34849060
has comment: http://stackoverflow.com/comment/34849421
has comment: http://stackoverflow.com/comment/34849639
has comment: http://stackoverflow.com/comment/34848101
upvote count: 1
type: AnsweredQuestion
tagged with: java

size
type: Tag
tags question: http://stackoverflow.com/q/22934553
tags question: http://stackoverflow.com/q/22946961
tag name: size
tags question: http://stackoverflow.com/q/22931808

http://stackoverflow.com/a/22918713
type: AcceptedAnswer
downvote count: 0
has body: We are able to do this with ProxySelector. The only thing which we have changed was server start parameter: -DUseSunHttpHandler=true. Now it works and send User-Agent header.
accepted answer of: http://stackoverflow.com/q/22887615
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22887615

http://stackoverflow.com/q/22930780
has body: I'm trying to make a Java desktop application where I want to shuffle image from project folder. I'm able to achieve this but I have to pass the name of pic but I don't want to pass any pic name in my code. I just want to use folder name and it should automatically retrieve all images from there. Here is my code: public class Main1 extends JFrame { private java.util.List&lt;BufferedImage&gt; list = new ArrayList&lt;BufferedImage&gt;(); private java.util.List&lt;BufferedImage&gt; shuffled; private JLabel label = new JLabel(); private int width = 708; private int height = 800; private Timer timer = new Timer(4000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { update(); } }); public Main1( ) { super("Simple Timer"); { getContentPane().setBackground(new java.awt.Color(153,153,0)); } try { list.add(resizeImage(ImageIO.read(new File("images\\1.jpg")))); list.add(resizeImage(ImageIO.read(new File("images\\2.jpg")))); list.add(resizeImage(ImageIO.read(new File("images\\3.jpg")))); list.add(resizeImage(ImageIO.read(new File("images\\4.jpg")))); } catch (IOException e) { e.printStackTrace(); } shuffled = new ArrayList&lt;BufferedImage&gt;(list); Collections.shuffle(shuffled); timer.start(); } private BufferedImage resizeImage(BufferedImage originalImage) throws IOException { BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = resizedImage.createGraphics(); g.drawImage(originalImage, 0, 0, width, height, null); g.dispose(); return resizedImage; } private void update() { if (shuffled.isEmpty()) { shuffled = new ArrayList&lt;BufferedImage&gt;(list); Collections.shuffle(shuffled); } BufferedImage icon = shuffled.remove(0); jLabel6.setIcon(new ImageIcon(icon)); }
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22930845
has comment: http://stackoverflow.com/comment/35003856
tagged with: jlabel
has answer: http://stackoverflow.com/a/22930831
accepted answer: http://stackoverflow.com/a/22930831
has comment: http://stackoverflow.com/comment/35006562
type: AnsweredQuestion
tagged with: list
tagged with: shuffle
has answer: http://stackoverflow.com/a/22930845
tagged with: java
tagged with: swing
type: Question
has title: How to shuffle list of images?
has comment: http://stackoverflow.com/comment/35004141

http://stackoverflow.com/q/22829930
has body: @SuppressWarnings("unchecked") public static &lt;T&gt; List&lt;T&gt; eliminateDuplicate(List&lt;T&gt; list) { Set&lt;T&gt; set = new HashSet&lt;T&gt;(list); return (List&lt;T&gt;) Arrays.asList(set.toArray()); } Wanted check the space complexity of the simple code above to eliminate dulplicates. Storage in Set -> O(n) Storage in array generated due to set.toArray - O(n) Storage in the newly created list - O(n) Total O(3n) which is same as O(n). Can you confirm this for me?
upvote count: 0
answer count: 1
favorite count: 0
tagged with: complexity-theory
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34821617
tagged with: space-complexity
has answer: http://stackoverflow.com/a/22830095
tagged with: java
has title: Verifying space complexity of code to eliminate duplicates
downvote count: 1
type: Question
score: -1

http://stackoverflow.com/comment/35035502
comment on: http://stackoverflow.com/q/22948234
type: Comment
has text: Most of the time, you should look for a way to accomplish what you need with polymorphism, rather than using `instanceof`. See http://stackoverflow.com/questions/4192837/how-does-one-use-polymorphism-instead-of-instanceof-and-why
type: QuestionComment
score: 2

http://stackoverflow.com/q/22943972
has comment: http://stackoverflow.com/comment/35027482
tagged with: java
tagged with: image-processing
has body: I have an MVC application java that captures an image from file, saving it to an object of type BufferedImage. I would like to do the AND logical operation between two images but do not know how to do, I can not find the sample code, where can I find it? Thanks
type: Question
has comment: http://stackoverflow.com/comment/35247756
has title: Use logical operators on images
has comment: http://stackoverflow.com/comment/35027463
tagged with: image
has comment: http://stackoverflow.com/comment/35050289
score: 0
has comment: http://stackoverflow.com/comment/35031422
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/a/22843486
has comment: http://stackoverflow.com/comment/34845629
score: 0
type: Answer
has body: You need to test if the field is empty first. You did it correctly with your first conditional on the stageTf field. You need to do the same with the distanceTF field. This means nesting your conditional statements. if(stageTF.getText().equals("")) if(distanceTF.getText().equals("")){ /* ... */ } else { //here it is safe to test for exceptions by using a try/catch try{ //here you can parse the string to your Double }catch(NumberFormatException nfe){ /* ... */ } }
answers question: http://stackoverflow.com/q/22843341
has comment: http://stackoverflow.com/comment/34845526

http://stackoverflow.com/comment/35026471
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22943351
has text: Yeah, I've seen ways to do it with 2d-arrays, but I needed to make this work with a flat int-array!

http://stackoverflow.com/comment/34850632
comment on: http://stackoverflow.com/q/22845663
has text: And? What happened? Got exception? Didn't get what you expected? Share your full code, edit your post.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34984632
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22908573
has text: Interesting. I always thoght that "inherent" and "inherited" were related. Like "inherent" = "quality that is undoubtfully present because of the ancestry/inheritance/belonging to a group". But looks like thay have different roots indeed ("heredito" vs. "haereo").

http://stackoverflow.com/comment/34815162
type: Comment
type: QuestionComment
has text: What does your debugger (or print statements) tell you the value of `term` is? Don't forget about newlines etc...
comment on: http://stackoverflow.com/q/22826338
score: 0

http://stackoverflow.com/q/22967425
favorite count: 0
has body: I understand that this step requires a for each loop, but how would i go about writing one suited to this situation? &gt;Move every fragment in the collage by a given amount. &gt;@param xDelta int pixels of horizontal move &gt;@param yDelta int pixels of vertical move public void move(int xDelta, int yDelta) { for }
has comment: http://stackoverflow.com/comment/35069060
has answer: http://stackoverflow.com/a/22967483
type: UnansweredQuestion
score: -8
upvote count: 1
tagged with: loops
downvote count: 9
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22967540
has title: For each loop: Java

http://stackoverflow.com/a/44915818
answers question: http://stackoverflow.com/q/22926289
has body: Change the SWT jar in your project classpath, You are using a 32 bits cocoa, use the 64 bits: http://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.swt.cocoa.macosx.x86_64
score: 0
type: Answer

http://stackoverflow.com/comment/35007968
has text: Add `s = ...` at the end of each `case`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22932998
score: 0

http://stackoverflow.com/a/22902572
has comment: http://stackoverflow.com/comment/34953799
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34953119
has comment: http://stackoverflow.com/comment/34953075
has comment: http://stackoverflow.com/comment/34952933
type: Answer
has body: You're referencing the wrong theDeck array in your constructor. In your constructor, private Card[] theDeck; // Your constructor is not referring to this! private int top; // add more instance variables if needed public Deck(){ top = 0; Card[] theDeck = new Card[52]; // You defined a local theDeck variable! for(int s = 1; s &lt;= 4; s++) { for (int v = 1; v &lt;= 13; v++) { for (int i = 0; i &lt; theDeck.length; i++) { theDeck[i] = new Card(s,v); } } } } See what happened there? So instead of your constructor pointing to the class field theDeck, you created another one. So what you should do is remove the Card[] from that line so that your constructor points to the field, and you don't create a local variable. Does that make sense? Make a comment so I can help you out further. I also recommend that you make use of the this keyword to refer to your fields. This will help avoid confusion. See this link for more on the this keyword.
has comment: http://stackoverflow.com/comment/34952952
accepted answer of: http://stackoverflow.com/q/22902437
answers question: http://stackoverflow.com/q/22902437
score: 0

http://stackoverflow.com/a/22902428
upvote count: 1
answers question: http://stackoverflow.com/q/22902389
downvote count: 0
has body: There are some rules and there are some tools to help with those rules. Basically using a static code analyzer helps to determine whether the method is too big or doing too many things. Findbugs is one of the famous static code analyzer.
type: Answer
score: 1

http://stackoverflow.com/comment/34933135
has text: When your message comes back from the server, it goes into `onPostExecute`... what happens after that is in your hands.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22891147

http://stackoverflow.com/comment/34855064
has text: @MadProgrammer That is the identity I learned in my newspaper days - it was also a hint and not an answer.
comment on: http://stackoverflow.com/q/22846448
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22823698
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35041080
type: Answer
has body: Yes. This is possible if you don't bother about content security. You can copy the content to any of the file system path in sdcard and your app can look for the folder and read the files . Example , you can create a folder in sdcard as sdcard/appname/media/ and create a layout to access the files in the device, and when user selects the files provide option to copy it to your sdcard/appname path. Check this link http://developer.android.com/training/basics/data-storage/files.html Note : the sdcard path can be accessed if you connect to any external system ( PC).
answers question: http://stackoverflow.com/q/22823313

http://stackoverflow.com/a/22827655
accepted answer of: http://stackoverflow.com/q/22827574
score: 1
has body: I think you're misunderstanding what hexadecimal and decimal are meant to represent. Decimal is a numerical representation in base 10 - you know, counting from 0 to 9. That's the system we're used to. Hexadecimal is a numerical representation in base 16 - which goes from 0 to F. In effect, your concern is that 157 isn't the same as 0x9D, when it actually is. Hexadecimal is more a formal representation, and it doesn't change the underlying value of the number. So, you should be okay to see 157 passed in to your method. If you really want to see it again as 0x9d, you can use String#format inside of your System.out.println: System.out.println("\ninside: " + String.format("%x", moduleId));
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34820209
downvote count: 0
answers question: http://stackoverflow.com/q/22827574
type: Answer
upvote count: 1

http://stackoverflow.com/a/22884164
has body: Use a LIMIT clause in your SQLLite Query.
answers question: http://stackoverflow.com/q/22884135
score: 0
has comment: http://stackoverflow.com/comment/34919611
has comment: http://stackoverflow.com/comment/34919600
has comment: http://stackoverflow.com/comment/34919707
type: Answer

http://stackoverflow.com/a/22845552
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22845391
has body: According to the BufferedReader.readLine() JavaDoc, this function returns A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached Therefore, you should check each call to br.readLine() to make sure it's not null before attempting to do something with it...such as fw.write(br.readLine().replace("]", "&gt;")); ^ ^ This is null..so attempting this throws a `NullPointerException` But even more of a problem, is that you are incorrectly reading in a new line, when you are intending to make a second replacement on the same line. Changing it to this addresses both issues: String line = br.readLine(); if(line != null) { fw.write(line.replace("[", "&lt;")); fw.write(line.replace("]", "&gt;")); }

http://stackoverflow.com/comment/35019124
type: AnswerComment
has text: @ssssteffff which is exactly what I stated in my answer.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22939297

http://stackoverflow.com/q/22827860
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22828003
type: Question
score: 5
upvote count: 5
answer count: 2
possible better answer: http://stackoverflow.com/a/22828016
has answer: http://stackoverflow.com/a/22828016
downvote count: 0
tagged with: deserialization
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/22828003
has title: Will I be able to successfully deserialize a previous version of my class?
has body: I have a class like this class MyClass implements MyInterface, Serializable { private static final serialVersionUID = 42; ... } interface MyInterface { void A(); void B(); } I have saved in a database some serialized instances of MyClass. Now, I'm adding a new function to MyInterface so it becomes: interface MyInterface { void A(); void B(); void C(); } And I have implemented C() in MyClass. Will my previously serialized instances deserialize as the new class with no problem? I think yes but wanted to confirm, if possible, with explanation.

http://stackoverflow.com/comment/34788785
score: 0
comment on: http://stackoverflow.com/a/22810426
has text: Thanks for your detailed and well laid out answer
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22957241
has comment: http://stackoverflow.com/comment/35094371
has title: 404 when adding new methods to RESTful web service
tagged with: java
has comment: http://stackoverflow.com/comment/35082570
has comment: http://stackoverflow.com/comment/35050968
type: Question
has body: The application works well with the generated methods and classes, but I wanted to get a list of article that matching a specific idChapitre. I get a "HTTP Status 404 - Not Found" on my browser. This is the facade class, where I have put in the findByIdChapitre method: @Stateless @Path("articles") public class ArticleFacadeREST extends AbstractFacade&lt;Article&gt; { @PersistenceContext(unitName = "PNC-BackendPU") private EntityManager em; public ArticleFacadeREST() { super(Article.class); } @GET @Path("bychapitre/{idChapitre}") @Produces({"application/json"}) public List&lt;Article&gt; findByIdChapitre(@PathParam("idChapitre") Chapitre idChapitre) { Query q = em.createNamedQuery("Article.findByIdChapitre"); q.setParameter("idChapitre", idChapitre); return q.getResultList(); } ... } and my article class: @Entity @Table(name = "article") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Article.findAll", query = "SELECT a FROM Article a"), @NamedQuery(name = "Article.findByIdArticle", query = "SELECT a FROM Article a WHERE a.idArticle = :idArticle"), @NamedQuery(name = "Article.findByIdChapitre", query = "SELECT a FROM Article a WHERE a.idChapitre = :idChapitre"), @NamedQuery(name = "Article.findByCodeArticle", query = "SELECT a FROM Article a WHERE a.codeArticle = :codeArticle")}) public class Article implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id_article", nullable = false) private Integer idArticle; @Lob @Size(max = 65535) @Column(name = "nom_article", length = 65535) private String nomArticle; @Size(max = 20) @Column(name = "code_article", length = 20) private String codeArticle; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idArticle") private List&lt;Littera&gt; litteraList; @JoinColumn(name = "id_chapitre", referencedColumnName = "id_chapitre", nullable = false) @ManyToOne(optional = false) private Chapitre idChapitre; public Ar…
has comment: http://stackoverflow.com/comment/35051793
has comment: http://stackoverflow.com/comment/35051012
tagged with: restful-url
has comment: http://stackoverflow.com/comment/35080952
tagged with: glassfish
score: 0
tagged with: rest
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34996497
has text: @user3482995: which is *why* you should ask a complete question, one with code that shows us the problem, else you force us to guess what may be wrong in code not shown. But I'm glad that you've fixed it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22926416
type: Comment

http://stackoverflow.com/comment/34883055
type: AnswerComment
comment on: http://stackoverflow.com/a/22864127
type: Comment
has text: I've used these functions in http://stackoverflow.com/questions/10782187/how-to-encrypt-file-from-sd-card-using-aes-in-android
score: 0

http://stackoverflow.com/q/22865329
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34885056
possible better answer: http://stackoverflow.com/a/22865443
has answer: http://stackoverflow.com/a/22865443
type: AnsweredQuestion
tagged with: java
has body: I have a JDBCTemplate connection and a NamedParameterJdbcTemplate connection variable between my Spring MVC application and an Oracle database. I also have a stored procedure in the Oracle database that takes either a 0 or 1 as an input parameter, and does not return anything upon completion. I need help understanding how to execute this stored procedure. Eventually I will need to send this execution to a thread to complete without having the user to sit and wait, but I need to get this step first. I have looked at the other questions on the site for help and it feels like the explanations aren't giving me anything I can work with. So I need any advise that can be offered. All I have is this so far which isn't even correct: public void processRetrosToEpay() throws SQLException{ //CallableStatement cs = spaeJDBCTemplate.prepareCall("RP_RETRO_PROCESS(?)"); //cs.execute(); }
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23435962
tagged with: sql
accepted answer: http://stackoverflow.com/a/23435962
has title: Spring MVC - Executing an Oracle Stored Procedure using java?
tagged with: oracle-database

http://stackoverflow.com/comment/34859069
comment on: http://stackoverflow.com/a/22850326
has text: According to the [wikipedia link](http://en.wikipedia.org/wiki/Adapter_pattern#Class_Adapter_pattern), the Class Adapter is indeed possible in Java. I trust the GOF more, but obviously it's semantics and subtleties here. Does the OP care about the specific pattern as a theoretical question, or is he trying to figure out how to implement Adapters in Java as a practical matter?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/90296517
score: 0
comment on: http://stackoverflow.com/a/22933814
type: Comment
type: AnswerComment
has text: I also have a same problem. Switching to java 7 solve the problem , but i want to do it in java 8. How can i do that ?

http://stackoverflow.com/q/22810526
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34871027
tagged with: jsf
has comment: http://stackoverflow.com/comment/34869588
score: 1
tagged with: java
has title: JSF (PrimeFaces) page doesn't work with single form
linked to: http://stackoverflow.com/q/10579230
type: Question
tagged with: primefaces
tagged with: http://stackoverflow.com/tag/xhtml
has answer: http://stackoverflow.com/a/22838811
has body: I am developing a simple page using PrimeFaces that list informations about some projects. I wanted to add a button that open a dialog with detailed information. The code is quite simple. However it doesn't work: &lt;h:form id="projectForm"&gt; &lt;p:dataTable id="projectDataTable" var="project" value="#{projectMB.projects}" &gt; &lt;p:column sortBy="name" headerText="Name"&gt; &lt;h:outputText value="#{project.name}" /&gt; &lt;/p:column&gt; &lt;p:column sortBy="status" headerText="Status"&gt; &lt;h:outputText value="#{project.status}" /&gt; &lt;h:outputText value=" (#{project.progress}%)" /&gt; &lt;/p:column&gt; &lt;p:column style="width:4%"&gt; &lt;p:commandButton update=":projectForm:display" id="selectButton" oncomplete="PF('projectDialog').show()" icon="ui-icon-search" title="View"&gt; &lt;f:setPropertyActionListener value="#{project}" target="#{projectMB.selectedProject}" /&gt; &lt;/p:commandButton&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; &lt;center&gt; &lt;p:commandButton id="refreshProjectsButton" actionListener="#{projectMB.refreshProjectList}" icon="ui-icon-refresh" update="projectDataTable"/&gt; &lt;/center&gt; &lt;p:dialog header="Project Detail" widgetVar="projectDialog" resizable="false" id="projectDlg" showEffect="fade" modal="true"&gt; &lt;h:panelGrid id="display" columns="2" cellpadding="4" style="margin:0 auto;"&gt; &lt;h:outputText value="Name:" /&gt; &lt;h:outputText value="#{projectMB.selectedProject.name}" style="font-weight:bold"/&gt; &lt;h:outputText value="Description:" /&gt; &lt;h:outputText value="#{projectMB.selectedProject}" style="font-weight:bold"/&gt; &lt;/h:panelGrid&gt; &lt;/p:dialog&gt; &lt;/h:form&gt; I found a solution by adding extra form which enclose dialog: &lt;h:form id="projectForm"&gt; &lt;p:dataTable id="projectDataTable" var="project" value="#{projectMB.projects}" &gt; &lt;p:column sortBy="name" headerText="Name"&gt; &lt;h:outputText value="#{project.name}" /&gt; &lt;/p:column&gt; &lt;p:column sortBy="status" headerTex…
has comment: http://stackoverflow.com/comment/34872595
upvote count: 1
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34889592

http://stackoverflow.com/comment/34948251
has text: I did not downvote the answer, but I imagine it is because the OP specifically is trying to display the values in reverse order.
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/22899926

http://stackoverflow.com/a/22832379
has body: ohk just paste this line after adding any pic in the gallery it will refresh your gallery It worked for me hope will help u :) sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(new File(filePath))));
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34829190
accepted answer of: http://stackoverflow.com/q/22832300
type: Answer
answers question: http://stackoverflow.com/q/22832300
upvote count: 1

http://stackoverflow.com/q/22895417
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22897334
has answer: http://stackoverflow.com/a/22897465
downvote count: 0
favorite count: 0
tagged with: systemexit
has answer: http://stackoverflow.com/a/22895530
answer count: 3
type: UnansweredQuestion
has body: I am writing automated tests for a Swing application using Jemmy framework. My test suite run this application by invoking the main method of its Main class in a new thread. I have already written a lot of GUI-related tests but now I have got a more complex task. I need to check if the tested application does some clean up of folders when it is being closed. This action is probably executed as a shutdown hook. Is it somehow possible to invoke shutdown hooks of that application without calling System.exit(0)? When this command is called both threads will be terminated. But I want the thread with my tests to continue running after the tested application is closed so I can check if those folders still exist or not. Is it somehow possible to invoke the shutdown hooks without changing the architecture of my test suite?
has title: How to invoke shutdown hooks of a program running in another thread
tagged with: shutdown-hook
tagged with: multithreading
upvote count: 1

http://stackoverflow.com/q/22880055
linked to: http://stackoverflow.com/q/26103939
has answer: http://stackoverflow.com/a/25119558
possible better answer: http://stackoverflow.com/a/32629586
downvote count: 0
tagged with: websocket
has title: JSR-356 WebSockets with Tomcat - How to limit connections within single IP address?
tagged with: tomcat
has answer: http://stackoverflow.com/a/23025059
accepted answer: http://stackoverflow.com/a/23025059
linked to: http://stackoverflow.com/q/3679465
linked to: http://stackoverflow.com/q/24914008
has body: I made a JSR-356 @ServerEndpoint in which I want to limit alive connections from single IP address, to prevent simple DDOS attacks. Note that I'm search for Java solution (JSR-356, Tomcat or Servlet 3.0 specs). I have tried custom endpoint configurer but I don't have access to IP address even in HandshakeRequest object. How to limit JSR-356 connection count from single IP address without external software like iptables?
favorite count: 0
has comment: http://stackoverflow.com/comment/35046022
linked to: http://stackoverflow.com/q/19624012
answer count: 5
has answer: http://stackoverflow.com/a/68720735
has answer: http://stackoverflow.com/a/32629586
linked to: http://stackoverflow.com/q/14644629
upvote count: 7
tagged with: jsr356
type: Question
linked to: http://stackoverflow.com/q/17936440
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/72601417
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/35045907
tagged with: servlets
has comment: http://stackoverflow.com/comment/35174930

http://stackoverflow.com/comment/34868541
type: Comment
type: QuestionComment
has text: How many accounts do you have? Why is that?
score: 1
comment on: http://stackoverflow.com/q/22855131

http://stackoverflow.com/q/22900013
score: 0
has answer: http://stackoverflow.com/a/23046669
tagged with: activity-monitor
tagged with: macos
favorite count: 0
possible better answer: http://stackoverflow.com/a/22900368
upvote count: 1
has answer: http://stackoverflow.com/a/22900368
downvote count: 1
tagged with: applescript
accepted answer: http://stackoverflow.com/a/23046669
type: AnsweredQuestion
tagged with: java
tagged with: process
has body: Hello, I run a Java (jar) application on MAC OS. I am using an AppleScript to run the Java program and it works fine. Now, I like to use an AppleScript to close the Java program. I need to Force Quit the Java program. I used the following AppleScript, set app_name to "NPC" set the_pid to (do shell script "ps ax | grep " &amp; (quoted form of app_name) &amp; " | grep -v grep | awk '{print $1}'") if the_pid is not "" then do shell script ("kill -9 " &amp; the_pid) The AppleScript that runs the Java program is called "NPC.app" When I run "NPC.app" it shows as NPC and NPC.npc on the Activity Monitor application. The above code which is set to remove the NPC application does not remove either NPC (this is the "NPC.app") or NPC.npc (this is the Java program). I get the following error, error "sh: line 0: kill: 1180 1182: arguments must be process or job IDs" number 1 1180 being the PID for NPC and 1182 being the PID for NPC.npc in the Activity Monitor. What is the correct AppleScript to force quit the Java program?
type: Question
answer count: 2
has title: AppleScript to force quit Java (JAR) programs?

http://stackoverflow.com/q/22931057
has answer: http://stackoverflow.com/a/22932582
tagged with: servlets
score: 0
answer count: 1
has title: Calling Servlets on same server but different applications?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35004339
has comment: http://stackoverflow.com/comment/35004638
tagged with: java
type: Question
has body: How can Servlet1 from one application talk with Servlet2 deployed on another application on the same server
linked to: http://stackoverflow.com/q/2793150
has comment: http://stackoverflow.com/comment/35007187

http://stackoverflow.com/comment/34857822
comment on: http://stackoverflow.com/q/22849687
type: Comment
type: QuestionComment
has text: I'll do that from time to time because it helps readability, but I don't kid myself over the redundancy of it.
score: 0

http://stackoverflow.com/q/22957050
downvote count: 0
has body: I have an sqLite database that contains a table that has 3 columns, I'm using in my layout an edittext and a ListView. What I've done by now is applying a search using the edittext and displaying the filtered results in the ListView. The following code is applied to the edittext called myFilter, words is the implecursoradapter : myFilter.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { words.getFilter().filter(s.toString()); } }); What I want to do is to filter two Charsequences, for example I want to display in my listView words that starts with a and b, can I do something like that (for example words.getFilter().filter("a","b"); ?
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7698795
tagged with: android
has answer: http://stackoverflow.com/a/22960513
score: 3
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22960701
answer count: 2
tagged with: android-listview
has title: Filter two strings in the same ListView

http://stackoverflow.com/comment/34976935
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22916041
type: Comment
has text: Static initialization block is being ran when JVM (class loader - to be specific) loads StaticClass (when it is first time referenced in code). My understanding of the requirement for no final comes from here: http://stackoverflow.com/a/16853836/1864054 What am I missing?

vuze
tags question: http://stackoverflow.com/q/22949692
tag name: vuze
type: Tag

http://stackoverflow.com/comment/34880496
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22810331
score: 0
has text: @Meno Indeed, this seems to be the case. Pre 1.7 jRuby packaged a modified version of Joda in their jar. They seem to have stopped doing that in 1.7, which is the default used by Spring 4.x. I'm not sure how or why the app suddenly picked it up in this particular place, but it seems others had similar problems (albeit they were using jRuby directly and hence had a somewhat easier time debugging). Could you please post an answer so I can accept it? (You were absolutely right about a deprecated version of Joda hiding somewhere in the libraries)

http://stackoverflow.com/q/22865536
answer count: 3
has body: I have a table in which I've assigned burst time for each of machines in the form of time type in second for eg: 00:00:03, 00:00:02 etc. I have a JAVA code that retrieves these burst times from the database and store it in a list and then convert each burst time into "milliseconds" type. ArrayList&lt;String&gt;list22=new ArrayList&lt;String&gt;(); ResultSet rs = stmt1 .executeQuery("SELECT burst_time FROM virtual_machine WHERE VM_id &lt;= 4"); while (rs.next()) { list22.add(rs.getString("burst_time")); } String tempStamp = list22.get(0); int i; for(i=0;i&lt;=list22.size()-1;i++){ System.out.println(list22.get(i)); } for(String startstamp : list22){ SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); formatter.setTimeZone(TimeZone.getTimeZone("Etc/UTC")); java.util.Date d = null; try { d = formatter.parse(startstamp);} catch (java.text.ParseException e) { System.err.println("Error: " + e.getMessage()); } long qtm= d.getTime(); System.out.println(qtm); } This gives me the following result: 00:00:03 00:00:02 00:00:02 00:00:03 3000 2000 2000 3000 Now I need to store those milliseconds values in an array bur[] and use it in the program so that the corresponding machines should run for the assigned time which is stored in the array. And can u please tell me whether I'm going through the right path in case of storing the milliseconds in array and giving it to the machines.
downvote count: 1
has comment: http://stackoverflow.com/comment/34885538
has comment: http://stackoverflow.com/comment/34885477
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34885854
has answer: http://stackoverflow.com/a/22865766
has comment: http://stackoverflow.com/comment/34885673
has answer: http://stackoverflow.com/a/22865993
has comment: http://stackoverflow.com/comment/34885284
has comment: http://stackoverflow.com/comment/34886747
has title: java code to store milliseconds into an array
tagged with: java
has comment: http://stackoverflow.com/comment/34885398
score: -1
has answer: http://stackoverflow.com/a/22865894
type: Question
has comment: http://stackoverflow.com/comment/34886238
favorite count: 0

http://stackoverflow.com/comment/34891736
comment on: http://stackoverflow.com/a/22847505
score: 0
type: Comment
type: AnswerComment
has text: It does - for a couple reasons: 1.) the set implementation may decide to use `comare(s1, s2) == 0` when looking for equality. 2.) in the case where they are equal, `compare(s1, s2)` would return `-1`, and `compare(s2, s1)` would also return -1. This could confuse the algorithm. 3.) the JavaDoc for `Comparator` states that a `Comparator` is "consistent with equals if and only if c.compare(e1, e2)==0 has the same boolean value as e1.equals(e2) for every e1 and e2 in S." The JavaDoc states that bad things can happen in this case.

http://stackoverflow.com/q/22951011
has answer: http://stackoverflow.com/a/22951031
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: I have already looked into this related question Rehashing process in hashmap or hashtable. However I need to know how exactly the rehashing process is being performed. If for example the loadfactor is .75; 1- Does this mean that we forget about the existing hashTable and for every existing entry we get them one by one and reenter them into new set of buckets this time with a new hash function? 2- If that's so then what is the performance of rehashing, say when there are n entries exited. Is it O(n) amortized?
tagged with: hashtable
accepted answer: http://stackoverflow.com/a/22951031
tagged with: java
has title: Cost of rehashing in hashmap or hashtable
has comment: http://stackoverflow.com/comment/35041053
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/10655239
tagged with: hashmap

dicom
tag name: dicom
tags question: http://stackoverflow.com/q/22967941
type: Tag

http://stackoverflow.com/a/22886644
score: 0
answers question: http://stackoverflow.com/q/22883739
type: Answer
has body: Your issue is that every time the BlockPlaceEvent event is called, an entirely new storage array is created. If you want storage to not be recreated on every event call, you have to place it outside of the method declaration like this: String storage[] = new String[100]; @EventHandler public void OnPlaceofDiamond(BlockPlaceEvent e) { Player player = e.getPlayer(); int i = 0; //The rest of your code below }

http://stackoverflow.com/comment/35038217
comment on: http://stackoverflow.com/q/22949205
score: 0
type: Comment
type: QuestionComment
has text: Maybe some write protection of the .classpath file?

http://stackoverflow.com/comment/35142389
comment on: http://stackoverflow.com/q/22840448
type: Comment
type: QuestionComment
score: 0
has text: Do you need to save data temporarily, and reuse it during your app's lifecycle?

http://stackoverflow.com/comment/34850702
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22844472
has text: add `addTableModelListener` listener on `table's model`. On each update on `combobox` check previous rows values. If any one is empty or default then do nothing. Use row and column number to check for value from `model`.
score: 0

http://stackoverflow.com/q/22894119
has body: What im trying to code is for a college project where I am creating an app using NetBeans, where I am adding information about players in the ryder cup. I have text fields for all the variables(team, name, dob, home, college, prof, years, matches, won, captain, pga, champion and intern) on my GUI, when I get the GUI to save and read properly I will add in all the info about all my players, then ill delete the text fields and the save button. What I want the whole page to do is when the user clicks a radio button for either team usa or team europe, all the info about the players in that team will appear. Im thinking of using labels to display each players info. So for now I am stuck on the save and read part. When I add in the info for the first player and save it, it works. But if I add in another players info, it will only read the first players info. I am not sure how to get it to save to the next array list and not on top of the first array list object. I hope I have made it clear what I am trying to do. I would greatly appreciate any help, Thank you! //my instantiable class code package rydercup; import java.io.Serializable; public class players implements Serializable { private String team; private String name; private String dob;//date of birth and age private String home;//hometown private String college; private String prof;//turned professional private String years;//years played private String matches;//total matches private String won;//total points won private String captain;//team usa captain years private String pga;//PGA tour private String champion;//champions tour victories private String intern;//international victories public players() { team = new String(); name = new String(); dob = new String(); home = new String(); college = new String(); prof = new String(); years = new String(); matches = new String(); won = new String(); captain = new String(); pga = new String(); champion = new String(); intern = new String(); } public void setTeam(String …
score: 0
tagged with: user-interface
tagged with: objectoutputstream
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34937559
tagged with: java
tagged with: fileoutputstream
has title: Writing to and reading from an ArrayList using java with NetBeans GUI
type: Question
has comment: http://stackoverflow.com/comment/34937926

http://stackoverflow.com/q/22808916
has answer: http://stackoverflow.com/a/22810824
has comment: http://stackoverflow.com/comment/34785735
has answer: http://stackoverflow.com/a/61461668
has comment: http://stackoverflow.com/comment/34784155
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34784805
type: Question
has body: I'd like to test a find rest service, if I find smth I want to delete from the database, otherwise do nothing I use it like this (where rs is the Response from find) JsonPath jsonPath = rs.getBody().jsonPath(); Object foundName= jsonPath.get("name"); if (foundName!= null) { expect().statusCode(200).when().delete("..." + foundName); } So when nothing is found how to check the foundName for it , because I tried foundName!=null or foundName != "", and still it's not working. So please explain what is the structure of an empty response body
score: 4
has comment: http://stackoverflow.com/comment/34785660
answer count: 3
tagged with: rest-assured
has comment: http://stackoverflow.com/comment/34785565
downvote count: 0
favorite count: 0
tagged with: rest
has title: Rest Assured Empty response body structure
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34783516
upvote count: 4
has answer: http://stackoverflow.com/a/22832075

http://stackoverflow.com/q/22852856
linked to: http://stackoverflow.com/q/10021579
has body: I have a program that I want to use a JFrame and 8 text areas to set the values of 8 variables. When I fill in all of the text areas, the program runs. When I leave a text area blank the program fails. I get the following error: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String Then I get a long list of what I think are the locations the error occurred? So I tried to use this if statement to say that if the text areas that set the values of x3,y3,x4,y4 were left blank, the program would still run. I have parts of the program that will handle just having 2, 3, and 4 coordinate pairs respectively. if(x3 == null &amp;&amp; y3 == null &amp;&amp; x4 == null &amp;&amp; y4 == null){ r1 = new Regression(x1,y1,x2,y2,x3,y3,x4,y4); r1.computation(); } Under x3 == null and the others I get: The operator == is undefined for the argument type(s) double, null Any ideas on how I can get the program to run without having all of the text areas filled? I'm new to Java and I'm just beginning to get comfortable with it. EDIT: Full Code Below package javaPackage; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Frame extends JFrame { private static final long serialVersionUID = 1L; public double x1; public double y1; public double x2; public double y2; public double x3; public double y3; public double x4; public double y4; public Regression r1; public Regression2 r2; public static void main(String[] args){ new Frame().setVisible(true); } public Frame(){ super("Senior Design"); setSize(600, 600); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new FlowLayout()); final JTextArea x1Test= new JTextArea (1,1); final JTextArea y1Test= new JTextArea (1,1); final JTextArea x2Test= new JTextArea (1,1); final JTextArea y2Test= new JTextArea (1,1); final JTextArea x3Test= new JTextArea (1,1); final JTextArea y3Test= new JTextArea (1,1); final JTextArea x4Test= new…
has answer: http://stackoverflow.com/a/22852975
has comment: http://stackoverflow.com/comment/34863726
score: 0
answer count: 1
tagged with: jframe
has title: JFrame, JTextArea, and Setting Variables
accepted answer: http://stackoverflow.com/a/22852975
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34862993
tagged with: java
has comment: http://stackoverflow.com/comment/34863174
type: Question
has comment: http://stackoverflow.com/comment/34863029

http://stackoverflow.com/comment/34939059
type: QuestionComment
comment on: http://stackoverflow.com/q/22889707
score: 0
has text: Glad I could help. I will post the answer shortly.
type: Comment

http://stackoverflow.com/q/22908086
has answer: http://stackoverflow.com/a/23082528
tagged with: java
has body: I need to run SoapUI test by Java. Could you please advise me useful links? And I would be happy if you can show me how to load/run tests (code examples). I also found only one link which can be applicable for my project - http://pritikaur23.wordpress.com/2013/06/16/saving-a-soapui-project-and-sending-requests-using-soapui-api/ . But when I try to do the same I faced below errors - Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(Ljava/lang/ClassLoader;Ljava/lang/String;)Lorg/apache/xmlbeans/SchemaTypeSystem; It's weird because i added all needed jar files. Also I even tried different versions of a xmlbeans. Thank in advance.
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/63199878
possible better answer: http://stackoverflow.com/a/22908852
has answer: http://stackoverflow.com/a/22908852
score: 4
accepted answer: http://stackoverflow.com/a/23082528
downvote count: 0
favorite count: 0
tagged with: soapui
has answer: http://stackoverflow.com/a/33745291
answer count: 4
has title: How to run soapUI tests from Java
type: AnsweredQuestion

http://stackoverflow.com/a/22959629
has comment: http://stackoverflow.com/comment/35055512
has comment: http://stackoverflow.com/comment/35055388
downvote count: 0
has body: Exception::throw is not valid and I can't find any related discussions in the mailing lists. However if your intent is: "to give callers the freedom to do whatever they want at the point the exceptional situation occurs", you could use a design similar to CompletableFuture and write something like: public static void main(String[] args) throws Exception { CompletableFuture.runAsync(() -&gt; somethingThatMayThrow()) .exceptionally(t -&gt; { t.printStackTrace(); return null; }); } private static void somethingThatMayThrow() throws RuntimeException { throw new RuntimeException(); } That only works with unchecked exception though.
answers question: http://stackoverflow.com/q/22959427
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/34904099
has text: A picture is worth a thousand words. Some added code would increase that ;)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22875101

http://stackoverflow.com/q/22883507
has title: Reading Notepad into array - BlueJ
tagged with: bluej
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34918345
has body: So I'm creating a program that makes random words. Now, I have a Notepad file with roughly 58000 words, all in different lines. I want the entire notepad file, each line read into an element of a dictionary array that will be used to check each word against itself, so that the words, at the least, make sense. Here is my coding so far, I'm only a beginner at Java, and use BlueJ. import java.io.*; class autosentence { public static void main() throws IOException { System.out.print('\f'); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int x = (int) (Math.random() * 10); String a[] = new String[x]; char c; int b[] = new int[3]; String str; for (int k = 0; k &lt; 1; k++) { for (int i = 0; i &lt; x; i++) { a[i] = ""; b[0] = (int) (Math.random() * 10); for (int j = 0; j &lt; b[0]; j++) { b[1] = (int) (Math.random() * 10); if (b[1] &lt; 4) { b[2] = 65; } else if (b[1] &lt; 7) { b[2] = 70; } else if (b[1] &lt; 10) { b[2] = 80; } else { b[2] = 90; } if (b[2] &lt; 90) { c = (char) ((int) ((Math.random() * 10) + b[2])); } else { c = 'Z'; } a[i] += c; } } for (int l = 0; l &lt; x; l++) { System.out.print(a[l] + " "); } str = in.readLine(); if (str.equalsIgnoreCase("y")) { str = ""; k--; } else { break; } } } }
tagged with: notepad
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34918885
tagged with: arrays
has answer: http://stackoverflow.com/a/30692756

http://stackoverflow.com/q/22901708
has comment: http://stackoverflow.com/comment/34951938
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34951354
tagged with: inheritance
score: 0
has comment: http://stackoverflow.com/comment/34951417
has body: I have a class Status that has 3 methods: getPedestrianStatusText() getGatesStatusText() getDrawBridgePositionText() (The purpose of each of these methods is to contain a String that is the status of something, and should change when a button is pressed). and I have a class FileStatus that extends Status and it access those methods as follows: public class FileStatus extends Status{ public FileStatus(){ } public void writeToFile(){ String file_text = getPedestrianStatusText() + " " + getGatesStatusText() + " " + getDrawBridgePositionText(); } } In a separate class these 3 methods are accessed and behave as expected, when a button is pressed and they are called they change as I have them programmed to. My issue is that when those methods are accessed from the FileStatus class the String returned does not change as it does when those methods are called from a different class. I suspect I have an error in my inheritance but I am not sure what the issue is. Any advice is appreciated. This is my Status class: public class Status{ public Status(){ } public String getGatesStatusText(){ //returns a string with the status of the gates if(GatesOpen){ gatesStatus="The gates are open"; } else{ gatesStatus="The gates are closed"; } return gatesStatus; } public String getDrawBridgePositionText(){ if(DrawbridgeUp){ DrawBridgeStatusText="Drawbridge is up"; } else{ DrawBridgeStatusText="Drawbridge is down"; } return DrawBridgeStatusText; } public String getPedestrianStatusText(){ return pedStatusText; } } This is a seperate class where FileStatus is called: public class MenuBar extends JMenuBar { DrawStatus draw; public MenuBar(DrawStatus d){ final FileStatus file = new FileStatus(); }); JMenuItem printStatus = new JMenuItem("Print Status"); printStatus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event){ file.writeToFile(); } }); } } Finally the last class where the functions behave as expected: public class DrawStatus extends JPanel{ S…
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35084965
has title: accessing parent methods with inheritance

http://stackoverflow.com/comment/35006740
type: Comment
comment on: http://stackoverflow.com/a/22913126
type: AnswerComment
has text: You are free to ask, upvote or accept at any time ;-)
score: 0

http://stackoverflow.com/a/22888565
upvote count: 3
answers question: http://stackoverflow.com/q/22887764
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22887764
type: AcceptedAnswer
has body: Instead of a DefaultHander, use org.xml.sax.ext.DefaultHandler2 which has the startDTD() method. Report the start of DTD declarations, if any. This method is intended to report the beginning of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked. All declarations reported through DTDHandler or DeclHandler events must appear between the startDTD and endDTD events. Declarations are assumed to belong to the internal DTD subset unless they appear between startEntity and endEntity events. Comments and processing instructions from the DTD should also be reported between the startDTD and endDTD events, in their original order of (logical) occurrence; they are not required to appear in their correct locations relative to DTDHandler or DeclHandler events, however. Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event. However, you must also set the LexicalHandler for the XML Reader. import java.io.StringReader; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.ext.DefaultHandler2; public class Problem{ public static void main(String[] args) throws Exception { String xml = "&lt;!DOCTYPE html&gt;&lt;hml&gt;&lt;img/&gt;&lt;/hml&gt;"; SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); InputSource in = new InputSource(new StringReader(xml)); DefaultHandler2 myHandler = new DefaultHandler2(){ @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { System.out.println("Element: " + qName); } @Override public void startDTD(String name, String publicId, String systemId) throws SAXException { System.out.println("DocType: " + name); } }; saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", myHandler); saxPars…
type: Answer
score: 3

http://stackoverflow.com/comment/34893352
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22869940
has text: You're calling `findarray.FindMax()`. What does your `FindMax` method expect? Basically, where should it look to find the max?
type: Comment

http://stackoverflow.com/comment/34929060
type: Comment
has text: Thank you! This helped out a ton. I'm able to work more off of this.
comment on: http://stackoverflow.com/a/22853976
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34913338
has text: -1 const is not a keyword in Java. Why would someone upvote this?
type: AnswerComment
comment on: http://stackoverflow.com/a/22880789
score: 0
type: Comment

http://stackoverflow.com/comment/35039099
has text: 1) Difference between Eclipse IDE for Java EE devs and classic Eclipse IDE: Eclipse for JavaEE devs has more plugins installed. :) 2) Never had any issues with projects when changing Eclipse versions.
type: Comment
comment on: http://stackoverflow.com/q/22950403
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34942764
comment on: http://stackoverflow.com/q/22897000
has text: You might be able to use an applet or GWT. I'd probably learn JS if I were you though.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34901500
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22873669
score: 1
has text: Another important thing: Using mutable objects as keys is generally a bad idea. If you change them, their `hashCode` changes and they won't be found (you'll see them when iterating, but "after clear" `map.containsKey(set)` would return `false`. Don't change it after storing and better don't use it as keys (consider Guava's [`ImmutableSet`](http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/ImmutableSet.html) instead).

http://stackoverflow.com/a/22915930
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22915588
type: Answer
answers question: http://stackoverflow.com/q/22915588
has body: This homework exercise means to teach you about the states on an object, and how to avoid redundancy. As I see it: the goal is to be able calculate diameter and area, and store it in the object get rid of the redundant states and calculate the values when needed The circle has one free attribue (the radius) and two derived attributes (diameter and area) which can be calculated anytime when the radius is known. That means you can just store the radius, and implement the findArea/findDiameter methods such that the result is calculated from the radius and then returned: public double findDiameter() { return radius*2; } public double findArea() { return Math.PI * radius * radius; } Note (naming conventions): the prefix get indicates that the value can be accessed locally and in an inexpensive way. When the value is expensive to be calculated or loaded, use a different prefix (that way you know about the costs when using the same value often, and can store it as an intermediate result). That's why the methods to be written in this example are prefixed by find (although I'd use a different prefix personally, that one looks like the data is retrieved by searching it, and in the concrete case here I'd consider the calcluation to be cheap enough to use a get prefix).
has comment: http://stackoverflow.com/comment/34976855

http://stackoverflow.com/q/22900060
answer count: 2
tagged with: arraylist
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/22900080
tagged with: list
tagged with: java
has body: I guess what I'm essentially asking is the difference between the order of these two operations on an ArrayList. Suppose you have the following arraylists ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; list2 = new ArrayList&lt;String&gt;(); list.add("Tom"); list.add("Jerry"); list.add(1,"Harry"); list.set(1,"Klaus"); System.out.println(list); OUTPUT [Tom, Klaus, Jerry] Then do the same thing for list2except switch the last two statements list2.add("Tom"); list2.add("Jerry"); list2.set(1,"Harry"); list2.add(1,"Klaus"); System.out.println(list2); OUTPUT [Tom, Klaus, Harry] When the value was setat some posiotionwhy does the list addan item at position+1 when you attempt to add a new item at positionas in second list. Shouldn't list2 be? [Tom, Klaus] And shouldn't listhave [Tom, Klaus]
has answer: http://stackoverflow.com/a/22900092
has title: Preference when setting and adding an item at the some position in an arraylist
type: Question

http://stackoverflow.com/a/22871027
has comment: http://stackoverflow.com/comment/34896148
has comment: http://stackoverflow.com/comment/34895750
has comment: http://stackoverflow.com/comment/34895811
has comment: http://stackoverflow.com/comment/34895637
has comment: http://stackoverflow.com/comment/34896252
has body: You shouldn't compare floating point numbers with ==. Rounding errors in floating-point operations mean that you should choose a precision EPSILON (adequated to your case) and use it like this: const float EPSILON = 0.00001; if( fabs(cosTheta - 1) &lt; EPSILON ) { cout &lt;&lt; "It is approximately 1\n"; }
has comment: http://stackoverflow.com/comment/34896114
type: Answer
has comment: http://stackoverflow.com/comment/34895901
upvote count: 2
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/22870919

http://stackoverflow.com/a/22896171
answers question: http://stackoverflow.com/q/22895941
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22895941
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34941228
type: Answer
has body: basically it works like this https://xkcd.com/327/ what I do is assuming, that everything a user inputs is a threat, so I would save everything to variables like usUsername, where "us" means unsafe. After that I check every "us"-variable for injections, what results in sUsername (s means safe). So when I build a query I can only use s-varaibles and should be safe in most cases. This idea is totally taken from here: http://www.joelonsoftware.com/articles/Wrong.html

http://stackoverflow.com/comment/35029903
comment on: http://stackoverflow.com/a/22935924
has text: See Orphan Removal: http://en.wikibooks.org/wiki/Java_Persistence/Relationships#Orphan_Removal_.28JPA_2.0.29
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34829891
score: 0
type: Comment
has text: Yes, Or you could create an array in the normal way like to say `String[] names = new String[3];` then add values like `names[0] = "Joe";` and so on, then pass the `names` as argument like : `p1.makePerson(names, ints);`
comment on: http://stackoverflow.com/a/22834526
type: AnswerComment

http://stackoverflow.com/comment/35020921
score: 1
comment on: http://stackoverflow.com/q/22940216
type: QuestionComment
has text: Maybe because you didn't send a line?
type: Comment

http://stackoverflow.com/a/22896724
type: Answer
upvote count: 2
score: 2
has body: An int can never be null as it is a primitive data type, hence b !=null is uncomputable. If you are using the Scanner class's nextInt() command, this will always return an integer value (or cause a runtime exception if the user does not enter an int)
downvote count: 0
answers question: http://stackoverflow.com/q/22896662

http://stackoverflow.com/a/22909156
has body: Try doing it in that way. private Button next = null; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); next = (Button) findViewById(R.id.LinearLayout1); final Button button = (Button) findViewById(R.id.LinearLayout1); button.setText("" + res.getString(R.string.News) + "\n\n" + res.getString(R.string.Story_Title_1) + "\n\n" + res.getString(R.string.Story_Title_2) + "\n\n" + res.getString(R.string.Story_Title_3) + "\n\n" + res.getString(R.string.Story_Title_4) + "\n\n" + res.getString(R.string.Story_Title_5)); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { OpenNews(); } });
score: 0
answers question: http://stackoverflow.com/q/22909099
type: Answer

http://stackoverflow.com/comment/34853724
has text: Show an user-friendly error message saying that there are connectivity problems or similar.
comment on: http://stackoverflow.com/q/22847853
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22850673
has comment: http://stackoverflow.com/comment/34861177
has body: Within the past few days google is forcing the use of the Google Play Services Mobile ads as the next version of android adMob. Im completely new to admob and am trying to test ads in my libGDX android game, but cant figure out how to do it because I get a rediculous amount of errors no matter what i do. I HAVE LOOKED AT OTHER EXAMPLES, but they are all for adMob 6.4.1(or earlier) which is now considered legacy. I just want an ad banner at the bottom of the screen but cant figure out how to do it. Could someone please post what my android MainActivity would need to be as well as anything I need to do to the manifest and xml. It NEEDS to work with libGDX and however the view system would cooperate with that Thank you very much!
tagged with: google-play-services
possible better answer: http://stackoverflow.com/a/22854252
accepted answer: http://stackoverflow.com/a/22853739
answer count: 3
has answer: http://stackoverflow.com/a/22854252
downvote count: 0
favorite count: 0
upvote count: 2
tagged with: android
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22862728
has answer: http://stackoverflow.com/a/22853739
tagged with: java
tagged with: admob
type: Question
has title: AdMob libGDX with Google Play services
tagged with: libgdx

http://stackoverflow.com/a/22926994
answers question: http://stackoverflow.com/q/22926858
score: 0
has body: Consider replacing each instance of this if(board[0][0] =='X' &amp;&amp; board[0][1] =='X' &amp;&amp; board[0][2] =='X') || ... With this function: public boolean isRowFilledWith(int row_index, char x_or_o) { return (board[row_idx][0] == x_or_o &amp;&amp; board[row_idx][1] == x_or_o &amp;&amp; board[row_idx][2] == x_or_o); } Now, to see if the top-most row contains all x-s, call it with if(isRowFilledWith(0, 'X') || ... This will make your code a lot more concise, easier to read and easier to debug.
type: Answer

http://stackoverflow.com/q/22909288
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2874743
tagged with: android
downvote count: 0
score: 1
tagged with: java
has title: Change volume key function in android app
type: Question
has body: I have source code for SmartMouse android app. I want to alter the function of volume keys with the onscreen buttons. I have basic knowledge for C programming but don't know java. What part should I search for in the code? This might be a lame question but I badly need this.
has answer: http://stackoverflow.com/a/22909336

http://stackoverflow.com/q/22836633
has comment: http://stackoverflow.com/comment/34832963
has comment: http://stackoverflow.com/comment/34832961
favorite count: 0
has title: Arraylist index calculation java
downvote count: 7
accepted answer: http://stackoverflow.com/a/22836869
has body: I have array list that each indexes has value either 0 or 1.I want to find that continuously three indexes has the value 1.How do I find it?
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: continuous
upvote count: 0
score: -7
has comment: http://stackoverflow.com/comment/34832970
tagged with: arraylist
has answer: http://stackoverflow.com/a/22836869
answer count: 1

http://stackoverflow.com/q/22909052
answer count: 3
tagged with: user-interface
downvote count: 1
has comment: http://stackoverflow.com/comment/34964101
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/34964053
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23280579
upvote count: 0
has answer: http://stackoverflow.com/a/22909564
tagged with: java
has body: Is there any Java GUI available to develop java programs without typing single line of java code and using GUI mode?
type: Question
has comment: http://stackoverflow.com/comment/34964451
tagged with: javascript
has comment: http://stackoverflow.com/comment/34964246
score: -1
has answer: http://stackoverflow.com/a/22909462
tagged with: eclipse
has title: Java Program GUI to develop java Programs without typing coding

http://stackoverflow.com/q/22960319
type: Question
has title: WAR Dependency for maven
answer count: 1
score: 0
has body: I have a project with &lt;packaging&gt; as WAR. I want to add this project as a dependency in another project. I've done bit digging on some threads like Maven WAR dependency But nothing works for me. Any help would be really appreciated.
tagged with: dependencies
linked to: http://stackoverflow.com/q/1769586
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22962421
tagged with: maven
tagged with: war
has comment: http://stackoverflow.com/comment/35056542
tagged with: java

http://stackoverflow.com/comment/35166098
score: 0
has text: Can you post your java code making the connection, and a complete stack trace? You can either edit this question or create a new question.
type: Comment
comment on: http://stackoverflow.com/a/22951968
type: AnswerComment

http://stackoverflow.com/comment/34975998
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22874175
type: Comment
has text: @Azee Thanks for the feedback. I am thinking about adding `dependencies` or something similar to the plugin config. I agree that `plugins` is confusing.

http://stackoverflow.com/a/22885433
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22885231
answers question: http://stackoverflow.com/q/22885231
type: Answer
has body: It looks like you're asking how to store a Vector&lt;String&gt; in a byte array. This sounds weird, so maybe I've interpreted it wrong. Vectors are serializable. You can use an ObjectOutputStream to write them to an output stream. ByteArrayOutputStream implements an OutputStream that writes to memory. It has a method toByteArray() that you can call to get its contents as a byte array. That should be enough to solve this problem. edit: maybe also some System.arraycopy if you need it to go in the data argument... again, weird.

http://stackoverflow.com/q/22868074
upvote count: 1
has body: I'm concerned about this construct: String out = "Text " + (obj==null ? "" : obj.getStr()+" ") + "text continues."; It works and all, but I think it's ugly. Maybe I'm just too picky.. Anyway, I'm asking, is there some nicer way to do this kind of stuff? Or is this the generally accepted technique?
tagged with: styles
has title: Ternary operator for strings - any nicer way?
type: AnsweredQuestion
tagged with: syntax
tagged with: java
accepted answer: http://stackoverflow.com/a/22868108
has answer: http://stackoverflow.com/a/22868218
has answer: http://stackoverflow.com/a/22868118
type: Question
has comment: http://stackoverflow.com/comment/34889995
has comment: http://stackoverflow.com/comment/34890178
downvote count: 0
has comment: http://stackoverflow.com/comment/34890119
has comment: http://stackoverflow.com/comment/34890012
possible better answer: http://stackoverflow.com/a/22868131
has comment: http://stackoverflow.com/comment/34890133
score: 1
has answer: http://stackoverflow.com/a/22868108
answer count: 4
has answer: http://stackoverflow.com/a/22868131
favorite count: 0

http://stackoverflow.com/comment/34890575
has text: Removing allocationSize and initialValue has no effect.
score: 0
comment on: http://stackoverflow.com/q/22866527
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22869218
type: UnansweredQuestion
type: Question
has body: Per Amazon's developer guide one should set the network cache TTL either in the file java.security via (to set to 60 seconds) networkaddress.cache.ttl=60 or programmatically via java.security.Security.setProperty("networkaddress.cache.ttl" , "60"); My question is if it's safe to change the TTL after the code is already running. AWS's guide specifies nothing to this effect. Must this property bet set before the first DNS lookup? any time after the program is running and it will take effect? Etc. Oracle's documentation defines the property but does not seem to specify how to set it safely. Only way I can think to research fully is to read the source code surrounding this value, but there really should be better documentation somewhere. Still searching.
has answer: http://stackoverflow.com/a/22869415
answer count: 1
has title: Okay to set Java's network cache after program is running?
score: 0
tagged with: java
tagged with: caching
tagged with: network-programming

http://stackoverflow.com/q/22939629
type: Question
answer count: 1
score: 0
tagged with: orika
has answer: http://stackoverflow.com/a/22946668
tagged with: dozer
has title: Can Geda hook right into Spring Conversion Service?
type: UnansweredQuestion
tagged with: spring
tagged with: java
has body: Like Dozer or Orika, can Geda be hooked into the Spring Conversion Service? I want the ability to have the abstraction of bean mappers and our code looks like the following: @Service public class TestDAOImpl { @Autowired private ConversionService conversionService; @Autowired private ITestService service; public EntityDTO save(final EntityDTO entityDTO) { // Can Geda be abstracted like this? Currently using Dozer underneath // Converts our DTO to the database entity Entity entity = conversionService.convert(entityDTO, Entity.class); entity = service.save(entity); return conversionService.convert(entity, EntityDTO.class); } } Currently I am using Dozer but it is too slow when dealing with large collections. I tested Orika and it was a lot faster but was slower than Dozer with small collections. I heard Geda was faster than both Dozer and Orika, but my only concern is I am not sure if it can be abstracted like Dozer and Orika as shown in the pseudocode above.

http://stackoverflow.com/q/22845513
type: Question
type: AnsweredQuestion
tagged with: java
answer count: 1
tagged with: lucene
has title: Determine which parameter failed in a Lucene BooleanQuery?
score: 0
has body: I need to determine which part of a Lucene BooleanQuery failed if the entire query returns no results. I'm using a BooleanQuery made up of 4 NumericRangeQueries and a PhraseQuery. Each is added to the query with Occur.MUST. If I don't get any results for a query, is there a way to tell which part of the query failed to match anything? Do I need to run queries individually and compare results to get the one that failed? Edit - Added PhraseQuery code. if( row.getPropertykey_tx() != null &amp;&amp; !row.getPropertykey_tx().trim().isEmpty()){ PhraseQuery pQuery = new PhraseQuery(); String[] words = row.getPropertykey_tx().trim().split(" "); for( String word : words ){ pQuery.add(new Term(TitleRecordColumns.SA_SITE_ADDR.toString(), word)); } pQuery.setSlop(2); topBQuery.add(pQuery, BooleanClause.Occur.MUST); }
has answer: http://stackoverflow.com/a/22846261
accepted answer: http://stackoverflow.com/a/22846261

http://stackoverflow.com/q/22892522
score: -6
favorite count: 0
has body: Consider the sequence of digits from 1 through N (N&lt;=9) in increasing order: 1 2 3 4 … N Insert either a ‘+’ (for addition) or a ‘-‘ (for subtraction) between each of the digits so that the resultant sum is zero. Print all possible combinations that sum to zero.
type: UnansweredQuestion
upvote count: 0
tagged with: java
has title: possible combination in binary counting
has comment: http://stackoverflow.com/comment/34934555
type: Question
has answer: http://stackoverflow.com/a/25292186
has answer: http://stackoverflow.com/a/22892574
downvote count: 6
answer count: 2
has comment: http://stackoverflow.com/comment/34934416

http://stackoverflow.com/comment/34952333
type: AnswerComment
type: Comment
has text: This is the better answer if you have multiple subclass of Customer in the list.
comment on: http://stackoverflow.com/a/22902304
score: 0

http://stackoverflow.com/a/23235907
accepted answer of: http://stackoverflow.com/q/22837730
has body: What seems to have fixed the problem was to exclude the executables of the DEP (Data Execution Prevention) in Windows (System-> Advanced ->(Performance) Settings -> Performance Options). We had turned on "Turn on DEP for all programs and services except those I select" and had to add those programs to the DEP. No reported crashes for a week now. So I will add this as answer and update if anything changes.
answers question: http://stackoverflow.com/q/22837730
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/q/22831529
tagged with: android
has comment: http://stackoverflow.com/comment/34824484
has answer: http://stackoverflow.com/a/22831919
has comment: http://stackoverflow.com/comment/34824471
score: 0
has comment: http://stackoverflow.com/comment/34824497
has body: I have been working with Android for a while now , but recently something new came up . I am supposed to make a Calendar. There is a default CalendarView View however it is drastically different from the Calendar that my client wants . Now I embarked upon the "Create your custom view " tutorials on the internet. I found out either I could extend something that existed , or extend View . I extended View . My motive was to start with the basics that is draw the grid of buttons that would represent days of the month, upon clicking which the user would be navigated to a different page . Here is where I reached a deadend. I know that onDraw is used to create the visual of a view. However we have to use the Canvas class. How can I include a android.widget.Button, as a part of layout in the onDraw method ? Or have I completely gone rouge and am following an incorrect way ? Please aid me. Thanks
answer count: 1
has comment: http://stackoverflow.com/comment/34824514
tagged with: java
has title: Implementing a custom view in android
has comment: http://stackoverflow.com/comment/34824394
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/22965425
has body: That piece of configuration is defining a list of line tokenizers that match exact patterns. See below the explanation from the Spring Batch API itself: A LineTokenizer implementation that stores a mapping of String patterns to delegate LineTokenizers. Each line tokenizied will be checked to see if it matches a pattern. If the line matches a key in the map of delegates, then the corresponding delegate LineTokenizer will be used. Patterns are sorted starting with the most specific, and the first match succeeds. I was saying above that matches exact patterns, because each key doesn't contain any special character ('*' or '?'), so a line in a file will match if it is exactly "10" or "20" (as a String). If a line that is exactly "10" matches it will be handed over to the LineTokenizer "recordType10". But, I doubt the author wanted that example, because in his blog there is another entry that describes a migration to Spring Batch 2.1 where the sample code contains patterns as "10*" and "20*" which make more sense. "10*" means 'starts with 10', "20*" means 'starts with 20'.
has comment: http://stackoverflow.com/comment/35094986
upvote count: 1
answers question: http://stackoverflow.com/q/22960263
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35089632

http://stackoverflow.com/comment/34945678
comment on: http://stackoverflow.com/q/22898484
type: Comment
has text: You could write what type of error you get or the exception
score: 1
type: QuestionComment

http://stackoverflow.com/q/22838103
has title: Getting error 503 after adding listener class in web.xml
has comment: http://stackoverflow.com/comment/34835587
tagged with: listener
tagged with: web.xml
score: 0
accepted answer: http://stackoverflow.com/a/22840353
tagged with: jetty
tagged with: spring
type: AnsweredQuestion
tagged with: java
has body: I am using Jetty server and I want to put one check at the time of server start. For that I have created one listener class and put its entry in web.xml as per following: Listener Class: public class LicenseCheck extends ContextLoaderListener { private static final Logger log = Logger.getLogger(LicenseCheck.class); public LicenseCheck() { log.info("Checking license"); } } Web.xml: <?xml version="1.0" encoding="UTF-8"?> contextConfigLocation classpath:applicationContext.xml org.springframework.web.context.ContextLoaderListener com.license.LicenseCheck index.html But after adding this, my application cannot start and its throwing following exception: HTTP ERROR: 503 Problem accessing /. Reason: Service Unavailable Powered by Jetty:// If I remove the listener's entry from web.xml it works fine. Please provide solution for this.
type: Question
has answer: http://stackoverflow.com/a/22846264
answer count: 2
has answer: http://stackoverflow.com/a/22840353
possible better answer: http://stackoverflow.com/a/22846264

http://stackoverflow.com/q/22818252
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34803809
has body: I'm trying to unmarshal a (well-formed) part of a xml string using the "partial jaxb unmarshaling" technique, described in the answer of this question. For this I'm using a subset of a JAXB domain models (which have been created by xjc) of the corresponding XML schema. This subset corresponds exactly to the part xml string which the XMLStreamReader processes. After ensuring that the XMLStreamReader position is correct (which is in fact the first element), I'm invoking Unmarshaller unmarshaller = JAXBContext.newInstance(jaxbModelClass) .createUnmarshaller(); return unmarshaller.unmarshal(xsr, jaxbModelClass).getValue(); This is done without any exception and the returned object is indeed an instance of jaxbModelClass, however it's not containing any child elements (all are set to null). What is the cause of this?
tagged with: java
tagged with: jaxb
answer count: 1
has comment: http://stackoverflow.com/comment/34874126
type: UnansweredQuestion
has title: JAXB: partial unmarshalling returns empty domain object
tagged with: unmarshalling
has comment: http://stackoverflow.com/comment/34834257
tagged with: xml-parsing
has answer: http://stackoverflow.com/a/22859383
score: 2

http://stackoverflow.com/comment/34815210
has text: +1 for the writing out of the recursion steps.
comment on: http://stackoverflow.com/q/22826334
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34873681
type: Comment
score: 0
type: AnswerComment
has text: I just added extra code to your logic. You need to load properties as per your code and then shuffle the array elements for randomization.
comment on: http://stackoverflow.com/a/22858243

http://stackoverflow.com/a/22898463
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22897696
accepted answer of: http://stackoverflow.com/q/22897696
has body: To solve this problem I did the following. When adding the button to the table, I used the following Code. table.add(button).height(HEIGHT).width(WIDTH); This did not solve the mentioned issue, but it allowed me to explicitly set the desired width and height of the button, which played a part in solving the actual issue. When creating the button, the button, being an extension of Cell, I used to add() function to re-position the text. button = new TextButton("button", style); button.add(button.getLabel()).padBottom(CONSTANT); combined with the Cell.height() function, I was able to use a constant padding variable to position the button's text (or label) in the middle of the button.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/55572563

http://stackoverflow.com/comment/35074058
score: 0
comment on: http://stackoverflow.com/q/22949086
has text: But you said the SQL returned a row value in the database console, therefore `BETWEEN` can't be the cause of the problem.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22900021
has comment: http://stackoverflow.com/comment/34957610
type: Answer
has comment: http://stackoverflow.com/comment/34948316
has body: In this code: if (((Comparable&lt;E&gt;)node.element).compareTo((E)current) &lt; 0) { You are comparing the element at node with current. But current is a TreeNode, not the element stored there. You probably need: if (((Comparable&lt;E&gt;)node.element).compareTo(current.element) &lt; 0) {
has comment: http://stackoverflow.com/comment/34948299
has comment: http://stackoverflow.com/comment/34948786
answers question: http://stackoverflow.com/q/22899952
score: 0
has comment: http://stackoverflow.com/comment/34958004

http://stackoverflow.com/a/22912715
upvote count: 1
type: Answer
has body: When you want to schedule something to happen at regular intervals, you can use a java.util.Timer with one or more java.util.TimerTasks. But whether you use timers or implement your own time scheduling with your own threads, you need some way to communicate from your Threads/TimerTasks with the objects in your main thread. You can implement this by passing these objects to these threads and then call methods on them in your run-method. But keep in mind that you have no control over what the main thread is doing when that method is called from the sub-thread. It might happen from time to time that the sub-thread changes a value while the main-thread is currently performing some operation with it. This can lead to strange bugs commonly referred to as race conditions. Take this example: class ValueList { private List&lt;Integer&gt; values = new ArrayList&lt;&gt;(); // this method may be called from many different threads to add values public void add(Integer i) { values.add(i); } // this method is called from the main thread to update the GUI public int getAverage() { int sum = 0; for (Integer i: values) { sum += i; } // Imagine a thread calls add(Integer) when the main threads // execution is exactly here! // the average will be too low because the new value was // not yet counted for the sum, but is now accounted for // when calculating the average from the sum. return sum / values.size(); } } To prevent this from happening, familiarize yourself with the various synchronization features offered by Java.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22912406

http://stackoverflow.com/a/22830467
has body: You might be able to adjust OptaPlanner for this. Call your business logic in a SimpleScoreCalculator and wrap the returned scalar in a Score instance. Make sure you use at least 6.1.0.Beta2 as that supports IntValueRange and DoubleValueRange. As for optimization algorithms: if the variables are few, integer and small in range, "Branch And Bound" can work, guaranteeing you the optimal solution (but much faster than Brute Force). Otherwise, you'll need to go with a limited selection Construction Heuristic followed by Local Search with custom Move implementations.
answers question: http://stackoverflow.com/q/22829453
type: Answer
score: 0

http://stackoverflow.com/a/22901432
has comment: http://stackoverflow.com/comment/35006155
has comment: http://stackoverflow.com/comment/35002435
type: Answer
has body: LList&lt;T extends Comparable&gt; so LList accepts only classes that extends Comparable as type parameter. LList &lt;LList&lt;Integer&gt;&gt; subArrsList = new LList &lt;LList&lt;Integer&gt;&gt;(); in this statement you are giving LList&lt;Integer&gt; class as type parameter. LList&lt;Integer&gt; does not extend Comparable. Integer extends comparable but you are not using the Integer class as type parameter, You are using LList which does not extends Comparable. So you are getting an error. Change your LList class as follows: public class LList &lt;T extends Comparable &lt;T&gt;&gt; implements Comparable&lt;LList&lt;T&gt;&gt;{ @Override public int compareTo(LList&lt;T&gt; list) { //to do } ...// your code }
has comment: http://stackoverflow.com/comment/34951304
accepted answer of: http://stackoverflow.com/q/22901375
has comment: http://stackoverflow.com/comment/35007444
has comment: http://stackoverflow.com/comment/34999626
answers question: http://stackoverflow.com/q/22901375
score: 0
upvote count: 1
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/35006122

http://stackoverflow.com/comment/35060195
type: Comment
type: QuestionComment
has text: Could you share the exact compiler error you're getting?
score: 1
comment on: http://stackoverflow.com/q/22962484

http://stackoverflow.com/a/22815167
has body: I'd bet that your variable klantenBindingRef is never initialized.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22815047

http://stackoverflow.com/a/33547873
has comment: http://stackoverflow.com/comment/117543238
answers question: http://stackoverflow.com/q/22822512
has comment: http://stackoverflow.com/comment/117543092
upvote count: 13
has comment: http://stackoverflow.com/comment/54877917
has body: Just a small addition to Jeff Bowman's excellent answer, as I found this question when searching for a solution to one of my own problems: If a call to a method matches more than one mock's when trained calls, the order of the when calls is important, and should be from the most wider to the most specific. Starting from one of Jeff's examples: when(foo.quux(anyInt(), anyInt())).thenReturn(true); when(foo.quux(anyInt(), eq(5))).thenReturn(false); is the order that ensures the (probably) desired result: foo.quux(3 /*any int*/, 8 /*any other int than 5*/) //returns true foo.quux(2 /*any int*/, 5) //returns false If you inverse the when calls then the result would always be true.
has comment: http://stackoverflow.com/comment/54878479
type: Answer
downvote count: 0
score: 13

http://stackoverflow.com/a/22889779
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22889560
has comment: http://stackoverflow.com/comment/34929866
has body: I think this whole questions probably boils down to you not understanding Java's pass-by-value semantics. public static void main(String[] args) { int t = 10; test(t); System.out.println(t); } public static void test(int i) { i = 15; } So, in this case, how could I modify the t variable with the test() method? short of t = test(t); with test returning 15? The simple answer is you can't. You cannot write a method that will modify the value of a local variable in another method. It is simply not possible in Java. And that is why we insist on saying that Java parameter passing is "pass-by-value". So back to your original question, given this: bufferedImageObject.getRGB(int, int, int, int, int[], int, int); Question: how does getRGB return the values in the array parameter? Answer: it copies the pixel values from the image into the array. Question: how is that (still) pass-by-value? Answer: the parameter being passed (by value!!) is the reference to the array. The getRGB is modifying the array. But it is not modifying the array reference. I tried doing that in a test program, but nothing changed. I would need to >>see&lt;&lt; that test program before I could explain that. But I'd bet money that the explanation was consistent with what I've written above.
has comment: http://stackoverflow.com/comment/34942038
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34929883
type: Answer
has comment: http://stackoverflow.com/comment/34963226
score: 3
has comment: http://stackoverflow.com/comment/34929689
upvote count: 3
has comment: http://stackoverflow.com/comment/34929792
answers question: http://stackoverflow.com/q/22889560

http://stackoverflow.com/a/22965041
has comment: http://stackoverflow.com/comment/35065838
answers question: http://stackoverflow.com/q/22964880
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35066658
downvote count: 0
has comment: http://stackoverflow.com/comment/35066518
accepted answer of: http://stackoverflow.com/q/22964880
has comment: http://stackoverflow.com/comment/35066065
type: Answer
upvote count: 4
has body: Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.nio.SelectChannelConnector So right now SimpleJMX has an optional dependency for 8.1.9.v20130131 Jetty to support publishing JMX over web/HTTP. If you check out the pom.xml you'll see: 8.1.9.v20130131 ... org.eclipse.jetty jetty-server ${jetty-version} true Can you try this version of Jetty? I'm not sure there is a way for me to support both 8.X.X and 9.X.X but I'll look into it.
has comment: http://stackoverflow.com/comment/35065631
score: 4

http://stackoverflow.com/q/22927055
type: Question
tagged with: for-loop
has title: Add buttons to FlowPane (JavaFX) via for loop
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22940771
accepted answer: http://stackoverflow.com/a/22940771
type: AnsweredQuestion
tagged with: fxml
tagged with: java
tagged with: javafx
has body: I have attempted multiple times to add buttons to a FlowPane via a for loop. However, when the loop is run in my start method, the buttons fail to be rendered. I have proivided my code for the controller class and the fxml layout file I have used. Here is my code for the controller: package dimension.audio.player; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.ResourceBundle; import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.MapChangeListener; import javafx.collections.ObservableMap; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.geometry.Orientation; import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ButtonBuilder; import javafx.scene.control.ScrollPane; import javafx.scene.control.Tooltip; import javafx.scene.image.Image; import javafx.scene.input.MouseButton; import javafx.scene.input.MouseEvent; import javafx.scene.layout.BorderPane; import javafx.scene.layout.FlowPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.Pane; import javafx.scene.media.Media; import javafx.stage.Stage; public class MediaViewer extends Application{ ArrayList<String> list; File directory; Button lab; ArrayList<String> tagged = new ArrayList<String>(); @FXML BorderPane layout = new BorderPane(); @FXML FlowPane butLayout = new FlowPane(Orientation.HORIZONTAL); @FXML GridPane searchLayout; @SuppressWa…

http://stackoverflow.com/comment/34812930
comment on: http://stackoverflow.com/q/22825018
has text: Two warnings: always use curly braces, and ```System.out``` only gets flushed on newlines, so your "Enter score for...." might not be getting flushed. You should do ```System.out.flush()``` to do that.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34874475
score: 0
comment on: http://stackoverflow.com/q/22858497
type: QuestionComment
has text: Why did you remove your `catch` clauses? Your code example doesn't compile.
type: Comment

http://stackoverflow.com/comment/34911600
type: Comment
comment on: http://stackoverflow.com/a/22877216
score: 0
type: AnswerComment
has text: If you use an Iterator explicitly, it will also throw the exception. Try it and see.

http://stackoverflow.com/comment/34827218
type: QuestionComment
has text: @MarounMaroun sorry it was I who tagged it with 'java' -) Now I'm start thinking if I made a mistake or not
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22833047

http://stackoverflow.com/comment/35008440
comment on: http://stackoverflow.com/q/22933493
type: Comment
has text: Use this code: http://nelenkov.blogspot.de/2011/12/using-custom-certificate-trust-store-on.html
score: 0
type: QuestionComment

http://stackoverflow.com/a/22876438
answers question: http://stackoverflow.com/q/22876412
has body: Case no. 2 is only assigning phonesContainerOne to phonesContainerTwo. I.e, They are now pointing to the same object. If you edit phonesContainerTwo content, phonesContainerOne will be also changed.
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34905933
type: Answer
upvote count: 3

http://stackoverflow.com/comment/34797789
comment on: http://stackoverflow.com/a/22816523
score: 0
type: Comment
has text: This test returns a List with objects of `Person` (`List<Person>`). Cannot see why this is a poor test.
type: AnswerComment

http://stackoverflow.com/a/46186579
upvote count: 1
has body: I did a sample app with an array of fruits For MainActivity listView.setOnItemClickListener(new ListView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) { String fruit = String.valueOf(adapterView.getItemAtPosition(i)); Toast.makeText(MainActivity.this, fruit, Toast.LENGTH_LONG).show(); Intent intent = new Intent(MainActivity.this, SecondActivity.class); intent.putExtra("fruit", fruit); startActivity(intent); } }); For SecondActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); TextView fruitName = (TextView)findViewById(R.id.myTextView); Intent intent = getIntent(); String fruit = intent.getStringExtra("fruit"); fruitName.setText(fruit); Toast.makeText(SecondActivity.this, fruit, Toast.LENGTH_LONG).show(); } So instead of using getText() method, try to get the item at the position of your adapter and store that to a String. Hope this help.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22863365

http://stackoverflow.com/a/22897368
has body: It doesn't seem like much of anything happens when you just enter a carriage return with Scanner#next. The Javadoc mandates that it only matches on a complete token with its delimiter. The default delimiter for Scanner is \p{javaWhitespace}+. In essence, it describes a whole token as having at least one whitespace character in it. Now, let's inspect the empty String. It doesn't contain any character in it. So, if we were going to match against the default delimiter regex, we would fail: Scanner sc = new Scanner(System.in); Pattern ptn = sc.delimiter(); System.out.println(ptn); String empty = ""; String regex = "\\p{javaWhitespace}+"; System.out.println(empty.matches(regex)); // prints false So, the pattern doesn't match, and the Scanner will block until it matches something, like A phrase. So, instead of trying to deal with any headache that may be induced from next(), what you may be looking to use instead is nextLine(). In most cases, you want to use nextLine() when you want to match the entire line of entry, and next() when you're processing multiple elements in a single line. String userChoice = this.sc.nextLine(); // wherever this Scanner instance lives... This will match on anything containing a line separator, and since hitting return/enter will produce that, it will match the entire line you enter, even if it's a blank line.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22897172
downvote count: 0
score: 1

http://stackoverflow.com/a/23448119
type: AcceptedAnswer
downvote count: 0
has body: i think this example defiantly help full to you this is the example of the hooks system calls Global Keyboard Listener import org.jnativehook.GlobalScreen; import org.jnativehook.NativeHookException; import org.jnativehook.keyboard.NativeKeyEvent; import org.jnativehook.keyboard.NativeKeyListener; public class GlobalKeyListenerExample implements NativeKeyListener { public void nativeKeyPressed(NativeKeyEvent e) { System.out.println("Key Pressed: " + NativeKeyEvent.getKeyText(e.getKeyCode())); if (e.getKeyCode() == NativeKeyEvent.VK_ESCAPE) { GlobalScreen.unregisterNativeHook(); } } public void nativeKeyReleased(NativeKeyEvent e) { System.out.println("Key Released: " + NativeKeyEvent.getKeyText(e.getKeyCode())); } public void nativeKeyTyped(NativeKeyEvent e) { System.out.println("Key Typed: " + e.getKeyText(e.getKeyCode())); } public static void main(String[] args) { try { GlobalScreen.registerNativeHook(); } catch (NativeHookException ex) { System.err.println("There was a problem registering the native hook."); System.err.println(ex.getMessage()); System.exit(1); } //Construct the example object and initialze native hook. GlobalScreen.getInstance().addNativeKeyListener(new GlobalKeyListenerExample()); } }
type: Answer
accepted answer of: http://stackoverflow.com/q/22955770
upvote count: 4
answers question: http://stackoverflow.com/q/22955770
score: 4

http://stackoverflow.com/a/50521112
type: Answer
score: 1
upvote count: 1
has body: in jGrasp, the option is under the Settings menu item. Go to Settings-> File/Workspace/Project (pick whichever is applicable to you), and then on the Compiler tag, pick the Flags/Args tab, and then click the box next to Compile and enter -Xlint:unchecked into the text box. Click apply, and on your next build, you will get the messages on what was unchecked. As others have pointed out, this warning is raised because you are using a raw form of a generic class rather than providing a type parameter to it. -Xlint:unchecked will show you where in your code you did that.
answers question: http://stackoverflow.com/q/22875001
downvote count: 0

http://stackoverflow.com/q/22931322
has comment: http://stackoverflow.com/comment/35005095
has comment: http://stackoverflow.com/comment/35005212
has comment: http://stackoverflow.com/comment/35005865
favorite count: 0
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/22933267
has body: I have set the following properties:- Set environment variables JAVA_HOME,path,ANT_HOME,path (using JDK version --> jdk1.7.0_40) In Eclipse set the system Library, added all needed jars and select all jars in Order and Export. Install the Firefox Version 24 and used the Selenium jar(selenium-server-standalone-2.41.0). Giving no error while running the Java application, also no exception while not able to click on particular element. sendKeys(Keys.ENTER) is working fine, but instead I need to use click() method. Also code is working fine on other systems, I think I am missing something. click() method is not giving any valid response, it makes me feel like its only declared not defined. I have tried on different websites, on different elements and with different types(xpath, css selector, name, id) but nothing worked for me. I took focus on that element by webdriver and also by highlighting the element using javascript code, its showing that particular element is present. I have performed other operations like entering username after clicking on that element, its performing well. I have worked with different browsers, different webpages also maximize the window using selenium but no positive response. Any help will appreciate. Thanks in advance
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/35004870
type: Question
score: 1
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35005069
has title: While working with Selenium WebDriver and Java I am not able to use click() function of WebDriver (giving no exception)
answer count: 1
downvote count: 0

oop
tags question: http://stackoverflow.com/q/22964415
tags question: http://stackoverflow.com/q/22962856
tags question: http://stackoverflow.com/q/22846484
tags question: http://stackoverflow.com/q/22881974
tags question: http://stackoverflow.com/q/22924223
tags question: http://stackoverflow.com/q/22920521
tags question: http://stackoverflow.com/q/22898062
tags question: http://stackoverflow.com/q/22852474
tag name: oop
tags question: http://stackoverflow.com/q/22853167
tags question: http://stackoverflow.com/q/22839264
tags question: http://stackoverflow.com/q/22858938
tags question: http://stackoverflow.com/q/22939673
tags question: http://stackoverflow.com/q/22933292
tags question: http://stackoverflow.com/q/22813318
tags question: http://stackoverflow.com/q/22888681
tags question: http://stackoverflow.com/q/22828547
tags question: http://stackoverflow.com/q/22876139
tags question: http://stackoverflow.com/q/22858123
tags question: http://stackoverflow.com/q/22915621
tags question: http://stackoverflow.com/q/22949753
tags question: http://stackoverflow.com/q/22843783
tags question: http://stackoverflow.com/q/22946395
tags question: http://stackoverflow.com/q/22899028
tags question: http://stackoverflow.com/q/22871773
tags question: http://stackoverflow.com/q/22831502
type: Tag

http://stackoverflow.com/q/22815897
has title: Show popup at the start if file is missing
score: 0
answer count: 3
has body: I am creating a small GUI java application that it will store some user credentials in a file. If the file is missing or has the wrong properties then I want a pop to get brought up that will inform the user to register his credentials (so a new file can be created with the proper ones). I have nailed down the logic of when the file is incorrect and/or missing but what I can't figure out (due to my inexperience with JFrame) is where exactly in the code to check if the user needs to enter his credentials so he can be prompted. Let's say that the function showWarning() is the one that will check and display the popup if needed and this is my main JFrame function (this was generated from Netbeans mostly): public static void main(String args[]) { /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new GUI().setVisible(true); } }); } Do I put the showWarning() function inside the main function? If yes, do I put it right after new GUI().setVisible(true);? What is the proper way of doing this? EDIT: I am stumbling to the same problem I did before. This is my showWarning() that I drafted quickly for testing purposes: public void showWarning(){ File propertiesFile = new File("config.properties"); if (propertiesFile.exists() &amp;&amp; propertiesExist(propertiesFile)) { JOptionPane.showMessageDialog(rootPane, "Creds are ok"); } else { JOptionPane.showMessageDialog(rootPane, "Creds are not ok"); } } The problem that I am having is that I can't make this method static in order to use it without an object because of the rootPane which is a non-static object. The problem that this caused is that I can't just write: public static void main(String args[]) { /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new GUI().setVisible(true); showWarning(); } }); } I can't use showWarning() like that since it's a non-static method. Do I need to have the GUI object in a variable properly o…
tagged with: jframe
tagged with: swing
has answer: http://stackoverflow.com/a/22816819
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22815976
has comment: http://stackoverflow.com/comment/34796473
tagged with: popup
has answer: http://stackoverflow.com/a/22816002
has answer: http://stackoverflow.com/a/22815976
has comment: http://stackoverflow.com/comment/34796870
accepted answer: http://stackoverflow.com/a/22816002
tagged with: java
type: Question
tagged with: program-entry-point
has comment: http://stackoverflow.com/comment/34796192

http://stackoverflow.com/a/22849371
type: Answer
has comment: http://stackoverflow.com/comment/34856916
accepted answer of: http://stackoverflow.com/q/22849197
answers question: http://stackoverflow.com/q/22849197
score: 4
upvote count: 4
has body: This is actually relativly easy (sorry, but it is). Start by extending your class from JPanel, this provides you a basic container onto which to build your interface. Remove the JFrame frame = new JFrame(); as you're not really using it and in your main method, create a new instance of JFrame and add you component to it class CalculatorWhichUsesAInterface extends JPanel { public CalculatorWhichUsesAInterface(){ JPanel jPanelOne = new JPanel(); jPanelOne.setLayout(new GridLayout(1, 1); jPanelOne.add(new JButton("x")); JPanel jPanelTwo = new JPanel(new BorderLayout()); JTextField field = new JTextField(); field.setText("2141987.01235"); jPanelTwo.add(field, BorderLayout.NORTH); jPanelTwo.add(jPanelOne, BorderLayout.CENTER); add(jPanelTwo, BorderLayout.CENTER); } public static void main(String[] args){ EventQueue.invokeLater(new Runnable() { public void run() { CalculatorWhichUsesAInterface calc = new CalculatorWhichUsesAInterface(); JFrame frame = new JFrame() frame.setTitle("Calculator"); frame.add(calc); frame.pack(); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); } } This concept provides you with a flexible and re-usable component. This means that you can decide how and where the component is to be displayed. Displayed on it's own in it's own frame (as the above example does) or added to another container (such as another JPanel or even an applet) You may also want to take a look at Initial Threads Example two - not extending anything class CalculatorWhichUsesAInterface { public static void main(String[] args){ EventQueue.invokeLater(new Runnable() { public void run() { JPanel jPanelOne = new JPanel(); jPanelOne.setLayout(new GridLayout(1, 1); jPanelOne.add(new JButton("x")); JPanel jPanelTwo = new JPanel(new BorderLayout()); JTextField field = new JTextField(); field.setText("2141987.01235"); jPanelTwo.add(field, BorderLayout.NORTH); jPanelTwo.add(jPanelOne, BorderLayout.CENTER); JFrame frame…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34857041
has comment: http://stackoverflow.com/comment/34856812

http://stackoverflow.com/a/22857065
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22856931
score: 1
upvote count: 1
has body: java.util.Date utilDate = new java.util.Date(); java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime()); System.out.println("utilDate:" + utilDate); System.out.println("sqlDate:" + sqlDate); This gives me the following output: utilDate:Fri Apr 04 12:07:37 MSK 2014 sqlDate:2014-04-04

http://stackoverflow.com/a/23155923
answers question: http://stackoverflow.com/q/22865719
type: Answer
has body: I am using JavaFX on an eeePC 901. I get very slow preformance and simular error messages: Prism pipeline init order: es2 sw Using platform text rasterizer Using java-based Pisces rasterizer Using dirty region optimizations Not using texture mask for primitives Not forcing power of 2 sizes for textures Using hardware CLAMP_TO_ZERO mode Opting in for HiDPI pixel scaling Prism pipeline name = com.sun.prism.es2.ES2Pipeline Loading ES2 native library ... prism_es2 succeeded. GLFactory using com.sun.prism.es2.X11GLFactory Prism-ES2 Error : GL_VERSION (major.minor) = 1.4 (X) Got class = class com.sun.prism.es2.ES2Pipeline GraphicsPipeline.createPipeline: error initializing pipeline com.sun.prism.es2.ES2Pipeline *** Fallback to Prism SW pipeline Prism pipeline name = com.sun.prism.sw.SWPipeline (X) Got class = class com.sun.prism.sw.SWPipeline Initialized prism pipeline: com.sun.prism.sw.SWPipeline vsync: true vpipe: false lspci is giving: 00:02.0 VGA compatible controller [0300]: Intel Corporation Mobile 945GME Express Integrated Graphics Controller [8086:27ae] (rev 03) Subsystem: ASUSTeK Computer Inc. Device [1043:830f] Kernel driver IN USE: i915 Kernel modules: i915 00:02.1 Display controller [0380]: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller [8086:27a6] (rev 03) Subsystem: ASUSTeK Computer Inc. Device [1043:830f] So I am using the i915 driver as well.
score: 0

http://stackoverflow.com/comment/35325816
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22898225
has text: You didn't mention what you didn't like about things like Charva and JCurses. Are you entirely opposed to using curses?
score: 0

http://stackoverflow.com/a/22935160
has comment: http://stackoverflow.com/comment/35017753
score: 1
has comment: http://stackoverflow.com/comment/35012550
downvote count: 0
answers question: http://stackoverflow.com/q/22935106
has comment: http://stackoverflow.com/comment/35018384
type: Answer
has body: Caused by: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. The stacktrace says you are updating ui from a backgroudn thread which is wrong. You have content.setText(SetServerString); You are updating the same in doInbackground which is wrong. You can update ui only from ui thread. doInBackground is invoked on the background thread. onPostExecute is invoked on the ui thread. So you ca return in doInBackgorund and update ui in onPostExecute. Check the topic The 4 Steps @ http://developer.android.com/reference/android/os/AsyncTask.html Also instead of System.out.println(ex); use Log to log the info. http://developer.android.com/reference/android/util/Log.html
has comment: http://stackoverflow.com/comment/35012600
has comment: http://stackoverflow.com/comment/35018443
upvote count: 1

http://stackoverflow.com/comment/35000944
comment on: http://stackoverflow.com/a/22923925
has text: Do I have to get rid of the # first?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34812640
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22824750
has text: Ultimately, I think what you are intending is to create a distributed state machine. In order to do that, your client is going to have to be multi-threaded. One thread gathers user input to update the state from the client and delivers it to the server. The other thread will receive updates from the server and print them out/update the local state.

http://stackoverflow.com/a/22940750
accepted answer of: http://stackoverflow.com/q/22940503
answers question: http://stackoverflow.com/q/22940503
has body: You should run GUI related code in Event Dispatch Thread (EDT). Do not create another thread. public void actionPerformed(ActionEvent evt) { try { SwingUtilities.invokeLater( new Runnable() { ... If actionPerformed is the listener callback, it already runs on EDT. Create another Runnable if the callback takes long to execute, or it will "slow down" the GUI. If MyFunction() method is not related to GUI repaint or anything like that, run it on another thread, specially if it is resource intensive.
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/22906011
has comment: http://stackoverflow.com/comment/34961065
type: Answer
answers question: http://stackoverflow.com/q/22905938
has comment: http://stackoverflow.com/comment/34959193
upvote count: 1
has body: There are a few factors why this is slow. First, the start method calls a native method, and native calls are always slow. Then, creating a thread is a kernel function (allocating memory for it, adding it to the scheduler), so the program has to wait for the thread actually being created.
has comment: http://stackoverflow.com/comment/34971567
downvote count: 1
has comment: http://stackoverflow.com/comment/34979773
score: 0

gps
tags question: http://stackoverflow.com/q/22902744
tag name: gps
tags question: http://stackoverflow.com/q/22860678
tags question: http://stackoverflow.com/q/22957627
tags question: http://stackoverflow.com/q/22902803
type: Tag

http://stackoverflow.com/comment/34862196
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22852095
has text: My "isLucky" method. it pops up a "else" without "if" statement
score: 0

http://stackoverflow.com/q/22924469
has comment: http://stackoverflow.com/comment/34993954
type: Question
has comment: http://stackoverflow.com/comment/34993989
linked to: http://stackoverflow.com/q/5621338
accepted answer: http://stackoverflow.com/a/22926044
has body: My problem is that when adding a .GIF to a JPanel, it shows this black square background for the .GIF. Result when adding on JPanel: It happens when I use this line: p2.add(loadBar); // where p2 = new JPanel(); However, when I add the same .GIF on the JFrame, the black square is not there anymore. Like this: jf.add(loadBar); // where jf = new JFrame(); Result when adding on JFrame: Part of the class code: String loadLink = "http://i.imgur.com/mHm6LYH.gif"; URL ajaxLoad = null; try { ajaxLoad = new URL(loadLink); } catch (MalformedURLException e3) { // TODO Auto-generated catch block e3.printStackTrace(); } ImageIcon loading = new ImageIcon(ajaxLoad); JLabel loadBar = new JLabel(loading); loadBar.setBounds(70, 60, 54, 55); loadBar.setOpaque(false); //jf.add(loadBar); p2.add(loadBar); Could someone please explain why it is happening like this? Thank you for your time and reading. EDIT: // Creates the Initialization Panel p2 = new JPanel(); // Sets the background, black with 125 as alpha value // This is less transparent p2.setLayout(null); p2.setBackground(new Color(0,0,0,150)); // Sets a border to the JPanel p2.setBorder(new LineBorder(Color.WHITE)); // Sets some size to the panels p2.setBounds(20, 20, 200, 150); // Adds the loading gif String loadLink = "http://i.imgur.com/mHm6LYH.gif"; URL ajaxLoad = null; try { ajaxLoad = new URL(loadLink); } catch (MalformedURLException e3) { // TODO Auto-generated catch block e3.printStackTrace(); } ImageIcon loading = new ImageIcon(ajaxLoad); JLabel loadBar = new JLabel(loading); loadBar.setBounds(70, 60, 54, 55); loadBar.setOpaque(false); p2.add(loadBar); That is the JPanel which is shown in the first image without the JLabel. I can't really show the JFrame part in the code because it is spread all over the class. But I don't think the problem is with JFrame so it could be this JPanel :/
tagged with: jpanel
has comment: http://stackoverflow.com/comment/34993730
score: 4
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/34993961
possible better answer: http://stackoverflow.com/a/22924892
has comment: http://stackoverflow.com/comment/34993878
has answer: http://stackoverflow.com/a/22924892
downvote count: 0
has comment: http://stackoverflow.com/comment/34996216
favorite count: 0
tagged with: imageicon
tagged with: jframe
has title: Black square showing when adding a .GIF on JPanel
has comment: http://stackoverflow.com/comment/34993326
has comment: http://stackoverflow.com/comment/34993606
has comment: http://stackoverflow.com/comment/34993950
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
tagged with: java
has answer: http://stackoverflow.com/a/22926044
tagged with: swing

http://stackoverflow.com/comment/35005123
comment on: http://stackoverflow.com/a/22931044
score: 0
type: AnswerComment
has text: Its partially fixed, but now the code produces an extra row when the table is generated. An input of 3 rows with 2,1,3 will give the correct column length now but an extra column at the end is generated.
type: Comment

http://stackoverflow.com/comment/34975910
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22915430
has text: Simply store all the lines in String `ArrayList` and the separate each nos using `String.split()` method you'll get each no as separate no then add them

http://stackoverflow.com/a/28715800
has body: One more reason why I don't like Hibernate Validator that particular. They make it really hard to create a simple violation programmatically, when it should be dead simple. I do have test code where I need to create a violation to feed to my mocked subsystem. Anyway, short of rolling your own implementation of a violation contraint - here is what I do to create a violation for a field: private static final String MESSAGE_TEMPLATE = "{messageTemplate}"; private static final String MESSAGE = "message"; public static &lt;T, A extends Annotation&gt; ConstraintViolation&lt;T&gt; forField( final T rootBean, final Class&lt;T&gt; clazz, final Class&lt;A&gt; annotationClazz, final Object leafBean, final String field, final Object offendingValue) { ConstraintViolation&lt;T&gt; violation = null; try { Field member = clazz.getDeclaredField(field); A annotation = member.getAnnotation(annotationClazz); ConstraintDescriptor&lt;A&gt; descriptor = new ConstraintDescriptorImpl&lt;&gt;( new ConstraintHelper(), member, annotation, ElementType.FIELD); Path p = PathImpl.createPathFromString(field); violation = ConstraintViolationImpl.forBeanValidation( MESSAGE_TEMPLATE, MESSAGE, clazz, rootBean, leafBean, offendingValue, p, descriptor, ElementType.FIELD); } catch (NoSuchFieldException ignore) {} return violation; } HTH
has comment: http://stackoverflow.com/comment/47728300
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22938407
score: 9
upvote count: 9

http://stackoverflow.com/comment/35056844
score: 0
type: Comment
type: QuestionComment
has text: I'm finding that torch mode is generally working fine on 2.1 but the problem with the Samsung Epic and found a hack around it. Looking at the params returned by Camera.getParameters() when run on the Samsung Epic, I noticed that the flash-modes it claims to support are: flash-mode-values=off,on,auto; torch-mode is not listed, implying it's not supported on samsung
comment on: http://stackoverflow.com/q/22855759

http://stackoverflow.com/q/22935773
has body: when i am trying to execute this code i am getting null pointer exception. i can able to find the problem.that is if any folder contains files as well as directories only first time recursive function is calling after that it is giving null pointer exception. public void generateFileList(File node, String outputFolder) { if (node.isFile()) { //somecode } if (node.isDirectory()) { String[] subNote = node.list(); for(String filename:subNote){ } for (String filename : subNote) { generateFileList(new File(node, filename), outputFolder); } } }
type: Question
has comment: http://stackoverflow.com/comment/35012372
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22935893
favorite count: 0
type: UnansweredQuestion
score: -2
has title: null pointer exception in java recursive method when dealing with files?
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/34812257
has text: Even uglier: `double[] sum = new double[1]; try { DoubleStream.iterate(1, d -> d + 1).map(d -> 1 / (d * d)).peek(term -> { sum[0] += term; if (term <= 1e-12 * sum[0]) { System.out.println(sum[0]); throw new RuntimeException(""); } }).count(); } catch (Exception ignore) {}`
type: QuestionComment
comment on: http://stackoverflow.com/q/22822830
score: 1
type: Comment

http://stackoverflow.com/comment/34870814
type: AnswerComment
type: Comment
has text: @user3496650 - Okay, look in my answer you have one element of address_component, and you access values in that.. In your case you can make different calls for Duration and Distance. so address_component = (Duration / Distance) and where you were getting type just get text and value
comment on: http://stackoverflow.com/a/22855871
score: 0

http://stackoverflow.com/comment/34950676
type: QuestionComment
comment on: http://stackoverflow.com/q/22901322
has text: How are the priorities being set? The queue has its own priorities, separate from what the `compareTo` induces.
score: 0
type: Comment

http://stackoverflow.com/comment/34799747
comment on: http://stackoverflow.com/a/22815270
has text: Agree upon the "immitability". Can you edit your first paragraph so I can accept the answer - when you use `Collection<T>` as a formal parameter and let say that `T` is `String`, you can still pass `List<String>`. The main benefit of using wildcards in this case would be that I would be able to pass collections like `List<MyString>`, for example (if we assume that `MyString extends String`).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34925490
comment on: http://stackoverflow.com/q/22887153
score: 0
type: Comment
has text: Well my card and deck classes are separate and I don't want to change anything about them since they can be reused for other card games. I don't want to add something that is specific to blackjack
type: QuestionComment

http://stackoverflow.com/q/22834413
answer count: 3
has title: Error when passing an input through an object
upvote count: 0
accepted answer: http://stackoverflow.com/a/22834526
has comment: http://stackoverflow.com/comment/34829478
favorite count: 0
has answer: http://stackoverflow.com/a/22834545
has comment: http://stackoverflow.com/comment/34829348
type: AnsweredQuestion
tagged with: java
downvote count: 2
possible better answer: http://stackoverflow.com/a/22834717
type: Question
has answer: http://stackoverflow.com/a/22834717
has comment: http://stackoverflow.com/comment/34829303
has body: I created a method makesPerson() which takes input String[] and int[]. It is giving an error when i create an object and give the inputs as array of strings and int.It was working fine when the input were just String and int and not arrays. public class Person { String name; int height; } public class TestPerson { public void display(Person persons) { for (int i=0;i&lt;persons.length;i++) { System.out.println(p.name[i]+":"+p.height[i]); } } public static void main(String args[]) { TestPerson p1=new TestPerson(); //This is giving me error p1.makePerson({"joe" ,"jhon", "Alex"},{150,160,170}); } public Person[] makePerson(String[] names, int[] hts) { Person [] persons = new Person(names.length); for(int i=0;i&lt;names.length;i++) { Person p = new Person(); p.name = names[i]; p.height = hts[i]; persons[i] = p; } String str = ""; for(int i=0;i&lt;persons.length;i++) { str += persons[i].height + ": :"; System.out.println(str); display(persons); return persons; } } }
score: -2
has answer: http://stackoverflow.com/a/22834526

http://stackoverflow.com/comment/34871806
type: Comment
has text: try add this, corrected for my example. But have same result `The request sent by the client was syntactically incorrect`
comment on: http://stackoverflow.com/a/22857564
type: AnswerComment
score: 0

http://stackoverflow.com/a/22961192
accepted answer of: http://stackoverflow.com/q/22961079
has comment: http://stackoverflow.com/comment/35058751
has comment: http://stackoverflow.com/comment/35060027
answers question: http://stackoverflow.com/q/22961079
score: 0
has comment: http://stackoverflow.com/comment/35058779
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35058860
has body: boolean flag = true; tambah = (EditText)rootView.findViewById(R.id.about_header); tambah.setOnFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { flag = !flag; if(v == tambah &amp;&amp; flag) { //format your text to 1000 here } else if(v == tambah &amp;&amp; !flag) { //format your text to 1.000 here } } }); Edit: If you need a simple formatter, you can use decimal formatter. double d = 1.000; DecimalFormat df1 = new DecimalFormat("#.###"); DecimalFormat df2 = new DecimalFormat("####"); String newD1 = df1.format(d); // 1.000 String newD2 = df2.format(d); // 1000
type: Answer
has comment: http://stackoverflow.com/comment/35059229

http://stackoverflow.com/q/22875043
tagged with: apache-fop
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
has body: I am trying to convert a nested, bulleted list in HTML to XML-FO for output as a PDF in Apache FOP. The HTML looks like this Item Number1 Sub-Item 1 Sub-Item 2 All of the XSLT I have tried creates a with an embedded for the subitems. FOP, however, complains that you can't have a list-block as a child of a list-block. Is this an issue with FOP? Or, is that simply not valid XML-FO and all of the XSLT examples are processing this construct incorrectly? If it's the later, what is the proper XML-FO to produce a nested set of bullets like you would see in HTML? Any help would be greatly appreciated! Thanks!
tagged with: xslt
type: Question
has title: XML-FO Nested List-Blocks
has answer: http://stackoverflow.com/a/22875241
score: 0
answer count: 1

http://stackoverflow.com/comment/34854532
type: QuestionComment
type: Comment
has text: @AiramMetal I've proposed a solution below. Take a look and see if it helps you solve your problem! :)
score: 0
comment on: http://stackoverflow.com/q/22843783

http://stackoverflow.com/comment/34992157
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22923654
has text: @nitinkt: I only posted my answer 32 minutes ago, so unless you already knew you were meant to be using base64 and didn't bother to mention it, I doubt very much that you've been searching for 3 hours on how to use base64. Again, did you follow my link? (It's to a page with a library which is *very* easy to use. Call `Base64.encodeBytes(String)` and `Base64.decode(byte[])`....
type: Comment

http://stackoverflow.com/a/22848170
upvote count: 2
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34854769
has comment: http://stackoverflow.com/comment/34854515
score: 1
has body: Yes, you can - this is the purpose of generics. You can do something like: List&lt;T&gt; list = new ArrayList&lt;T&gt;(); T [] elements = list.toArray(new T[list.size()]);
answers question: http://stackoverflow.com/q/22848102

http://stackoverflow.com/q/22948929
tagged with: multidimensional-array
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35036813
has answer: http://stackoverflow.com/a/22949045
has comment: http://stackoverflow.com/comment/35037033
has title: How to check multidimensional array for equality with a user-input string?
tagged with: java
has comment: http://stackoverflow.com/comment/35036754
has comment: http://stackoverflow.com/comment/35036959
tagged with: arrays
type: UnansweredQuestion
has body: Here is the first part of my code, which creates an array of randomly generated letters with a size specified by the user. What I need to do now is receive a string from the user, and test for equality of that string within the generated array. When it comes to testing for equality, I am stuck. Any help would be appreciated. package arraySearcher; import java.util.Random; import java.util.Scanner; public class arrayGenerator { // method that gets input from user and creates a random array.. public static void createArray() { // sets size of array.. System.out.print("How many columns and rows will you have in your square matrix?"); Scanner keyboard = new Scanner(System.in); int size = keyboard.nextInt(); char[][] userArray = new char[size][size]; // fills array with random letters.. Random randomLetter = new Random(); char c = (char) (randomLetter.nextInt(26) + 'a'); for (int row = 0; row &lt; userArray.length; row++) for (int column = 0; column &lt; userArray[row].length; column++) { userArray[row][column] = (char) (randomLetter.nextInt(26) + 'a'); } System.out.println("Below is your square matrix with randomly generated letters."); // prints array.. for (int i = 0; i &lt; userArray.length; i++) { for (int g = 0; g &lt; userArray[i].length; g++) { System.out.print(userArray[i][g] + " "); } System.out.println(); } }
has comment: http://stackoverflow.com/comment/35037337
has answer: http://stackoverflow.com/a/22949071
has comment: http://stackoverflow.com/comment/35036760

http://stackoverflow.com/comment/34843716
comment on: http://stackoverflow.com/q/22842508
type: Comment
has text: Can you only include the parts of the code that are relavant?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139797560
has text: Also be careful about the type of the `remoteAddress` field. In one Tomcat installation it turned out to be `Long` rather than `InetSocketAddress`. Probably because of using native APR library (what @lapo mentioned).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/32629586
type: AnswerComment

http://stackoverflow.com/comment/34825423
has text: @FereRes, did you trim leading and trailing whitespace?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22832050
score: 0

http://stackoverflow.com/comment/34860974
comment on: http://stackoverflow.com/q/22851418
score: 0
type: QuestionComment
type: Comment
has text: Right -- read the very excellent exception. It tells you exactly what's wrong and where.

http://stackoverflow.com/q/22842572
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5761529
tagged with: unit-testing
type: Question
has title: Mocking Method that Takes a Class<?> Type Argument with JMock
accepted answer: http://stackoverflow.com/a/22927147
has answer: http://stackoverflow.com/a/41516746
tagged with: junit4
tagged with: java
tagged with: jmock
possible better answer: http://stackoverflow.com/a/41516746
score: 11
answer count: 2
tagged with: mocking
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34968555
has body: Background: This is a JMock+JUnit specific question (those are the two technologies I must use). Yes, what I want to do can be done with PowerMock, but this is an edge case that doesn't warrant changing of tools. And no, sorry, I'm not asking this question to debate the philosophical validity of static methods :) With that out of the way, I will really thank anyone taking a look at this question. Question: I have piece of legacy code that I need to write a test for (we are trying to put tests around inherited code to ensure we don't break anything during a potentially massive refactoring effort... that's a tale for another time.) Goal: The method I'm trying to mock is the Foo.bar method in the class below using JMock's class imposterizer facility (via JUnit4Mockery.) The code below is representative to the code I'm test-wrapping: public class Foo { public abstract &lt;T&gt; void bar( Class&lt;? extends T&gt; paramClass, T paramT); My test setup aims to allow any # of calls to bar() receiving a Class instance (which obviously degenerates to Class ... silly Java type erasure "feature"), paired with any instance of Snafu. That is the key distinction here. I'm not pairing two Matcher parameters, or two literal parameters, but one literal (T.class) and any value of type T. JMock does not allow this, so the expected solution would be to have a Matcher> and a Matcher: Foo mock = context.mock(Foo.class); context.checking(new Expectations() { // keep warnings close to the culprit code when possible @SuppressWarnings("unchecked") public void allow(final Foo mockedFoo) { allowing(mockedFoo).bar( with(any(Snafu.class.getClass())), // Matcher that *should* resolve to Class&lt;?&gt; with(any(Snafu.class))); // matcher to anything of type Snafu.class } { allow(mockedFoo); } }); Then, we inject the mocked Foo, which eventually gets called like this by another class, which I'll refer to as the Driver (*I'll get back to the static method call later): // fooImpl has been replaced/inje…
has answer: http://stackoverflow.com/a/22927147
has comment: http://stackoverflow.com/comment/34959258
upvote count: 11

http://stackoverflow.com/a/22921094
type: Answer
answers question: http://stackoverflow.com/q/22920125
has body: Once you have the parent node, you should be able to call the attr function. See the docs: http://jsoup.org/apidocs/org/jsoup/nodes/Node.html#attr(java.lang.String) Also notice the option to prefix with abs to get the absolute and not the relative path: String url = a.attr("abs:href");
score: 0

http://stackoverflow.com/q/22895632
score: 0
answer count: 1
has body: I'm trying to use doxygen to create the documentation for java, but I have a small problem... I get all the classed but doxygen do not create the documentation for the interfaces... can anybody help me? The doxyfile that I'm using is here and the version that I'm using is the 1.8.6 Thanks!
has answer: http://stackoverflow.com/a/27637266
tagged with: doxygen
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/23700137
type: Question
has comment: http://stackoverflow.com/comment/35050015
has comment: http://stackoverflow.com/comment/35052105
has title: Doxygen not generating documentation for java interfaces

http://stackoverflow.com/comment/34905933
type: AnswerComment
comment on: http://stackoverflow.com/a/22876438
type: Comment
has text: I think this is same for case 1.
score: 0

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/22923907
type: Tag

http://stackoverflow.com/comment/34928842
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22889298
has text: @Christian I'm also using JDK1.7 + eclipse. Anything to do with eclipse's console settings?

http://stackoverflow.com/comment/34844115
comment on: http://stackoverflow.com/q/22842592
score: 1
has text: [Related.](http://stackoverflow.com/q/1612334/335858)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22829843
has comment: http://stackoverflow.com/comment/34821581
has comment: http://stackoverflow.com/comment/34821426
answers question: http://stackoverflow.com/q/22829623
score: 0
has comment: http://stackoverflow.com/comment/34821785
has body: Its a bad idea using Array. Make ArrayList of ArrayList. ArrayList&lt;ArrayList&gt; videos = new ArrayList&lt;ArrayList&gt;(); Now add your videos into ArrayList videos. For example :- ArrayList&lt;String&gt; video = new ArrayList&lt;String&gt;(); video.add("140"); video.add("Shrek"); video.add("5"); video.add(10); Now add this video into videos videos.add(video); For removing a video do this; for(int i =0; i&lt;videos.size();i++){ videos.get(i).contains("140"); videos.remove(i); }
type: Answer

http://stackoverflow.com/a/22880686
type: Answer
answers question: http://stackoverflow.com/q/22880458
score: 0
has comment: http://stackoverflow.com/comment/34914880
has body: You could try this but you'll get a compiler warning ArrayList&lt;Student&gt;[][] clashesMatrix2 = (ArrayList&lt;Student&gt;[][]) java.lang.reflect.Array.newInstance(ArrayList.class,noOfExams,noOfExams); You could do this to suppress warning @SuppressWarnings("unchecked") ArrayList&lt;Student&gt;[][] clashesMatrix2 = (ArrayList&lt;Student&gt;[][]) java.lang.reflect.Array.newInstance(ArrayList.class,noOfExams,noOfExams); More info about this can be found at http://www.ibm.com/developerworks/java/library/j-jtp01255/index.html

http://stackoverflow.com/comment/34974943
type: QuestionComment
comment on: http://stackoverflow.com/q/22909163
has text: 04-07 17:18:46.681: I/System.out(31979): bufferSize 0
score: 0
type: Comment

http://stackoverflow.com/q/22886312
has answer: http://stackoverflow.com/a/22887296
tagged with: rgb
tagged with: argb
answer count: 1
downvote count: 0
favorite count: 0
tagged with: colors
accepted answer: http://stackoverflow.com/a/22887296
tagged with: rgba
type: AnsweredQuestion
score: 2
has title: A bit number of Color channel of RGB, ARGB and RGBA
upvote count: 2
tagged with: java
type: Question
has body: This is a order of bit number of color channel from wiki ARGB and RGBA but there is a different order from another site Which one is correct?? How about the order of RBG???

http://stackoverflow.com/q/22921597
type: AnsweredQuestion
has title: Cannot get program to recognize capital letters when input?
has answer: http://stackoverflow.com/a/22921660
has body: Java beginner here - hoping someone can help me solve this problem. I am trying to write a simple program that will display a particular message depending on the character entered by the user. The problem I'm having is that it won't recognize the validity of capitalized characters in determining which message to print. The code compiles OK but if I enter a capital letter, it prints out the message telling me it is not a valid character to start an identifier. Here is a snippet of the source code: choice2 = (char) System.in.read(); if(choice2 == 'q') break; else if(choice2 == '_' || choice2 &gt;= 'a' &amp;&amp; choice2 &lt;= 'z' &amp;&amp; choice2 &gt;= 'A' &amp;&amp; choice2 &lt;= 'Z' &amp;&amp; choice2 &gt; '0' &amp;&amp; choice2 &lt;= '9') System.out.println("That is a valid character to start an identifier."); else if(choice2 == '$') System.out.println("That is a valid character to start an identifier but should only be used by mechanically generated source code"); else System.out.println("Sorry, that is not a valid character to start an identifier"); break; Is there something I'm doing wrong or is it something inherent to the char data type? Thanks
tagged with: java
has comment: http://stackoverflow.com/comment/34987636
type: Question
accepted answer: http://stackoverflow.com/a/22921660
score: 0
answer count: 1

http://stackoverflow.com/comment/34897350
has text: Might be due to fact that Arrays.asList() will give a fixed size list, you'd need to use new ArrayList for a mutable list. However, I think in this case read-only list should be ok.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22871953

http://stackoverflow.com/comment/34965732
comment on: http://stackoverflow.com/q/22908335
score: 0
type: Comment
type: QuestionComment
has text: Have you tried calling a `response.getEntity()` ?

http://stackoverflow.com/a/22935516
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/35012167
downvote count: 1
has comment: http://stackoverflow.com/comment/35012689
type: Answer
has body: Add jar After the artifactId and then run mvn package.
answers question: http://stackoverflow.com/q/22935388

http://stackoverflow.com/comment/34823383
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22829252
has text: @maaartinus You are correct. I didn't want to complicate the things. And you forgot `clone()`. :-)
type: Comment

http://stackoverflow.com/q/22910078
has comment: http://stackoverflow.com/comment/34966360
has title: Leaked window exception in android
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/22953746
type: Question
linked to: http://stackoverflow.com/q/19295073
has comment: http://stackoverflow.com/comment/34971592
has comment: http://stackoverflow.com/comment/34966271
has body: I am trying to load the data from mysql database into a listview in android.The progress dialog appears then the app crashes.The error what i get is activity has leaked window.Please tell me What is the problem which is causing this error.This is the java activity file public class CompScience extends ListActivity { // Progress Dialog private ProgressDialog pDialog; // Creating JSON Parser object JSONParser jParser = new JSONParser(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; booksList; // url to get all products list private static String url= "http://10.0.2.2/books/get_all_books.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_BOOKS = "computerscience"; private static final String TAG_TITLE = "title"; private static final String TAG_BID = "bid"; private static final String TAG_AUTHOR = "author"; // products JSONArray JSONArray books = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_comp_science); // Hashmap for ListView booksList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // Loading products in Background Thread new LoadAllProducts().execute(); // Get listview ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { //String description = ((TextView) view).getText().toString(); Intent i = new Intent(CompScience.this,List1.class); // i.putExtra("description", description); startActivity(i); } }); } class LoadAllProducts extends AsyncTask&lt;String, String, String&gt; { @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(CompScience.this); pDialog.setMessage("Loading..."); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } protected String doInBackground(String... args) { // Building Parameters List&lt;NameV…
has comment: http://stackoverflow.com/comment/34965979
score: 0
tagged with: android
answer count: 1
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12000940

http://stackoverflow.com/a/22857145
has comment: http://stackoverflow.com/comment/34871044
has comment: http://stackoverflow.com/comment/34870580
has comment: http://stackoverflow.com/comment/34870772
downvote count: 0
has comment: http://stackoverflow.com/comment/34889691
type: Answer
has body: Try to add: @Autowired @Qualifier("mongoJobStatusService") JobStatusService&lt;JS&gt; jobService; And specify the name of MongoJobStatusService bean.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22856547
has comment: http://stackoverflow.com/comment/34871781
has comment: http://stackoverflow.com/comment/34871266

http://stackoverflow.com/comment/34868126
type: QuestionComment
has text: Yes, Observer - Observerable is better than writing own stuff. But it has same disadvantage as method (II). If there was something like std::bind (I came from C++) to bind to a function and pass it as a parameter.
score: 0
comment on: http://stackoverflow.com/q/22854305
type: Comment

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/22814573
tag name: maven-jaxb2-plugin

http://stackoverflow.com/a/22938987
has comment: http://stackoverflow.com/comment/35019440
accepted answer of: http://stackoverflow.com/q/22938805
has body: I think you can be use the javascript command Window.close() then you can put it on oncomplete tag or call in you managed bean using the FacesContext. See more in this How to close current tab in a browser window?
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22938805

http://stackoverflow.com/comment/34864537
type: Comment
has text: Ideally, you should give us an Example `BinderResponse` (the class too) with values we can test to reproduce the problem.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22853509

http://stackoverflow.com/q/22905896
type: Question
score: 3
tagged with: javascript
has body: I am creating a app for android using Kivy (python) that will send my location to a email. But kivy is not able to do this as GPS is not directly supported. This is what I have thought as my next step, but I need help. Is there any CLI command that can give me my location. I will run that command using os.system(commad), the basic method for running commands in python. Is there any executable available, like a jar file, or a javascript file, that I can run from my code and that gives me my current position using GPS. Any readymade code of Kivy or Java, that I can test on my Phone.
answer count: 1
downvote count: 0
has title: Get My location using Kivy or CLI?
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: python
tagged with: kivy
has answer: http://stackoverflow.com/a/22914121
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/35064188
has text: I changed it and edited the post with exception I got while using e.printStackTrace() right now
score: 0
comment on: http://stackoverflow.com/q/22963458
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34985338
has text: I'm very curious which framework wouldn't allow it. Would it call the police if you did?
comment on: http://stackoverflow.com/q/22919777
score: 0
type: Comment
type: QuestionComment

towers-of-hanoi
tag name: towers-of-hanoi
tags question: http://stackoverflow.com/q/22900288
type: Tag

http://stackoverflow.com/a/22833099
answers question: http://stackoverflow.com/q/22833035
has comment: http://stackoverflow.com/comment/34827130
downvote count: 0
has body: Downcasting is not bad if you firstly perform the following checks: Check for null --> x != null Compare classes at runtime --> getClass().equals(x.getClass()) Then you can downcast x as the class of this, and perform specific comparisons. Prior to your null check, you may also want to compare references of this and x. If the references are equal, you don't need to perform any other comparison.
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/22863556
score: 0
has title: JpcapHandler wont work
answer count: 1
has answer: http://stackoverflow.com/a/22863643
has body: So here's the thing. Im trying to let a network sniffer work, but this annoying problem just showed up that says the JpcapHandler cannot be resolved to a type. I've imported the jpcap library already. Dont know how to solve tis issue. Please help me with this. I'm kinda new in network programming.
has comment: http://stackoverflow.com/comment/34881616
type: UnansweredQuestion
tagged with: compiler-errors
tagged with: java
type: Question
tagged with: jpcap

http://stackoverflow.com/comment/35032025
score: 1
comment on: http://stackoverflow.com/q/22946395
has text: you should just drop these files to the folder with main class and rename headers to correct package
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35057369
comment on: http://stackoverflow.com/q/22960974
has text: Are the `Person` objects going to be 12 unique objects?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22853557
has answer: http://stackoverflow.com/a/22951713
tagged with: java
has answer: http://stackoverflow.com/a/22950002
possible better answer: http://stackoverflow.com/a/22865918
has answer: http://stackoverflow.com/a/22865918
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22951713
answer count: 3
tagged with: jclouds
tagged with: openstack-swift
has body: I'm using Apache JClouds to connect to my Openstack Swift installation. I managed to upload and download objects from Swift. However, I failed to see how to upload dynamic large object to Swift. To upload dynamic large object, I need to upload all segments first, which I can do as usual. Then I need to upload a manifest object to combine them logically. The problem is to tell Swift this is a manifest object, I need to set a special header, which I don't know how to do that using JClouds api. Here's a dynamic large object example from openstack official website. The code I'm using: public static void main(String[] args) throws IOException { BlobStore blobStore = ContextBuilder.newBuilder("swift").endpoint("http://localhost:8080/auth/v1.0") .credentials("test:test", "test").buildView(BlobStoreContext.class).getBlobStore(); blobStore.createContainerInLocation(null, "container"); ByteSource segment1 = ByteSource.wrap("foo".getBytes(Charsets.UTF_8)); Blob seg1Blob = blobStore.blobBuilder("/foo/bar/1").payload(segment1).contentLength(segment1.size()).build(); System.out.println(blobStore.putBlob("container", seg1Blob)); ByteSource segment2 = ByteSource.wrap("bar".getBytes(Charsets.UTF_8)); Blob seg2Blob = blobStore.blobBuilder("/foo/bar/2").payload(segment2).contentLength(segment2.size()).build(); System.out.println(blobStore.putBlob("container", seg2Blob)); ByteSource manifest = ByteSource.wrap("".getBytes(Charsets.UTF_8)); // TODO: set manifest header here Blob manifestBlob = blobStore.blobBuilder("/foo/bar").payload(manifest).contentLength(manifest.size()).build(); System.out.println(blobStore.putBlob("container", manifestBlob)); Blob dloBlob = blobStore.getBlob("container", "/foo/bar"); InputStream input = dloBlob.getPayload().openStream(); while (true) { int i = input.read(); if (i &lt; 0) { break; } System.out.print((char) i); // should print "foobar" } } The "TODO" part is my problem. Edited: I've been pointed out that Jclouds handles large file upload automaticall…
upvote count: 2
has title: How to set HTTP header in Apache JClouds?
type: Question
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/34996205
type: QuestionComment
comment on: http://stackoverflow.com/q/22926354
score: 0
has text: What doesn't it like about it? Java is very specific.
type: Comment

http://stackoverflow.com/comment/34899490
comment on: http://stackoverflow.com/q/22870790
has text: May this helps you http://bhat86.blogspot.in/2012/02/gxt-comobobox-with-multi-select-feature.html
score: 0
type: QuestionComment
type: Comment

communication
tag name: communication
tags question: http://stackoverflow.com/q/22832700
type: Tag

http://stackoverflow.com/q/22898864
tagged with: input
has title: Input / Output Java
favorite count: 0
has answer: http://stackoverflow.com/a/22898901
type: UnansweredQuestion
upvote count: 1
tagged with: output
has comment: http://stackoverflow.com/comment/34946059
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22898897
answer count: 2
downvote count: 0
has body: My program is supposed to write 100 random integers on a text file and read them. The problem is that I'm only printing 1 integer. I know I'm close. What am I doing wrong? import java.util.Random; public class WriteData { public static void main(String[] args) throws Exception { //create a file instance java.io.File file = new java.io.File("random100.txt"); if (file.exists()) { System.out.println("File already exists"); System.exit(0); } //create a file java.io.PrintWriter output = new java.io.PrintWriter(file); //write formatted output to the file Random randomGenerator = new Random(); for (int idx = 1; idx &lt;= 100; ++idx) { int randomInt = randomGenerator.nextInt(100); output.print(randomGenerator); //log("Generated : " + randomInt); //close file output.close(); } } } import java.util.Scanner; public class ReadData { public static void main(String[] args) throws Exception { //create file instance java.io.File file = new java.io.File("random100.txt"); //create a scanner for the file Scanner input = new Scanner(file); //read data from a file while (input.hasNext()) { int number = input.nextInt(); System.out.println(number + " "); } //close file input.close(); } }

http://stackoverflow.com/q/22878809
accepted answer: http://stackoverflow.com/a/22879057
has comment: http://stackoverflow.com/comment/34910225
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22879057
has comment: http://stackoverflow.com/comment/34910090
type: Question
has comment: http://stackoverflow.com/comment/34909934
answer count: 1
downvote count: 0
has body: what exactly event perform at the time of termination the program in eclipse? It means whenever we directly close the program whatever running in eclipse console by pressing red button or close then what exactly event perform ? if u know something about this then please share your knowledge with me
has title: what event perform in termination action

http://stackoverflow.com/q/22815855
has body: I need to modify the insert method of my program so that it inserts items into a singly linked list in ascending order. I understand what a linked list is but have no clue how to insert the items in order. Here are my programs so far(not the entire program): public class SinglySortedLinkedList { private Node h; // list header public SinglySortedLinkedList() { h = new Node(); // dummy node h.l = null; h.next = null; } public boolean insert(Listing newListing) { Node n = new Node(); if(n == null) // out of memory return false; else { n.next = h.next; h.next = n; n.l = newListing.deepCopy(); return true; } } here is the tester method: public class MainSinglyLinkedList { public static void main(String[] args) { SinglySortedLinkedList boston = new SinglySortedLinkedList(); Listing l1 = new Listing("Bill", "1st Avenue", "123 4567" ); Listing l2 = new Listing("Al", "2nd Avenue", "456 3232"); Listing l3 = new Listing("Mike", "3rd Avenue", "333 3333"); boston.insert(l1); // test insert boston.insert(l2); boston.insert(l3); boston.showAll(); l3 = boston.fetch("Mike"); // test fetch of Mike System.out.println(l3.toString()); boston .delete("Al"); // test delete of Al boston.showAll(); boston.update("Mike", l2); // test update of Mike to Al boston.showAll(); System.exit(0); } } Any ideas of some pseudocode of how to insert in ascending order by the names would be so great, thanks
has comment: http://stackoverflow.com/comment/34796181
has answer: http://stackoverflow.com/a/22816343
tagged with: java
linked to: http://stackoverflow.com/q/13824619
type: Question
has title: Insert items in ascending order in a singly linked list in Java
score: 0
answer count: 1
tagged with: insert
has comment: http://stackoverflow.com/comment/34796112
type: UnansweredQuestion

http://stackoverflow.com/comment/35081620
type: QuestionComment
has text: @Servy Well, this page is now the top Google result for "Scala vs C# access modifiers" (maybe just because of recent activity, I don't know) and explains it in a way that makes sense to me, so maybe it'll save time for someone else coming from a similar background. But like I said, I don't mind the downvote, I just objected to the "lack of research" accusation. I guess you feel like it was a trivial amount of research, and only seemed substantial enough to warrant a question/answer because I was stupidly not understanding it right away. Ah well, sorry to waste your time then.
comment on: http://stackoverflow.com/q/22968085
score: 0
type: Comment

http://stackoverflow.com/comment/35066659
type: Comment
comment on: http://stackoverflow.com/a/22965940
score: 0
type: AnswerComment
has text: whether it will store image inside project folder?

webserver
tags question: http://stackoverflow.com/q/22819718
tag name: webserver
tags question: http://stackoverflow.com/q/22867385
type: Tag
tags question: http://stackoverflow.com/q/22820330
tags question: http://stackoverflow.com/q/22935095

http://stackoverflow.com/q/22830016
has comment: http://stackoverflow.com/comment/34827230
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34827165
tagged with: android
has comment: http://stackoverflow.com/comment/34821838
linked to: http://stackoverflow.com/q/16333754
linked to: http://stackoverflow.com/q/4394293
tagged with: java
has answer: http://stackoverflow.com/a/22836177
has title: android eclipse qr results
has body: i'm very new to posting questions on this site as well as programming. Forgive me if i miss out on something or a wrong format and such. Putting my hands on android for a project, a restaurant order system. Using android eclipse to do it. I have been successful in making an app that scans QR and displays the results. When you press scan, it opens the camera and scans a QR and displays the results under "Orders". What i haven't been able to figure out is how can i make it so that everytime i scan, it just adds a new result under the orders? Right now, everytime i scan, it replaces the current result with the new one. I want it to keep adding the results into the order. This the current coding i have for the Main Activity public class MainActivity extends Activity { TextView tvResult; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tvResult = (TextView) findViewById(R.id.tvResult); Button scanBtn = (Button) findViewById(R.id.btnScan); add: scanBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub try { Intent intent = new Intent( "com.google.zxing.client.android.SCAN"); intent.putExtra("SCAN_MODE", "QR_CODE_MODE,PRODUCT_MODE"); startActivityForResult(intent, 0); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getApplicationContext(), "ERROR:" + e, 1).show(); } } }); } public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { if (resultCode == RESULT_OK) { tvResult.setText(intent.getStringExtra("SCAN_RESULT")); } else if (resultCode == RESULT_CANCELED) { tvResult.setText("Scan cancelled."); } } } A second question, after displaying the results which after scanning will display "51 Cheese Salami $6.90" for one result as example. The solution to the first question would allow it to be displayed as such 51 Cheese Salami $6.90…
tagged with: eclipse
type: Question
answer count: 1
tagged with: qr-code
has comment: http://stackoverflow.com/comment/34822171
score: 0
has comment: http://stackoverflow.com/comment/34831673
has comment: http://stackoverflow.com/comment/34828616
has comment: http://stackoverflow.com/comment/34829761

decimal
tags question: http://stackoverflow.com/q/22833515
tag name: decimal
tags question: http://stackoverflow.com/q/22824666
tags question: http://stackoverflow.com/q/22836448
type: Tag
tags question: http://stackoverflow.com/q/22876051
tags question: http://stackoverflow.com/q/22891916

http://stackoverflow.com/a/22930660
has body: As you see your context has two bean of java.util.Properties. That means that you can't inject byType. Use @Qualifier("systemProperties") to restrict it to specific Properties. The integrationGlobalProperties isn't only one bean which is populated by Framework. And it isn't a surprise that autowire byType is more and more bad for real applications.
type: Answer
has comment: http://stackoverflow.com/comment/35003972
answers question: http://stackoverflow.com/q/22930464
has comment: http://stackoverflow.com/comment/35010206
has comment: http://stackoverflow.com/comment/35004273
has comment: http://stackoverflow.com/comment/35005472
has comment: http://stackoverflow.com/comment/35004454
score: 0
has comment: http://stackoverflow.com/comment/35010544
has comment: http://stackoverflow.com/comment/35004960
has comment: http://stackoverflow.com/comment/35006213

http://stackoverflow.com/q/22878601
tagged with: android
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5991319
tagged with: camera
tagged with: java
tagged with: image
type: Question
score: 0
has title: Android: How do i set imageview with photo taken through a custom camera
answer count: 1
has answer: http://stackoverflow.com/a/22881932
has body: I have a custom camera application whereby when i press the capture button, the image captured will appear on the next activity as a preview image. This is far as i went - MainActivity.java public class MainActivity extends Activity { private Camera mCamera; private CameraPreview mCameraPreview; private File pictureFile; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mCamera = getCameraInstance(); mCameraPreview = new CameraPreview(this, mCamera); FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); final ImageView view = (ImageView) findViewById(R.id.imageView1); preview.addView(mCameraPreview); Button captureButton = (Button) findViewById(R.id.button_capture); captureButton.setOnClickListener(new View.OnClickListener() { @SuppressLint("NewApi") @Override public void onClick(View v) { mCamera.takePicture(null, null, mPicture); } }); } /** * Helper method to access the camera returns null if it cannot get the * camera or does not exist * * @return */ private Camera getCameraInstance() { Camera camera = null; try { camera = Camera.open(); } catch (Exception e) { // cannot get camera or does not exist } return camera; } PictureCallback mPicture = new PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { pictureFile = getOutputMediaFile(); if (pictureFile == null) { return; } try { FileOutputStream fos = new FileOutputStream(pictureFile); fos.write(data); fos.close(); } catch (FileNotFoundException e) { } catch (IOException e) { } } }; private static File getOutputMediaFile() { File mediaStorageDir = new File( Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "MyCameraApp"); if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { Log.d("MyCameraApp", "failed to create directory"); return null; } } // Create a media file name String timeStamp =…

http://stackoverflow.com/q/22818181
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34801186
upvote count: 0
favorite count: 0
has title: sending mail in testNG without server in java
has body: please how to test sending email without real server in java knowing that email is send in a project A and I want to test sending in project B
type: Question
has answer: http://stackoverflow.com/a/22818518
score: -1
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/22818906
tagged with: java

http://stackoverflow.com/comment/118641442
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/53513967
has text: glad it helped!
score: 0

http://stackoverflow.com/comment/34948566
comment on: http://stackoverflow.com/a/22899965
type: Comment
score: 0
type: AnswerComment
has text: Thank you changing the 1 loop to a 0 fixed the missing / wrong output =)

http://stackoverflow.com/comment/34989855
score: 4
has text: Why is `newList` separate method? Also why does it not return anything (its return type is `void`)?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22922845

http://stackoverflow.com/comment/35026571
has text: Could you provide more code ? What is "stu1" ?
score: 0
comment on: http://stackoverflow.com/q/22943493
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35026567
type: QuestionComment
comment on: http://stackoverflow.com/q/22943493
score: 3
has text: How is `completedHours` defined? Can you provide the entire `stu1` class?
type: Comment

http://stackoverflow.com/comment/35024586
comment on: http://stackoverflow.com/q/22938689
score: 0
has text: Apr 8, 2014 3:25:38 PM org.apache.catalina.core.ApplicationContext log INFO: No Spring WebApplicationInitializer types detected on classpath
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34952967
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22902314
has text: @CantChooseUsernames, I think it's not thread safe (in contrary to the Java line, which is...)
score: 0

http://stackoverflow.com/a/22961817
has comment: http://stackoverflow.com/comment/35060156
has comment: http://stackoverflow.com/comment/131633892
has comment: http://stackoverflow.com/comment/131634370
has body: You can reference a Unicode block or a script for that. Here's an example with a script: Pattern p = Pattern.compile("\\p{IsHangul}"); Matcher m = p.matcher("김인재"); while (m.find()) { System.out.println("Found: " + m.group()); } Output Found: 김 Found: 인 Found: 재 Notes For a reference on Unicode blocks, see here. For a reference on Korean machine characters see here. To validate a range of numbers of characters, use: Pattern p = Pattern.compile("\\p{IsHangul}{min,max}"); where min is your minimum size and max is your maximum size of Hangul characters. The code you posted as a comment to your question will not work (although it will compile). Please find a reference on how to use Java Patterns / Matchers here. Caveat for legacy Android versions (9 or lower) It seems this methodoogy will not work with Android < 10 and may even crash the runtime. Will not test or add an alternative here The specific rationale may be buried somewhere here or in linked pages Credits to NoHarmDan for the heads up
has comment: http://stackoverflow.com/comment/35245057
has comment: http://stackoverflow.com/comment/131956765
accepted answer of: http://stackoverflow.com/q/22961593
has comment: http://stackoverflow.com/comment/132525499
has comment: http://stackoverflow.com/comment/35059694
upvote count: 5
has comment: http://stackoverflow.com/comment/35245118
has comment: http://stackoverflow.com/comment/132524737
score: 5
has comment: http://stackoverflow.com/comment/35059578
answers question: http://stackoverflow.com/q/22961593
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/131958683
type: Answer

tcp
type: Tag
tags question: http://stackoverflow.com/q/22896241
tags question: http://stackoverflow.com/q/22849607
tags question: http://stackoverflow.com/q/22817024
tags question: http://stackoverflow.com/q/22865969
tags question: http://stackoverflow.com/q/22846898
tags question: http://stackoverflow.com/q/22909983
tags question: http://stackoverflow.com/q/22892507
tag name: tcp
tags question: http://stackoverflow.com/q/22809876

java-home
tags question: http://stackoverflow.com/q/22882533
type: Tag
tag name: java-home
tags question: http://stackoverflow.com/q/22845120
tags question: http://stackoverflow.com/q/22946711
tags question: http://stackoverflow.com/q/22851377

http://stackoverflow.com/comment/35002907
has text: Why do You try localhost:8080/HealthyCommunitySimulator/welcome.jsp ? it is not mapped that is why You got 404, it should be like that base (localhost:8080) + requestMapping from controller (in Your case /Welcome) = localhost:8080/Welcome
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22929024

http://stackoverflow.com/comment/137567719
type: Comment
has text: As I already stated in my [comment](https://stackoverflow.com/questions/10056729/java-remove-duplicates-from-an-array/78021086#comment137566365_78021086) to another of your answers, you should add, at least, what your code produces so that the OP can verify whether he gets the same result when he runs your code. By the way, the code in your [other answer](https://stackoverflow.com/questions/10056729/java-remove-duplicates-from-an-array/78021086#78021086) was also poorly formatted (before I edited it). Is this how you actually format your code? Or are you having trouble copying it to here?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78020857

http://stackoverflow.com/q/22920521
tagged with: http://stackoverflow.com/tag/zip
has body: Well I'm generating 2 .xml files, but I want to save them in a folder, and also zip them, I don't want to generate them separately, but separated in a folder and zipped. d Did you get that? I want to put both of the files that I'm creating into a folder and zip it. The only thing that I want to save is the zip file. String name = fields.find(chooser.getLocation(), "mimic"); Mimic mimic = getMimic(mimicList.get(0)); String fileName = chooser.getSelectedFile().toString() + File.separator + "des_" +nombreMimic.substring(0, nombreMimic.length()-4)+ ".xml"; String config = chooser.getSelectedFile().toString() + File.separator + "cfg_" +nombreMimic.substring(0, nombreMimic.length()-4)+".xml"; FileOutputStream file; FileOutputStream file2; file = new FileOutputStream(fileName); file2 =new FileOutputStream(config); Parser parser; parser = new Parser(file,new String[]{}); parser.render(mimic , fields); JOptionPane.showMessageDialog(null, "Complete!"); Parser2 parser2; parser2 = new Parser2(file2,new String[]{}); parser2.render(mimic , fields); JOptionPane.showMessageDialog(null, "Complete!"); FileInputStream inputStream = new FileInputStream(chooser.getSelectedFile().toString() + File.separator + "des_" +nombreMimic.substring(0, nombreMimic.length()-4)+ ".xml"); ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(nombreMimic.substring(0, nombreMimic.length()-4)+".des")); zip.putNextEntry(new ZipEntry(fileName)); byte [] buffer = new byte [1024]; int bytesRead; while((bytesRead=inputStream.read(buffer))&gt;0){ zip.write(buffer,0,bytesRead); } zip.closeEntry(); zip.close(); inputStream.close(); } catch (Exception ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); JOptionPane.showMessageDialog(null, "Error parsing"); } } } }
upvote count: 2
tagged with: file
has title: How to zip a file that is generated in the code (Java)
has answer: http://stackoverflow.com/a/23888069
score: 2
type: AnsweredQuestion
tagged with: oop
linked to: http://stackoverflow.com/q/15968883
tagged with: java
has comment: http://stackoverflow.com/comment/34985358
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: directory
accepted answer: http://stackoverflow.com/a/23888069
has comment: http://stackoverflow.com/comment/34986209

http://stackoverflow.com/comment/35042725
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22952265
has text: Can you please refer this [Link][1] [1]: http://stackoverflow.com/a/3624358/3469370
score: 0

http://stackoverflow.com/comment/35029173
score: 0
type: Comment
type: QuestionComment
has text: I've tried this. But It's make it ' character.
comment on: http://stackoverflow.com/q/22919591

database-restore
tag name: database-restore
tags question: http://stackoverflow.com/q/22925639
type: Tag

http://stackoverflow.com/comment/34928685
score: 1
has text: What are you even asking? Clarify your question (a lot).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22889264

http://stackoverflow.com/q/22878449
has title: How to bootstrap weld-osgi version 2 in SE application
has comment: http://stackoverflow.com/comment/34922849
has comment: http://stackoverflow.com/comment/34911460
score: 2
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/34913779
has comment: http://stackoverflow.com/comment/34910530
has comment: http://stackoverflow.com/comment/34910550
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/34913501
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/23288704
has body: It's really not funny. There is no information in internet how to run weld-osgi second version (2.1.2.final) in se app. Instructions for ver 1 don't work. Let the developers be ashamed that they didn't provide necessary samples. I wrote them here. So, I have and OSGi activator and I want to get beans from it. In GF4 I used this: private BeanManager getBeanManager() throws NamingException { try{ InitialContext initialContext = new InitialContext(); return (BeanManager) initialContext.lookup("java:comp/BeanManager"); } catch (NamingException e) { System.out.println("Couldn't get BeanManager through JNDI"); return null; } } But in SE application I can't get it through JNDI. Also I tried: Weld weld=new Weld(); BeanManager beanManager=weld.getBeanManager(); But at the second line I get Caused by: java.lang.IllegalStateException: Singleton is not set. Is your Thread.currentThread().getContextClassLoader() set correctly? How can I use CDI starting from activator? What is my mistake? EDIT: What I did - I found two source code of two programs that use it, but it's really no so easy to write on their base (at least for me). The first is here and the second is here
tagged with: jboss-weld
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34913478
favorite count: 0
tagged with: osgi
type: UnansweredQuestion

http://stackoverflow.com/q/22964390
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35063830
has comment: http://stackoverflow.com/comment/35064207
tagged with: sqlite
answer count: 0
has comment: http://stackoverflow.com/comment/35063557
has comment: http://stackoverflow.com/comment/35063726
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/35092039
has body: I managed to solve my last problem but now I ran into this: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.eazymocky/com.example.eazymocky.MainActivity}: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. My cursors are however initialized and it seems this shows up when attempting to populate my controls: My code is below: public LocationEntity getLocationEntity(long locId) { String query = "SELECT * FROM " + dbHelper.tableLocations + " WHERE " + idColumn + " = " + locId; Log.e(LOG, query); Cursor cursor = database.rawQuery(query, null); if (cursor != null) { cursor.moveToFirst(); } LocationEntity location = new LocationEntity(); location.setLocationId(cursor.getInt(cursor.getColumnIndex(idColumn))); location.setLocationName(cursor.getString(cursor .getColumnIndex(locationName))); location.setLocationIcon(cursor.getString(cursor .getColumnIndex(locationIcon))); location.setLocationAddress(cursor.getString(cursor .getColumnIndex(locationAddress))); location.setLocationCity(cursor.getString(cursor .getColumnIndex(locationCity))); location.setLocationZIP(cursor.getString(cursor .getColumnIndex(locationZIP))); location.setLocationCountry(cursor.getString(cursor .getColumnIndex(locationCountry))); location.setFavoriteFlag(cursor.getInt(cursor .getColumnIndex(locationIsFavorite))); return location; } Any help you may provide would be more than welcome! :)
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35064239
has comment: http://stackoverflow.com/comment/35064790
has title: Database access error issues, SQLite Android
has comment: http://stackoverflow.com/comment/35064611
has comment: http://stackoverflow.com/comment/35091828
has comment: http://stackoverflow.com/comment/35063996

http://stackoverflow.com/q/22896682
has comment: http://stackoverflow.com/comment/34942027
accepted answer: http://stackoverflow.com/a/22897833
has comment: http://stackoverflow.com/comment/34942182
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/22896915
has answer: http://stackoverflow.com/a/22897833
score: 0
tagged with: nullpointerexception
answer count: 3
tagged with: android
has body: I have been tried to build my first Android Application. Every time I open the application in the emulator, I just get a message that says test has stopped working. It must be something simple. Hope you can help me. 04-06 15:43:47.806: W/dalvikvm(4275): threadid=1: thread exiting with uncaught exception (group=0xa614d908) 04-06 15:43:47.826: E/AndroidRuntime(4275): FATAL EXCEPTION: main 04-06 15:43:47.826: E/AndroidRuntime(4275): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test/com.test.MainActivity}: java.lang.NullPointerException 04-06 15:43:47.826: E/AndroidRuntime(4275): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 04-06 15:43:47.826: E/AndroidRuntime(4275): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 04-06 15:43:47.826: E/AndroidRuntime(4275): at android.app.ActivityThread.access$600(ActivityThread.java:141) 04-06 15:43:47.826: E/AndroidRuntime(4275): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 04-06 15:43:47.826: E/AndroidRuntime(4275): at android.os.Handler.dispatchMessage(Handler.java:99) 04-06 15:43:47.826: E/AndroidRuntime(4275): at android.os.Looper.loop(Looper.java:137) 04-06 15:43:47.826: E/AndroidRuntime(4275): at android.app.ActivityThread.main(ActivityThread.java:5041) 04-06 15:43:47.826: E/AndroidRuntime(4275): at java.lang.reflect.Method.invokeNative(Native Method) 04-06 15:43:47.826: E/AndroidRuntime(4275): at java.lang.reflect.Method.invoke(Method.java:511) 04-06 15:43:47.826: E/AndroidRuntime(4275): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 04-06 15:43:47.826: E/AndroidRuntime(4275): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 04-06 15:43:47.826: E/AndroidRuntime(4275): at dalvik.system.NativeStart.main(Native Method) 04-06 15:43:47.826: E/AndroidRuntime(4275): Caused by: java.lang.NullPointerException 04-06 15:43:47.826: E/AndroidRuntime(4275): at com.test.MainActiv…
possible better answer: http://stackoverflow.com/a/22897864
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22897864
has title: Android application has stopped working -eclipse

http://stackoverflow.com/a/22908160
score: 1
answers question: http://stackoverflow.com/q/22907945
accepted answer of: http://stackoverflow.com/q/22907945
upvote count: 1
type: AcceptedAnswer
has body: Change the code to while(rs.next()){ if(rs.getString(1)!=null &amp;&amp; rs.getString(1).equals(props.getProperty("db.dbname"))) { System.out.println("xxx"); } } There is no need of a for loop. The query show databases; will return a resultset with a single column.so, you can get the data using rs.getString(1) since column id starts from 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34927628
type: QuestionComment
comment on: http://stackoverflow.com/q/22854498
has text: *Now this means that at a particular time, 200 people can communicate with my web application.* demonstrates a fundamental incorrect assumption about *concurrency* based on the number of threads in the pool, which is continued and reinforced in the comments and answers to this question.
score: 0
type: Comment

http://stackoverflow.com/comment/34841867
type: Comment
has text: @HighCore it is off topic for the discussion, but as I pointed to you months ago, if you don't like it, it is fine. But do not think saying *java doesn't work for me like C# does* would make the world stop and saying *oh yes you're completely right, we should drop Java technology and do everything in C# from now on*. Just stop complaining about your bad luck or your bad time with it and try to **help people**.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22826674

http://stackoverflow.com/a/22901844
score: 1
has comment: http://stackoverflow.com/comment/34951667
has comment: http://stackoverflow.com/comment/34951545
has body: If you mean that your app crashes after pushing the Button labeled Calculate, it's probably because one of the parseDouble() method calls is throwing a NumberFormatException. Change your calculate() method like so: private void calculate() { try { x = Double.parseDouble(amount1.getText().toString()); y = Double.parseDouble(amount2.getText().toString()); z = x + y; tt.setText(Double.toString(z)); } catch (NumberFormatException e) { tt.setText("Invalid input"); } }
has comment: http://stackoverflow.com/comment/34951835
has comment: http://stackoverflow.com/comment/34951740
upvote count: 1
answers question: http://stackoverflow.com/q/22901743
has comment: http://stackoverflow.com/comment/34951592
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34945469
has text: Thanks bro. I appriciate that.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22898472

http://stackoverflow.com/q/22931394
has body: I had the following code, which is responsible for assigning roles and groups to users. private void override(List&lt;Assignment&gt; assignments) { removeAll(); addMultiple(assignments); } protected void removeAll() { removeAllRoles(); removeAllGroups(); } private void removeAllGroups() { Iterator&lt;String&gt; userGroups = user.getParentGroups(false); while (userGroups.hasNext()) { UMHelper.removeUserFromGroup(user.getUniqueID(), userGroups.next()); } } private void addMultiple(List&lt;Assignment&gt; assignments) { for (Assignment assignment : assignments) { add(assignment); } } public static void addUserToGroup(String userId, String groupId) { try { SimpleLogger.log(Severity.INFO, Category.APPLICATIONS, loc, null, "Trying to add user " + userId + " to group " + groupId); groupFactory.addUserToGroup(userId, groupId); SimpleLogger.log(Severity.INFO, Category.APPLICATIONS, loc, null, "Success"); } catch (UMException e) { SimpleLogger.traceThrowable(Severity.ERROR, loc, "Addition failed", e); } } I hope the logic is pretty clear. Most of the code is iteration over collections. Adding a user to role or group can cause exception, which I report in log. Since I find it not good to suppress exceptions and because a client calling override method should know the result of assigment, I rewrote the code adding exception handling. The execution should continue, even if some assignments failed. private void override(List&lt;Assignment&gt; assignments) { SimpleLogger.log(Severity.INFO, Category.APPLICATIONS, loc, null, "Override was started with " + assignments.size() + " assignments"); try { removeAll(); } catch (UMException e) { SimpleLogger.log(Severity.INFO, Category.APPLICATIONS, loc, null, "Removing all existing elements failed"); } try { addMultiple(assignments); } catch (UMException e) { SimpleLogger.log(Severity.INFO, Category.APPLICATIONS, loc, null, "Adding new elements failed"); } } protected void removeAll() throws UMException { boolean successfulRemoval = true; tr…
has title: Exception handling makes code logic unclear
has answer: http://stackoverflow.com/a/22931483
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/35004963
downvote count: 0
has comment: http://stackoverflow.com/comment/35005118
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35004863
score: 2
has comment: http://stackoverflow.com/comment/35004953
has answer: http://stackoverflow.com/a/22931507
upvote count: 2
has comment: http://stackoverflow.com/comment/35004973
type: Question

http://stackoverflow.com/q/22836794
has answer: http://stackoverflow.com/a/22837110
has title: Spring in Action III - 1 chapter 1 example and app is not working
tagged with: spring
has comment: http://stackoverflow.com/comment/34833297
type: AnsweredQuestion
has body: I just started learning Spring with Spring in action 3rd edition and I already have a problem with first chapter - example about a knight. Everything was ok, but when I wrote the code in beans.xml with aop my application stopped working, here's a source code of beans.xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" 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"&gt; &lt;bean id="knight" class="com.mol.spring.action.classes.BraveKnight"&gt; &lt;constructor-arg ref="dragonquest" /&gt; &lt;/bean&gt; &lt;bean id="dragonquest" class="com.mol.spring.action.classes.DragonSlayingQuest" /&gt; &lt;bean id="damselquest" class="com.mol.spring.action.classes.DamselResquingQuest" /&gt; &lt;bean id="minstrel" class="com.mol.spring.action.classes.Minstrel" /&gt; &lt;aop:config&gt; &lt;aop:aspect ref="minstrel"&gt; &lt;aop:pointcut id="embark" expression="execution(* *.embarkOnQuest(..))" /&gt; &lt;aop:before method="singBeforeQuest" pointcut-ref="embark" /&gt; &lt;/aop:aspect&gt; &lt;/aop:config&gt; &lt;/beans&gt; Everything worked fine, until I wrote the &lt;aop:config&gt; and app works if I comment the &lt;aop:before /&gt; tag. If other classes are needed, I'll include them. Error message: kwi 03, 2014 1:29:45 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@3abc8690: startup date [Thu Apr 03 13:29:45 CEST 2014]; root of context hierarchy kwi 03, 2014 1:29:45 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [beans.xml] kwi 03, 20…
tagged with: java
accepted answer: http://stackoverflow.com/a/22837110
type: Question
answer count: 1
score: 0
tagged with: spring-aop

http://stackoverflow.com/q/22938746
tagged with: glassfish
downvote count: 0
has comment: http://stackoverflow.com/comment/75687254
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/35109750
score: 2
answer count: 0
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/35111906
type: Question
has title: Java EJB JNDI Beans Lookup Failed
tagged with: ejb
tagged with: jndi
has body: I have the following structure in place: 4.0.0 com.screening screening 1.0-SNAPSHOT pom Screening Java Parent Module1 Module2 <dependencies> <dependencies> org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 ${endorsed.dir} org.apache.maven.plugins maven-ejb-plugin 2.3 3.1 org.apache.maven.plugins maven-dependency-plugin 2.1 validate copy ${endorsed.dir} true javax javaee-endorsed-api 6.0 jar The above is a pom that is the parent of the below modules: com.screening screening 1.0-SNAPSHOT 4.0.0 com.screening module1 1.0-SNAPSHOT ejb Module1 com.screening screening 1.0-SNAPSHOT 4.0.0 com.screening module2 1.0-SNAPSHOT ejb Module2 I have some stateless beans such as: @Stateless @Local public class ProcessorBean implements Processor { // implemented methods } I am using an embedded EJBContainer for Glassfish for unit tests. When accessing them using the following: Processor processor = (Processor) container.getContext().lookup(new String("java:global/classes/ProcessorBean!com.screening.processor.Processor"); It works correctly. The issue is that when I include Module 2 as part of Module 1 the unit tests fail by throwing the following Exception: javax.naming.NamingException: Lookup failed for 'java:global/classes/ProcessorBean! com.screening.processor.Processor' in SerialContext [Root exception is javax.naming.NameNotFoundException: classes] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442) at javax.naming.InitialContext.lookup(InitialContext.java:392) at javax.naming.InitialContext.lookup(InitialContext.java:392) at com.screening.processor.ProcessorBeanTest.setUpClass(ProcessorBeanTest.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveC…

http://stackoverflow.com/q/22895067
type: Question
has answer: http://stackoverflow.com/a/22895153
answer count: 2
has title: Will JPA EntityManager's merge method lead to OptimisticLockException?
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/34946539
possible better answer: http://stackoverflow.com/a/22898966
accepted answer: http://stackoverflow.com/a/22895153
favorite count: 0
has answer: http://stackoverflow.com/a/22898966
upvote count: 2
score: 2
type: AnsweredQuestion
has body: Let's say I would like to merge a detached entity. when I do T mergedEntity = entityManager.merge(detachedEntity); the entityManager will load an entity (with same identifier with the detachedEntity) from database and copy all the data from the detachedEntity to the new loaded entity. When later my transaction ends, this entity will be saved to the database. However, in a concurrent scenario, the entity in the database can be updated by other transactions between the entity is firstly loaded in my transaction and then flushed at the end of my transaction. In this case, I would like to know whether an OptimisticLockException will be thrown? If so, why the merge API doesn't specify the OptimisticLockException in Java doc? http://docs.oracle.com/javaee/6/api/javax/persistence/EntityManager.html#merge(T) thanks
tagged with: java

http://stackoverflow.com/comment/34977284
score: 0
has text: If you wish to save file to disk from javascript, then it is not possible.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22916244

http://stackoverflow.com/comment/34996219
score: 0
type: QuestionComment
type: Comment
has text: NULL should be compared to object instead as a String to check for NULL object. so we do use "==". .equals() is a method for String object to compare against string or character.
comment on: http://stackoverflow.com/q/22926220

http://stackoverflow.com/a/22957262
accepted answer of: http://stackoverflow.com/q/22956779
has body: Just uncomment the initialization of JScrollPane sc = new JScrollPane(t);
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22956779
type: Answer

http://stackoverflow.com/comment/35059250
comment on: http://stackoverflow.com/q/22961624
score: 0
type: Comment
type: QuestionComment
has text: Well, what kind of access do you have to the remote machine? You basically need to get the hashes of the files that you uploaded, so that you can compare them on the local machine.

http://stackoverflow.com/q/22814658
has comment: http://stackoverflow.com/comment/34794073
has comment: http://stackoverflow.com/comment/34794262
upvote count: 10
type: Question
tagged with: binary-search
linked to: http://stackoverflow.com/q/6676360
has answer: http://stackoverflow.com/a/22820972
has comment: http://stackoverflow.com/comment/34794056
tagged with: time-complexity
has comment: http://stackoverflow.com/comment/34794167
downvote count: 0
has body: I'm studying for a test, and found this question. You are given a sorted array of integers for example: {-5, -5, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 67, 67, 99} Write a method: Public static int count (int[] a, int x) that returns the amount of times, number 'x' is in the array. for example: x = -5, it returns 2 x = 2, it returns 5 x = 8, it returns 0 I need to write it as efficient as possible, please don't give me the answer (or write it if you wish, but I won't look), my idea is to do a binary search, and then go both edges (backward and forward) of the value that I find and with the index numbers, return the correct answer, my questions are: is it the most efficient way? won't it be O(n) in the worst case? (when the array is filled with a single number) - If so - then why should I do a binary search?
favorite count: 0
linked to: http://stackoverflow.com/q/14415408
has answer: http://stackoverflow.com/a/22814864
answer count: 5
has answer: http://stackoverflow.com/a/22814870
has comment: http://stackoverflow.com/comment/37425997
has comment: http://stackoverflow.com/comment/34793903
has comment: http://stackoverflow.com/comment/34795409
has comment: http://stackoverflow.com/comment/34793867
has comment: http://stackoverflow.com/comment/34794044
has answer: http://stackoverflow.com/a/22814816
has title: efficiently find amount of integers in a sorted array
has answer: http://stackoverflow.com/a/22829847
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34794171
has comment: http://stackoverflow.com/comment/34793955
has comment: http://stackoverflow.com/comment/34842088
tagged with: algorithm
has comment: http://stackoverflow.com/comment/34793876
linked to: http://stackoverflow.com/q/13197552
score: 10

http://stackoverflow.com/a/22931607
has comment: http://stackoverflow.com/comment/35005328
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22931498
downvote count: 2
has body: Remove final from final Context context = getApplicationContext();
score: -2

http://stackoverflow.com/q/22932251
has comment: http://stackoverflow.com/comment/35006819
has title: How much memory allocates to element in Object[]
has comment: http://stackoverflow.com/comment/35007172
favorite count: 0
has comment: http://stackoverflow.com/comment/35007151
has comment: http://stackoverflow.com/comment/35007217
type: UnansweredQuestion
has body: Consider the below case int[] anArray = new int[10]; Allocates memory for 10 elements of each 32-bit on heap.Right ? So what is the size of the element if the element type is Object. ?? like Object[] objArray = new Object[10]; How much memory allocated now on heap ? I just got the doubt by ssing the source code of ArrayList. private transient Object[] elementData; Just tried this line in my machine List&lt;String&gt; s = new ArrayList&lt;String&gt;(Integer.MAX_VALUE); results Exception in thread "main" java.lang.OutOfMemoryError: Requested array size exceeds VM limit at java.util.ArrayList.&lt;init&gt;(Unknown Source) at com.nextenders.server.guice.actions.servlets.Test.main(Test.java:13) So I'm trying to know how much memory allocated.
has comment: http://stackoverflow.com/comment/35006354
tagged with: memory-management
linked to: http://stackoverflow.com/q/5564423
has answer: http://stackoverflow.com/a/22933294
has answer: http://stackoverflow.com/a/22932852
has comment: http://stackoverflow.com/comment/35007226
linked to: http://stackoverflow.com/q/981073
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22933293
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/35006611
answer count: 3
tagged with: arrays
downvote count: 0

http://stackoverflow.com/comment/34864584
type: QuestionComment
has text: oh crap, thanks for the eagle eyes man!
score: 0
comment on: http://stackoverflow.com/q/22853775
type: Comment

http://stackoverflow.com/q/22865670
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/22866451
type: Question
has comment: http://stackoverflow.com/comment/34886162
has comment: http://stackoverflow.com/comment/34885700
has body: I try to map one-2-many relationship via Map interface. Problem: I got a weird exception Exception Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute statement at ... Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "Order" SQL query which cause rhe exception: (show_sql=true) Hibernate: insert into Order (customer_id, number, id) values (?, ?, ?) Code: public static void main(String[] args) { Session createSession = HibernateUtil.getSessionFactory().openSession(); createSession.beginTransaction(); final Customer customer = new Customer(); Map&lt;String, Order&gt; orders = new HashMap&lt;String, Order&gt;() {{ put("one", new Order("one", customer)); put("two", new Order("two", customer)); put("three", new Order("three", customer)); }}; customer.setOrders(orders); for (Order order : orders.values()) createSession.save(order); createSession.save(customer); createSession.getTransaction().commit(); //HERE THE EXCEPTION COMES createSession.close(); } Entities: @Entity public class Customer { @Id @GeneratedValue private Integer id; @OneToMany(mappedBy = "customer") @MapKey(name = "number") private Map&lt;String, Order&gt; orders; // + getters &amp; setters } @Entity public class Order { @Id @GeneratedValue private Integer id; private String number; @ManyToOne private Customer customer; //+ Constructors, getters &amp; setters }
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34887510
has comment: http://stackoverflow.com/comment/34885600
has answer: http://stackoverflow.com/a/22866451
has comment: http://stackoverflow.com/comment/34885875
has title: Hibernate: mapping map exception
type: AnsweredQuestion

http://stackoverflow.com/comment/34825689
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22832248
has text: It says +02:00 behind. 10:00 + 02:00 would be 12:00 I think. (Notice the missing ( ) around the +02:00). So 08:00 +02:00 might already be your desired output, only wrong formated.

android-intentservice
type: Tag
tags question: http://stackoverflow.com/q/22871580
tag name: android-intentservice

http://stackoverflow.com/q/22827220
tagged with: swing
tagged with: java
has title: How to make search result all in one box? Insted of (JOptionPane seperate boxes)
type: Question
has answer: http://stackoverflow.com/a/22827296
has comment: http://stackoverflow.com/comment/34817250
answer count: 1
score: 0
has body: Hello I have an ArrayList with 5 phones, 2 of them are from "Samsung manufacture" how would I display them all in one? Instead of separate boxes? String conta1 = "Samsung"; for(int i=0;i&lt;PhoneList.size();i++){ if(conta1.equalsIgnoreCase(PhoneList.get(i).getMfg())){ JOptionPane.showMessageDialog(null,PhoneList.get(i)); }
tagged with: joptionpane
type: UnansweredQuestion

http://stackoverflow.com/a/22945549
type: Answer
has comment: http://stackoverflow.com/comment/35033438
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22945406
score: 3
answers question: http://stackoverflow.com/q/22945406
has comment: http://stackoverflow.com/comment/35030331
has comment: http://stackoverflow.com/comment/35030879
has comment: http://stackoverflow.com/comment/35030312
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35030831
has body: Java is safer, because it doesn't use pointer arithmetic, does bounds checking, and doesn't (normally) allow one to access arbitrary chunks of memory (see sun.misc.Unsafe !). However, similar problems could arise, in principle, if one reads and writes bytes from an array, ByteBuffer, etc according to offsets provided by an untrusted client. The problem is much reduced, because one can only attack data within the bounds of that array (or similar container) rather than data in arbitrary adjacent objects. Even with Unsafe, one would typically be, uh, Safe, because one tends to use it for allocating and accessing a very specific set of performance-critical objects, rather than the entire application (including encryption keys, passwords, etc). The fundamental problem is trusting user input, and that can happen in any language, and a whole variety of contexts, e.g. SQL injection.

http://stackoverflow.com/q/22936009
tagged with: regex
favorite count: 0
accepted answer: http://stackoverflow.com/a/22936215
has comment: http://stackoverflow.com/comment/40372139
upvote count: 5
answer count: 4
has answer: http://stackoverflow.com/a/22936215
type: AnsweredQuestion
has title: Remove white space and special characters in Java
has body: I have a String which contains some special characters and white spaces as well. I want to remove white spaces and special character. I am doing it as: String str = "45,%$^ Sharma%$&^,is,46&* a$# Java#$43 Developer$#$^ in#$^ CST&^* web*&(,but he%^&^% wants to move@!$@# to another team"; System.out.println(str.replaceAll("[^a-zA-Z]", " ").replaceAll("\\s+", " ")); Output: sharma is a Java Developer in CST web but he wants to move to another team Can I do this using single operation? How?
tagged with: java
has answer: http://stackoverflow.com/a/61548279
possible better answer: http://stackoverflow.com/a/22936099
type: Question
has answer: http://stackoverflow.com/a/22936099
linked to: http://stackoverflow.com/q/2608205
tagged with: string
score: 4
has answer: http://stackoverflow.com/a/22936086
linked to: http://stackoverflow.com/q/18304804
downvote count: 1

http://stackoverflow.com/comment/34927911
type: QuestionComment
has text: It says error "incompatible type possible lossy conversion from double to float"
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22888759

http://stackoverflow.com/comment/34938077
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22894301
has text: Actually, I don't want to split anything that is surrounded by $'s. I will update my question. SabujHassan and fge I really like your answers, I'm checking both now.
score: 0

http://stackoverflow.com/a/22923654
has body: I can't easily tell whether this is all that's wrong, but this is definitely wrong: byte[] encryptedData = encryptData("Confidential data"); //String from user String s=encryptedData.toString();//String input to decrypt From user byte[] bb=s.getBytes(); Just decrypt encryptedData instead of of bb. Your s value is basically useless, because you've called toString() on a byte[], which won't give you what you're apparently expecting. The value of s will be something like "[B@15db9742" because arrays don't override toString() in Java. If you really want to turn arbitrary binary data (such as the result of encryption) into text, use base64 instead. Encode the result of encryption using base64 to get a string, and then later base64-decode it from the string to a byte array, then decrypt that byte array. Oh, and I'd strongly recommend against using String(byte[]) or String.getBytes() too - always use the overloads which take a character encoding instead.
answers question: http://stackoverflow.com/q/22923586
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22923586
has comment: http://stackoverflow.com/comment/34992166
has comment: http://stackoverflow.com/comment/34991760
has comment: http://stackoverflow.com/comment/34992157
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34991876
has comment: http://stackoverflow.com/comment/34991782
type: Answer
has comment: http://stackoverflow.com/comment/34992261

http://stackoverflow.com/q/22873048
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34899883
has body: I have the following Spring Java configuration set up: @Configuration public class FooConfig { @Autowired private IReferenceDataDAO referenceDataDAO; @Bean public IReferenceDataService getReferenceDataService() { return new ReferenceDataServiceImpl(referenceDataDAO); } } I am trying to reference the ReferenceDataService bean in another configuration class using the @Autowire property: @Configuration public class BarConfig { @Autowired private IRuleService ruleService; @Autowired private IReferenceDataService referenceDataService; } Here is the config that defines the IReferenceDataDAO: @Configuration public class FooBarConfig { @Bean public IReferenceDataDAO getReferenceDataDAO() { return new ReferenceDataDAOImpl(getStaticData(), getMapper()); } } Here is the ReferenceDataServiceImpl: public class ReferenceDataServiceImpl implements IReferenceDataService { private IReferenceDataDAO dao; public ReferenceDataServiceImpl(IReferenceDataDAO dao) { this.dao = dao; } The above configs are imported in a master config class: @Configuration @Import({ FoosAppConfig.class, BarAppConfig.class, FooBarAppConfig.class, }) I am noticing that this configuration leads to the referenceDAO in the ReferenceDataServiceImpl being set to null. What am I doing wrong? Shouldn't that @Autowire annotation ensure that my bean is fully configured before setting it?
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34899535
has title: @Autowire Not Setting DAO
has comment: http://stackoverflow.com/comment/34899555
has comment: http://stackoverflow.com/comment/34904729
type: Question
has comment: http://stackoverflow.com/comment/34899845
has answer: http://stackoverflow.com/a/22875007
has answer: http://stackoverflow.com/a/22874436
tagged with: spring

distinct
tag name: distinct
tags question: http://stackoverflow.com/q/22941081
type: Tag

http://stackoverflow.com/comment/34946340
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22899018
score: 1
has text: Also, the comparison ending == n is between different types. You should be using an IDE like eclipse, or any other that could highlight you these compilation errors.

http://stackoverflow.com/comment/34817088
type: Comment
type: QuestionComment
score: 0
has text: http://stackoverflow.com/questions/3607858/how-to-convert-a-rgb-color-value-to-an-hexadecimal-value-in-java
comment on: http://stackoverflow.com/q/22827441

http://stackoverflow.com/q/22873085
has comment: http://stackoverflow.com/comment/34900595
tagged with: bitmap
linked to: http://stackoverflow.com/q/9791714
tagged with: view
tagged with: screenshot
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/60547913
linked to: http://stackoverflow.com/q/36424381
has title: How to screenshot or snapshot a view before it's rendered?
has answer: http://stackoverflow.com/a/27703621
linked to: http://stackoverflow.com/q/18565226
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34902354
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34899805
tagged with: android
has body: I want to create an image of a view before it's rendered as a preview. I tried Take a screenshot of a whole View but the problem is that it gives a blank bitmap because the view was not rendered at that time. I also tried drawing cache, but it gives me a blank bitmap as well. Is there anyway that I can create an image of a view before it's rendered on the screen? Thanks in advance!

one-to-many
tags question: http://stackoverflow.com/q/22919153
type: Tag
tag name: one-to-many
tags question: http://stackoverflow.com/q/22839350

http://stackoverflow.com/q/22941592
tagged with: java
type: Question
has title: Is it possible to turn an ArrayList into a bunch of AsyncTask parameters?
score: 0
has answer: http://stackoverflow.com/a/22941687
answer count: 1
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/22941687
has body: Let's say I have an AsyncTask with a signature something like: AsyncTask&lt;String, Void, Void&gt; And I want to pass a handful of String variables to it, plus the elements from some ArrayList&lt;String&gt; so that I am executing this AsyncTask like this: new SomeTask().execute(one, two, three, x0, x1, xn); // where x0 through xn are the elements from some ArrayList. I could of course create a constructor for SomeTask that would take an ArrayList and assign it to a member variable and then pass the String variables to the execute method, but I wonder if there is something better.
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/a/22813110
has comment: http://stackoverflow.com/comment/34793757
score: 1
type: Answer
upvote count: 1
has body: Update: OOPS, I misinterpreted your question. I assumed you wanted to add JavaScript to an existing PDF so that the user can add valid data. What you are looking for is a way to extract the JavaScript from an existing PDF. You already get an impression on how to do that in the answer I referred to in my previous answer. For JavaScript added to specific fields, you need to inspect the Additional Actions: AcroFields form = stamper.getAcroFields(); AcroFields.Item fd = form.getFieldItem("married"); // Get the PDF dictionary of the YES radio button and add an additional action PdfDictionary dictYes = (PdfDictionary) PdfReader.getPdfObject(fd.getWidgetRef(0)); PdfDictionary yesAction = dictYes.getAsDict(PdfName.AA); if (yesAction == null) yesAction = new PdfDictionary(); yesAction.put(new PdfName("Fo"), PdfAction.javaScript("setReadOnly(false);", stamper.getWriter())); dictYes.put(PdfName.AA, yesAction); // Get the PDF dictionary of the NO radio button and add an additional action PdfDictionary dictNo = (PdfDictionary) PdfReader.getPdfObject(fd.getWidgetRef(1)); PdfDictionary noAction = dictNo.getAsDict(PdfName.AA); If noAction isn't null, you'll need to examine the different values in that dictionary. For instance: the /Bl entry (if present) will give you the action that is triggered on blur, the /Fo entry (if present) will give you the action that is triggerd on focus, and so on. If you want to get the document-level JavaScript, you need to fetch the appropriate entry from the name tree in the Catalog of the PDF document. It is hard to explain in words, but if you download RUPS and inspect the PDF, you should be able to find the different JavaScript snippets. If we look at the file created using my incorrect answer (see below), we get this: This shows that you need something like this: PdfDictionary catalog = reader.getCatalog(); PdfDictionary names = catalog.getAsDict(PdfName.NAMES); PdfDictionary javascript = names.getAsDict(PdfName.JAVASCRIPT); Once you have this ja…
answers question: http://stackoverflow.com/q/22811851
downvote count: 0

http://stackoverflow.com/q/22918979
answer count: 2
tagged with: java-8
possible better answer: http://stackoverflow.com/a/22931475
has comment: http://stackoverflow.com/comment/34982026
has comment: http://stackoverflow.com/comment/34986425
has answer: http://stackoverflow.com/a/22931475
tagged with: java
has body: In the new java 8 specification language. They introduced the default modifier that allows the definition of a method in an interface. My question is, does anyone have a good idea what's the best use case of this feature ?
has comment: http://stackoverflow.com/comment/34982309
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/22919252
has title: What is the best scenario of using the "default" modifier in java 8?
score: 3
linked to: http://stackoverflow.com/q/19998454
has comment: http://stackoverflow.com/comment/34982216
accepted answer: http://stackoverflow.com/a/22919252
upvote count: 3

http://stackoverflow.com/comment/35091717
comment on: http://stackoverflow.com/a/22959414
score: 0
type: Comment
has text: hey man!! thanks a lot. this code worked well, at the end i put attribute.submit(); fantastic!
type: AnswerComment

http://stackoverflow.com/q/22879563
has answer: http://stackoverflow.com/a/22884203
answer count: 1
tagged with: applet
has body: I have a program that have to display string on applet window and that string font size must be increased by 2 while mouse is clicked but the problem is that the the string font size is increasing but not showing constantly(static) it showing dynamically here is my code: import java.awt.*; import java.applet.*; import java.awt.event.*; /*&lt;applet code="fo.class" height=500 width=500&gt;&lt;/applet&gt;*/ public class fo extends Applet { String msg = ""; int size = 14; Font f; public void paint(Graphics g) { f = new Font("Rockwell", Font.BOLD, size); msg = "GAMER"; setFont(f); g.drawString(msg, 10, 100); } public void init() { addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { size = size + 2; repaint(); } }); } } and also tell me why we have to use (String) in JApplet instead of String while performing any item event in JTextField like this : public void(ItemEvent e){ String s=(String)e.getItem() setText(""+s); } why this (String) instead of String s=e.getItem() why we have to use that (String) in that statement because without that (String) program not compiling... tell me What does that (String) mean...??
upvote count: 1
favorite count: 0
tagged with: fonts
tagged with: mouselistener
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: text is not displaying properly on applet
type: Question

http://stackoverflow.com/comment/34893187
comment on: http://stackoverflow.com/a/22866842
score: 0
has text: the debugger says:Exception in thread "Thread-3" java.lang.NumberFormatException: For input string: " 7" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:481) at java.lang.Integer.parseInt(Integer.java:527) at PrimeFinder.run(PrimeFinder.java:80) at java.lang.Thread.run(Thread.java:744)
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22810023
score: 0
answers question: http://stackoverflow.com/q/22809971
has body: Don't keep different data types in a list. Use generics extensively. you can use instanceOf (ArrayList keeps Integers and Strings) to check type and put the int's seperately and get the largest value.
type: Answer

http://stackoverflow.com/comment/34884708
has text: Rather than using TextView locName = (TextView) view.findViewById(R.id.txtTitle); String locValue = locName.getText().toString(); you can get by adapter values by position, String locValue=YourAdapterClass)parent.getItem().getText().toString();
score: 0
comment on: http://stackoverflow.com/q/22863365
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35004285
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22930845
has text: Why does the first code snippet still use `File` if it's for Java 7? Hint: Java 7 has `Files.newDirectoryStream()` -- in this case, even `Files.newDirectoryStream(dir, "*.png")` is usable

http://stackoverflow.com/comment/35006570
type: AnswerComment
comment on: http://stackoverflow.com/a/22930930
score: 0
type: Comment
has text: it works if you use the following gradle snippet as a template https://android.googlesource.com/platform/tools/build/+/2e1f7810edd76d92cee8d3e06bc4dec0c288adea/tests/rsSupportMode/build.gradle You dont even have to load the native part in code, the library does this, and gradle adds the flavors for mips, arm and x86. And builds them (also natively). I tested this in an x86 emulator and on arm devices. I just set the abi filter to arm7 and not arm, because there is no arm5/6 support as of now

http://stackoverflow.com/comment/34911761
has text: Ohh.. Then his fault not you!!@IanNewson
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22879807

http://stackoverflow.com/q/22844420
tagged with: java
type: Question
score: 5
upvote count: 5
has title: Java TemporaryFolder getRoot() exception
accepted answer: http://stackoverflow.com/a/22844500
tagged with: junit
downvote count: 0
answer count: 1
favorite count: 0
has body: I'm trying to use org.junit.rules.TemporaryFolder in one of my junit to test File I/O. I've initialized it like this: Code: @Rule public TemporaryFolder temporaryFolder; @Before public void setup() { this.temporaryFolder = new TemporaryFolder(); } @After public void tearDown() {} @Test public void testCsvDataFile() throws IOException { File testCsvFile = this.temporaryFolder.newFile("text.csv"); FileWriter csvFileWriter = new FileWriter(testCsvFile); BufferedWriter bufferedWriter = new BufferedWriter(csvFileWriter); bufferedWriter.write("col1,col2,col3\n"); bufferedWriter.write("1,test1,val1\n"); bufferedWriter.write("2,test2,val2\n"); bufferedWriter.close(); Map&lt;Long,Data&gt; data = MyReader.readCSV(testCsvFile); assertTrue(2 == data.size()); } However, I get an exception: Exception: java.lang.IllegalStateException: the temporary folder has not yet been created at org.junit.rules.TemporaryFolder.getRoot(TemporaryFolder.java:127) at org.junit.rules.TemporaryFolder.newFile(TemporaryFolder.java:64) When I look at the TemporaryFolder code, it uses an internal attribute folder in the function getRoot() that is never set. The constructor sets a different field: parentFolder. There is a create() method that sets the folder variable but its marked to be for test purposes only. I am using JDK 1.7. Am I constructing the TemporaryFolder incorrectly? Is there anything else, a system property that needs to be set for this?
has answer: http://stackoverflow.com/a/22844500
type: AnsweredQuestion

http://stackoverflow.com/a/22872457
type: Answer
has comment: http://stackoverflow.com/comment/34898590
has comment: http://stackoverflow.com/comment/34898575
answers question: http://stackoverflow.com/q/22872176
has body: I believe you are looking for the Math.pow() method, which raises one number to the power of another, e.g. sum += (int) Math.power(matrixA[i][j], raiseByPower);
score: 0

http://stackoverflow.com/q/22954961
tagged with: java
has body: I have a jtextfield (jt) where I want as soon as the user types "e" for example in it, the word "Example" to be written automatically in the jtextfield. I use the code: KeyListener keyListener = new KeyListener() { public void keyPressed(KeyEvent e) { jt.setText("Example"); } } But this gives "Examplee" when e is pressed! Any ideas? Thanks a lot
tagged with: swing
tagged with: jtextfield
type: Question
has answer: http://stackoverflow.com/a/22955127
accepted answer: http://stackoverflow.com/a/22955127
has answer: http://stackoverflow.com/a/22955182
has comment: http://stackoverflow.com/comment/35047006
tagged with: keylistener
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35047905
possible better answer: http://stackoverflow.com/a/22955182
has comment: http://stackoverflow.com/comment/35047242
type: AnsweredQuestion
has title: Jtextfield and keylistener

http://stackoverflow.com/comment/34811295
has text: I am still lost with this explanation. I am more confused on my required code to halt the execution of the recursive function.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22824082

http://stackoverflow.com/a/22821204
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34818462
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22820869
answers question: http://stackoverflow.com/q/22820869
type: Answer
upvote count: 1
has body: If you use Hibernate you can try @NotFound(action = NotFoundAction.IGNORE) Otherwise you have to clean up your database (0 is not null). If there is no parent, the ORIG_TRANS_ID should be null
has comment: http://stackoverflow.com/comment/34809551
score: 1
has comment: http://stackoverflow.com/comment/34818444

http://stackoverflow.com/comment/34917284
comment on: http://stackoverflow.com/q/22882887
score: 0
type: Comment
type: QuestionComment
has text: have you tried, say, looking at the startup scripts?

http://stackoverflow.com/q/22849042
tagged with: opengl
tagged with: java
has body: As shown by the picture above, one vertex needs to map to two different uv coordinates. I know that I can index verities with another buffer by binding it to GL_ELEMENT_ARRAY_BUFFER, but this binds the the uv in the same index. I can't find any documentations or article showing how to index uv's. I think that there is a way to do this, because it seems like something that people would find useful. How do I do it ?
has comment: http://stackoverflow.com/comment/34859313
has title: Java vbo in opengl, indexing texture coordinates, is it possable?
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
score: 1
has answer: http://stackoverflow.com/a/22855174
tagged with: lwjgl
accepted answer: http://stackoverflow.com/a/22855174
upvote count: 1
tagged with: uv-mapping
answer count: 1

http://stackoverflow.com/a/22824863
upvote count: 8
score: 8
has body: Yes, there is a difference. The diamond operator is just a shortcut for specifying the whole generic type, because it can be inferred. These are equivalent: List&lt;String&gt; Fruits = new ArrayList&lt;&gt;(); and List&lt;String&gt; Fruits = new ArrayList&lt;String&gt;(); However, with no angle brackets at all, that means you're using a raw type, which is different than using generics on the class. This generates an unchecked assignment warning, and it should be avoided. List&lt;String&gt; Fruits = new ArrayList(); // warning!
type: Answer
answers question: http://stackoverflow.com/q/22824845
downvote count: 0
has comment: http://stackoverflow.com/comment/34842274

http://stackoverflow.com/a/22848461
score: 0
answers question: http://stackoverflow.com/q/22847052
type: Answer
has body: i don't know if you absolutely need to use a Set, if you use a Max Heap, it will always keep the maximum value at the top, no matter if you insert or remove anything. all you need is an arraylist. Use the comparator like the others have said and you'll be fine.

http://stackoverflow.com/q/22921877
tagged with: for-loop
has title: Is there a way to ignore the counter in a for loop?
score: 2
has answer: http://stackoverflow.com/a/22922312
downvote count: 0
has body: I want my for loop to not do the i++ if a certain condition applies. for (int i = 0; i &lt; r; i++) { for (int j = 0; j &lt; c; j = j+2) { int n = (int)(Math.random()*(474))+1; if(!myList.contains(n)) { myList.add(n); myList.add(n); } else { //Do not do i++ and j = j+2 } } }
has answer: http://stackoverflow.com/a/22922341
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/22921915
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/34988129
tagged with: java
has answer: http://stackoverflow.com/a/22921888
type: Question

http://stackoverflow.com/comment/35070161
comment on: http://stackoverflow.com/a/22967797
has text: OMG I spent one hour on this, convinced it was a signed/unsigned issue... Thank you for the tips.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34861657
has text: How are you able to first use the variable `newarray` and then declare it later?
type: QuestionComment
comment on: http://stackoverflow.com/q/22851999
type: Comment
score: 1

http://stackoverflow.com/a/22809388
answers question: http://stackoverflow.com/q/22809348
downvote count: 0
score: 4
type: Answer
has body: Collections.shuffle() will do it for you. Collections.sort() will sort it in the natural order (A,B,C,D,E..) if you want it to be sorted.
upvote count: 4

http://stackoverflow.com/comment/34831803
comment on: http://stackoverflow.com/q/22832344
score: 0
type: Comment
type: QuestionComment
has text: Is this your homework?

http://stackoverflow.com/q/22944057
has comment: http://stackoverflow.com/comment/35027945
has comment: http://stackoverflow.com/comment/35028014
tagged with: inheritance
has comment: http://stackoverflow.com/comment/35027728
has comment: http://stackoverflow.com/comment/35040318
has comment: http://stackoverflow.com/comment/35028176
has comment: http://stackoverflow.com/comment/35028194
has comment: http://stackoverflow.com/comment/35032017
has answer: http://stackoverflow.com/a/22944849
answer count: 1
has comment: http://stackoverflow.com/comment/35030355
downvote count: 0
has comment: http://stackoverflow.com/comment/35027826
has comment: http://stackoverflow.com/comment/35028050
tagged with: generics
favorite count: 0
has title: Java Generics - An Issue with Type Erasure?
type: UnansweredQuestion
score: 2
has body: I have a generic class, CodominantPopulation, which is a subclass of another generic class, SexualPopulation, which is itself a subclass of a generic class (Population). The aforementioned classes are defined as follows: public class CodominantPopulation&lt;O extends CodominantOrganism&gt; extends SexualPopulation&lt;O&gt; { public CodominantPopulation(List&lt;O&gt; organisms) { super(organisms); } ... } public class SexualPopulation&lt;O extends SexualOrganism&gt; extends Population&lt;O&gt; { public SexualPopulation(List&lt;O&gt; organisms){ super(organisms); } ... } The CodominiantOrganism above is a subclass of SexualOrganism, which is itself a subclass (as may be expected) of an Organism. Within CodominantPopulation, I call a function that is only available to CodominantOrganisms, called as follows: // in CodominantPopulation for (O organism : population){ // organism must be a CodominantOrganism CodominantGenotype.Dominance dominance = organism.getTraitDominance(trait); ... } Nonetheless, the runtime throws: Exception in thread "main" java.lang.ClassCastException: SexualOrganism cannot be cast to util.CodominantOrganism at CodominantPopulation.countDominance(CodominantPopulation.java:xx) ... I am not exactly sure how to interpret/fix this error. I have done some research and it seems as though this could be related to Java's type erasure - is this possible? I am passing objects of type CodominantOrganism to CodominantPopulation before the program is compiled. Edit: The definition for Population is as follows: public class Population&lt;O extends Organism&gt; { List&lt;O&gt; population; public Population(List&lt;O&gt; organisms){ this.population = new ArrayList&lt;&gt;(); this.population.addAll(organisms); } ... }
upvote count: 2
has comment: http://stackoverflow.com/comment/35028285
tagged with: java
has comment: http://stackoverflow.com/comment/35042760
type: Question

python
tags question: http://stackoverflow.com/q/22944444
tags question: http://stackoverflow.com/q/22811830
tags question: http://stackoverflow.com/q/22869360
tags question: http://stackoverflow.com/q/22891204
tag name: python
tags question: http://stackoverflow.com/q/22827410
tags question: http://stackoverflow.com/q/22894477
tags question: http://stackoverflow.com/q/22818593
tags question: http://stackoverflow.com/q/22889258
tags question: http://stackoverflow.com/q/22884220
tags question: http://stackoverflow.com/q/22905896
type: Tag
tags question: http://stackoverflow.com/q/22858830
tags question: http://stackoverflow.com/q/22904025
tags question: http://stackoverflow.com/q/22917436
tags question: http://stackoverflow.com/q/22825578
tags question: http://stackoverflow.com/q/22887400

http://stackoverflow.com/q/22884707
has comment: http://stackoverflow.com/comment/34920570
answer count: 1
linked to: http://stackoverflow.com/q/6607101
tagged with: scheduled-tasks
type: UnansweredQuestion
has title: How to schedule a periodic Java task under WebSphere 7?
has body: I need to have a Java method run every 30 seconds within a WebSphere 7 clustered environment (two boxes with 1 server each) - what's the current best-practice to do this while avoiding concurrency issues? Some more details: We've got records in an Oracle database that need to be twiddled exactly once. If they get double-twiddled, bad things will happen. So I'm imagining something like this: public synchronized void BatchTwiddle() { List myList = findRecordsToBeTwiddled(); twiddleRecords(myList); } public void twiddleRecords(myRecords myList) { ListIterator&lt;myRecord&gt; myRecordsIterator = myList.listIterator(); while (myRecordsIterator.hasNext()) { myRecordsIterator.next().twiddleRecord(); } } How do I get BatchTwiddle() called every thirty seconds when there's multiple servers (A total of 2) involved? Is it best to just run it on ONE server So far, I've been digging into the WebSphere Scheduler concept, using ScheduledExecutorService, or using EJB Timers, but nothing seems like a clear winner yet.
tagged with: java
has comment: http://stackoverflow.com/comment/34951126
has comment: http://stackoverflow.com/comment/34921165
has comment: http://stackoverflow.com/comment/35040397
type: Question
tagged with: jakarta-ee
tagged with: ejb
has answer: http://stackoverflow.com/a/22884743
has comment: http://stackoverflow.com/comment/34921052
score: 0
tagged with: websphere-7

http://stackoverflow.com/comment/34913402
type: Comment
comment on: http://stackoverflow.com/a/22880815
score: 0
has text: The answer already has an example: `assertEquals( expectedValue, actualValue, errorPermitted )`. The javadoc also has explanations.
type: AnswerComment

http://stackoverflow.com/q/22912859
has answer: http://stackoverflow.com/a/22912963
answer count: 3
has body: How to display hashmap values in an HTML dropdown box using Java? HashMap&lt;Integer,String&gt; hm =new HashMap&lt;Integer,String&gt;(); hm.put(1,"abc"); hm.put(2,"def"); hm.put(3,"ghi"); Using the jEasyUI framework with jQuery.
tagged with: drop-down-menu
has answer: http://stackoverflow.com/a/22913230
has comment: http://stackoverflow.com/comment/34971107
favorite count: 0
accepted answer: http://stackoverflow.com/a/22913230
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
downvote count: 1
has title: Display hashmap values in HTML dropdown box
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34974519
possible better answer: http://stackoverflow.com/a/22912963
has answer: http://stackoverflow.com/a/22913026

http://stackoverflow.com/a/22892060
has comment: http://stackoverflow.com/comment/34933728
type: Answer
answers question: http://stackoverflow.com/q/22891869
has comment: http://stackoverflow.com/comment/34933764
has comment: http://stackoverflow.com/comment/34933978
has comment: http://stackoverflow.com/comment/34933758
upvote count: 2
has comment: http://stackoverflow.com/comment/34933854
has comment: http://stackoverflow.com/comment/34934173
has comment: http://stackoverflow.com/comment/34934104
has comment: http://stackoverflow.com/comment/34933643
has comment: http://stackoverflow.com/comment/34933950
has comment: http://stackoverflow.com/comment/34933717
has comment: http://stackoverflow.com/comment/34934074
has body: You should just be able to do the following, although I recommend having a read of the official guide on fullscreen exclusive mode. FormTTS ftts = new FormTTS(); GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); gd.setFullScreenWindow(ftts); ftts.setUndecorated(true); ftts.setVisible(true);
has comment: http://stackoverflow.com/comment/34933806
has comment: http://stackoverflow.com/comment/34934234
score: 2
has comment: http://stackoverflow.com/comment/34934212
downvote count: 0
has comment: http://stackoverflow.com/comment/34934287
has comment: http://stackoverflow.com/comment/34934261
has comment: http://stackoverflow.com/comment/34933719
has comment: http://stackoverflow.com/comment/34933661
has comment: http://stackoverflow.com/comment/34933680

http://stackoverflow.com/q/22882489
has title: Java RMI server connection refused
tagged with: rmi
tagged with: java
possible better answer: http://stackoverflow.com/a/27576816
type: Question
has answer: http://stackoverflow.com/a/27576816
has answer: http://stackoverflow.com/a/22888098
accepted answer: http://stackoverflow.com/a/22888098
has body: RMI interface: import java.io.File; import java.rmi.Remote; import java.rmi.RemoteException; import java.util.List; public interface RMIinterface extends Remote { void getTrees() throws RemoteException; } Server class: import java.io.File; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.rmi.server.UnicastRemoteObject; import java.util.List; public class Server implements RMIinterface{ List&lt;File&gt; server_file_tree, server_folder_tree; @Override public void getTrees() throws RemoteException { // TODO Auto-generated method stub server_file_tree = Shared.getFileTree(Shared.serverRoot); server_folder_tree = Shared.getFolderTree(Shared.serverRoot); } public static void main (String args[]) { try { Server server = new Server(); RMIinterface stub = (RMIinterface) UnicastRemoteObject.exportObject(server, 0); Registry reg = LocateRegistry.getRegistry(); reg.bind("get_trees", stub); System.out.println("Server ready."); }catch (Exception e) { System.out.println("Server exception: " + e.toString()); e.printStackTrace(); } } } Exception: java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is: java.net.ConnectException: Connection refused java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is: java.net.ConnectException: Connection refused at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202) at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:341) at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source) at Server.main(Server.java:27) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(Abstrac…
score: 0
answer count: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/34971897
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22913321
score: 1
has text: @Mr.Pandey: Actually, you are, basically. The terms mean different things. The correct term for what Java has is "method", for the reasons given in the answer to that question. So that's the term they used.

http://stackoverflow.com/comment/34844244
comment on: http://stackoverflow.com/a/22842344
has text: Well, this is the problem with copy procedure. It constructs a new array and the sub-part of the original array is no more there. Anyways thanks for the correction.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35005135
has text: it is clear to him the purpose and seriousness of equals deviating from hashcode, he seems to be more bothered about that inorder to implement equals, he is forced to do floating point arithmetic which can be unpredictable sometimes
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/22931556
type: Comment

http://stackoverflow.com/a/22830868
type: Answer
has body: You can find them in init.ftl in your case. You can use that or you can hard code it there itself or in the init.ftl too. They are just variables
has comment: http://stackoverflow.com/comment/34823402
answers question: http://stackoverflow.com/q/22830692
score: 0

http://stackoverflow.com/a/41516746
has comment: http://stackoverflow.com/comment/70311935
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22842572
upvote count: 1
has body: I've used this because it seems to be the only way I can get as explicit as I want to: allowing(mockedFoo).bar( with(Expectations.&lt;Class&lt;Snafu&gt;&gt;anything()), with(any(Snafu.class)) );

http://stackoverflow.com/q/22817235
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/22871740
accepted answer: http://stackoverflow.com/a/22871740
score: 2
type: AnsweredQuestion
tagged with: keyevent
linked to: http://stackoverflow.com/q/14572270
type: Question
tagged with: java
tagged with: keylistener
tagged with: event-listener
upvote count: 2
linked to: http://stackoverflow.com/q/13026505
has body: I declare the following KeyEvents inside of my base testing class for an automation suite I'm running on an Android device for an application. private static final KeyEvent pressPowerDown = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_POWER); private static final KeyEvent pressPowerUp = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_POWER); I then figure out what activity is being run inside of the Android Test context, and cast that context to an activity to fire the events: if (_context instanceof Activity) { Activity activity = (Activity) _context; activity.dispatchKeyEvent(pressPowerDown); activity.dispatchKeyEvent(pressPowerUp); Upon examining the device during the automation, the KeyEvent mentioned above does not fire. I read about KeyListeners and simulating KeyEvents, but what I want to do here doesn't completely fall into either one of those categories (not using Robot, but an internal testing framework with its own Activity). My original thought was that I needed to refocus the activity, but now I'm starting to think that I need some sort of KeyListener, which I'm not sure where to put, given that this is a test suite, not an interface class; it doesn't have any kind of interfaces associated with it at all! If anyone knows how to create and fire KeyEvents inside of other programs, given that we don't have access to their internal mechanisms (the internal test tool cannot be modified - only the running state of the current test suite), it'd be greatly appreciated. EDIT: I tested to see if KeyEvent is ever consumed after attempting to fire it three times: System.out.println("Was the event consumed? " + activity.dispatchKeyEvent(pressPowerUp)) It was never fired, leading me to believe we need some kind of listener. If anyone has any idea how to implement a listener within a class, or if I'm allowed to declare a listener class and override the "dispatchKeyEvent" method, it'd be a great help.
downvote count: 0
answer count: 1
has title: How do you fire a Java KeyEvent inside an Android automation activity?

http://stackoverflow.com/comment/34883381
type: Comment
has text: Just to note: JDK-GregorianCalendar even needs catastrophic 2385 bytes!!! So JodaTime is much better. And JSR-310 (and my library) are further improved in serialization behaviour (around 100? bytes - cannot actually test).
score: 2
comment on: http://stackoverflow.com/a/22864131
type: AnswerComment

http://stackoverflow.com/comment/34983323
type: QuestionComment
comment on: http://stackoverflow.com/q/22919629
score: 0
has text: check out `indexOf()`, `length()`, `substring()` from String
type: Comment

datetime
tags question: http://stackoverflow.com/q/22917225
tags question: http://stackoverflow.com/q/22850574
tags question: http://stackoverflow.com/q/22810331
tags question: http://stackoverflow.com/q/22856931
tags question: http://stackoverflow.com/q/22878468
tags question: http://stackoverflow.com/q/22835041
tag name: datetime
tags question: http://stackoverflow.com/q/22894155
type: Tag
tags question: http://stackoverflow.com/q/22832248
tags question: http://stackoverflow.com/q/22893065
tags question: http://stackoverflow.com/q/22893888

http://stackoverflow.com/comment/34957077
has text: thanks for telling us. any question?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22904987

http://stackoverflow.com/a/22813520
downvote count: 0
upvote count: 2
type: Answer
has body: In every programming language consistency of your own code / library with the approach of the core libraries is of high value. Hence, inspecting how Collections.sort() or Collection.swap() and Collections.shuffle() are defined, I would suggest to not return the input parameter, if you intend to modify it. In addition, your method should be named in such a way, that it is obvious the input parameter gets modified. Otherwise your method will be considered to have side-effects. Returning a value most often suggests that it is a new instance which reflects the work, performed by the method or is used for method-chaining in case of builders.
score: 2
answers question: http://stackoverflow.com/q/22813318

http://stackoverflow.com/comment/34970888
score: 0
has text: I am trying filters but I am facing a NoSuchMethodError. Have a look in my [question](http://stackoverflow.com/q/22910580/2105307)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22908205

http://stackoverflow.com/q/22814320
answer count: 1
accepted answer: http://stackoverflow.com/a/22814412
has title: How Restart My Bingo Board when I clicked Button
score: 0
tagged with: user-interface
tagged with: jframe
tagged with: swing
has body: I searched 'How Restart my GUI if I pressed Button' or somethings and I changed my source, but it doesn't work. I want to chagne number to "X" when I clicked a Button. Container c = getContentPane(); c.setLayout(new GridLayout(5,5)); JB = new JButton[25]; for(int i=0; i&lt;1000; i++) { j = (int)(Math.random()*25); temp = nums[0]; nums[0] = nums[j]; nums[j] = temp; } for(int i=0; i&lt;JB.length; i++) { JB[i] = new JButton(nums[i]); JB[i].addActionListener(this); c.add(JB[i]); } setSize(400,400); setVisible(true); } public void actionPerformed(ActionEvent e) { for(int i=0; i&lt;nums.length; i++) { if (e.getSource() == JB[i]) { System.out.println(nums[i]); ***nums[i] = "X"; //I want show "X" when I clicked a Button*** JB[i] = new JButton(nums[i]); restart(); } } } public void restart() // I deleted. { start(); }
has answer: http://stackoverflow.com/a/22814412
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/22836314
answer count: 2
downvote count: 0
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/22843564
has title: Builder Pattern with Generics and a static inner Factory on the extended class
type: AnsweredQuestion
score: 3
tagged with: builder
tagged with: xmlbeans
upvote count: 3
tagged with: java
has body: I'm trying to implement the builder pattern for generating Apache XmlBeans objects. I've generated builders for all my classes, which inherit from: public abstract class Builder&lt;T extends XmlObject&gt; { protected T xmlObject; @SuppressWarnings("unchecked") public T build() { return (T) xmlObject.copy(); } } Then I've created several builders like this one (Time2Save inherits from XmlObject): public class Time2SaveBuilder extends Builder&lt;Time2Save&gt; { public Time2SaveBuilder(int amount, String unit) { xmlObject = Time2Save.Factory.newInstance(); xmlObject.setUnit(unit); xmlObject.setValue(amount); } } It works perfectly fine. But the problem I have is that I don't really like the duplication of having to instantiate the xmlObject in each builder, and I'd rather do it in the abstract Builder class if possible. So I've tried adding this constructor to the Builder class: @SuppressWarnings("unchecked") public Builder() { xmlObject = (T) T.Factory.newInstance(); } And leaving the implementations like this: public class Time2SaveBuilder extends Builder&lt;Time2Save&gt; { public Time2SaveBuilder(int amount, String unit) { xmlObject.setUnit(unit); xmlObject.setValue(amount); } } The problem is that I get the following error: Exception in thread "main" java.lang.ClassCastException: org.apache.xmlbeans.impl.values.XmlAnyTypeImpl cannot be cast to a.b.c.d.Time2SaveDocument$Time2Save I think XmlAnyTypeImpl is the result of calling the static XmlObject.Factory instead of one from the inheriting class (in this case, Time2Save). I'd like to know why this is happening (since I'm calling T.Factory and not XmlObject.Factory) and if there's any way to do this without duplicating the Factory call in each builder implementation. Thanks!
type: Question
accepted answer: http://stackoverflow.com/a/22843564
possible better answer: http://stackoverflow.com/a/22836847
has answer: http://stackoverflow.com/a/22836847
has comment: http://stackoverflow.com/comment/34855188

http://stackoverflow.com/a/22896515
type: Answer
score: 2
has body: Yes, it's possible. You can use a FetchCommand and then inspect the FetchResult. Something like this: Repository repository = FileRepositoryBuilder.create(gitDir); Git git = Git.wrap(repository); FetchResult result = git.fetch().call(); for (TrackingRefUpdate refUpdate : result.getTrackingRefUpdates()) { // ... }
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22888559
answers question: http://stackoverflow.com/q/22888559

http://stackoverflow.com/comment/34885472
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22863641
score: 0
has text: You say you remove destroyed objects. Yet all the code you show uses *clones* of the main list. Most likely you're removing from the wrong list - although this is of course only a guess since the actual code isn't shown.

http://stackoverflow.com/comment/35002746
has text: Are you using @RunWith(MockitoJUnitRunner.class) on your test or perhaps are you using MockitoAnnotations.initMocks(this)? If you are not using any of these, the annotations have no effect
comment on: http://stackoverflow.com/q/22917585
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22959550
type: Answer
answers question: http://stackoverflow.com/q/22958710
score: 1
upvote count: 1
has body: This should do the trick for you: myEnum.toEnumerationType(myEnum.name) [ myEnum.items.forEach [ literal | myEnum.toEnumerationLiteral(literal) ] ]
downvote count: 0

http://stackoverflow.com/a/22986805
type: Answer
has comment: http://stackoverflow.com/comment/35104643
has comment: http://stackoverflow.com/comment/35106896
answers question: http://stackoverflow.com/q/22958002
has comment: http://stackoverflow.com/comment/35104696
has comment: http://stackoverflow.com/comment/35104921
has comment: http://stackoverflow.com/comment/35104822
score: 0
has body: So I found the solution for my problem. Thank you so much Puce for your help! :-) Now I set Client via the property like that: private ObjectProperty&lt;Client&gt; clientProperty = new SimpleObjectProperty&lt;Client&gt;(); Additionally I added a ChangeListener in the constructor of ClientControl: public ClientControl(ObservableList&lt;Client&gt; suggestions) { clientProperty.addListener(new ChangeListener&lt;Client&gt;() { @Override public void changed(ObservableValue&lt;? extends Client&gt; observable, Client oldValue, ClientnewValue) { if(newValue != null) { setLabelText(newValue.toString()); } } }); setSuggestions(suggestions); FXMLLoader loader = new FXMLLoader(getClass().getResource("ClientControl.fxml")); loader.setRoot(this); loader.setController(this); try { loader.load(); } catch (IOException e) { throw new RuntimeException(e); } initTextField(); } My ClientCell class needed only some simple changes because of the changes in ClientControl: public class NewClientCell extends TableCell&lt;Client, Client&gt; { private final ClientControl cc; public NewClientCell(ObservableList&lt;Client&gt; suggestions) { cc = new ClientControl(suggestions); this.setAlignment(Pos.CENTER_LEFT); this.setGraphic(cc); this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } @Override protected void updateItem(Client c, boolean empty) { super.updateItem(c, empty); if(!empty){ cc.setClient(c); } } } In the main program nothing changed. In conclusion I would like to thank Puce one more time, I stuck at this problem for many days...

http://stackoverflow.com/comment/34932774
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22891115
has text: I'm not sure what you're asking me, but that code doesn't seem right. Have a look at ccjmne's answer (which is kind of equivalent to my previous comment). It's not Java, but it does contain all the logic you need.
score: 0

http://stackoverflow.com/a/22872294
has comment: http://stackoverflow.com/comment/34899087
accepted answer of: http://stackoverflow.com/q/22872260
has body: This is due to floating point imprecision. Floating-point numbers (float, double in Java) cannot represent some numbers exactly. If you're looking for absolute precision, look into BigDecimal.
type: Answer
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/34904306
answers question: http://stackoverflow.com/q/22872260
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34871470
type: Comment
has text: it doesn't have.. but how can i parse this format..
score: 0
comment on: http://stackoverflow.com/q/22857710
type: QuestionComment

http://stackoverflow.com/comment/34809305
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22822894
has text: You aren't showing all the code. Clearly `head` must be declared somewhere, probably in a `LinkedList` class?
score: 0

http://stackoverflow.com/comment/88984132
score: 10
type: Comment
type: QuestionComment
has text: Professional Java programmer with plenty of streams & Optional experience…I still end up here sometimes. And this is why I prefer Kotlin.
comment on: http://stackoverflow.com/q/22917138

http://stackoverflow.com/comment/35063421
has text: That's no initialization, it's a declaration. After that `spriteBlueWins`is `null`. You will have to initialize it, as you are doing some lines above line 84 for your `spriteRedWins`.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22963904

http://stackoverflow.com/a/22865738
has comment: http://stackoverflow.com/comment/34965300
type: Answer
has body: I don't use Spring so I don't know whether this will work for you but try and make your setter work "normally" and transform your getter to this: public Optional&lt;String&gt; getFoo() { return Optional.fromNullable(foo); } If foo is null, it will be an Optional.absent() for which .isPresent() will return false. In Java 8 (which has "stolen" Optional from Guava) the API is a little different; it is not Optional.absent() but Optional.empty(), and .fromNullable() has become .ofNullable().
has comment: http://stackoverflow.com/comment/34966556
score: 0
answers question: http://stackoverflow.com/q/22839003

http://stackoverflow.com/comment/35109169
comment on: http://stackoverflow.com/a/22963875
type: Comment
has text: i am not sure what does mean by repository here. if its Spring JPA Data api. then it would return Entity . if you refer hibernate session ( i expect the variable name changed to session) then it would return the newly created Id. So all the way you will get the newly created id.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34845509
has text: ANSI-SQL-DATE is not supposed to have a time part. Oracle just tries to follow this definition of column type. All OK. If you want date AND time then you have to choose the column type TIMESTAMP.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22842930

http://stackoverflow.com/q/22809076
tagged with: java
has comment: http://stackoverflow.com/comment/34783756
has body: I want to use the same function in DAO, suppose getBalances() with secure SERIALIZABLE isolation: @Transactional(isolation=Isolation.SERIALIZABLE) public List&lt;Balance&gt; getBalances() { ... } in important business logic method: public doVeryImportantFinancialChanges() { .. complicated logic with multiple getEntries() calls, multiple SELECT/UPDATE... } but also I want to have unsafe "life view" of balances called every 1-2 seconds with SELECT only and acceptable broken integrity and all those nonrepeatable, phantom etc. data. The problem is that my "life view" scheduled SELECT requestor uses getBalances() highly isolated function, and gets: org.springframework.dao.DeadlockLoserDataAccessException: PreparedStatementCallback; SQL [SELECT * FROM ....]; Deadlock found when trying to get lock; try restarting transaction; How to achieve double (safe-serializable and unsafe) access to same method getBalances() from different call sources?
type: Question
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22809197
tagged with: deadlock
tagged with: sql
answer count: 1
score: 1
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22809197
has title: Spring @Transactional with different Isolation levels from different call sources
tagged with: transactions

http://stackoverflow.com/q/22895344
has comment: http://stackoverflow.com/comment/34939562
answer count: 1
tagged with: repaint
accepted answer: http://stackoverflow.com/a/22896090
has body: I'm having problems repainting a class after I have added an object to it. public class Window extends JFrame { /** * */ private static final long serialVersionUID = 1L; private MediaHandler myMediaHandler = new MediaHandler(this); class MenuActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { String buttonText = e.getActionCommand(); switch(buttonText) { case "Add Movie": AddMovieWindow addMovieGUI = new AddMovieWindow(myMediaHandler); addMovieGUI.setVisible(true); break; case "Add TV-Show": AddTVShowWindow addTVShowGUI = new AddTVShowWindow(myMediaHandler); addTVShowGUI.setVisible(true); break; } } } public Window() { // myMediaHandler.addMovie("Nineteen Eighty-Four", 113.00, 1984, "Michael Radford", "mediaPath", "https://dl.dropboxusercontent.com/u/16670644/Projekt/1984.png", "HD", false, "Eng", "George Orwell (novel)"); addComponents(); configurFrame(); addMenu(); validate(); repaint(); } private void addMenu() { JMenuBar bar = new JMenuBar(); JMenu menu = new JMenu("Menu"); bar.add(menu); JMenuItem item = new JMenuItem("Add Movie"); item.addActionListener(new MenuActionListener()); menu.add(item); item = new JMenuItem("Add TV-Show"); item.addActionListener(new MenuActionListener()); menu.add(item); this.setJMenuBar(bar); } private void configurFrame() { this.setSize(1205, 850); this.setTitle("Video Library"); this.setLocationRelativeTo(null); this.setResizable(false); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.setIconImage(new ImageIcon("E:\\Dropbox\\Dropbox\\Programmering\\Java\\Projekt IV 1\\icon.png").getImage()); try { java.net.URL where = new URL("https://dl.dropboxusercontent.com/u/16670644/Projekt/BackGround.png"); ImageIcon image = new ImageIcon(where); JLabel imageLabel = new JLabel(image); this.add(imageLabel); } catch (MalformedURLException e) { // TODO Auto-generated catch block System.out.println("Error loading Background that makes the background image"); e.printStackTrace(); } }…
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/22896090
has comment: http://stackoverflow.com/comment/34939487
has title: Repaint JPanel from different class
score: 0
has comment: http://stackoverflow.com/comment/34939634

http://stackoverflow.com/q/22817775
has title: scaling Neo4J for simultaneous writes/merge queries
downvote count: 0
tagged with: neo4j
favorite count: 0
has comment: http://stackoverflow.com/comment/34809140
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22861843
upvote count: 2
has body: With NodeJS, I'm collecting this data to Neo4J: user (id, login) app (id, title) machine (id, address) This is totally async. This means that many times I can get info about a USER and APP that does'n exists yet in database. So, instead just CREATE items and then CREATE relationships, I need to run for each row a MERGE in USER and APP to ensure they are in database. After this I can create relationships. I'm sending to /cypher endpoint. params:{props:objects_array}, query:[ ' FOREACH (p IN {props} | ', ' MERGE (u:user {id:p._user_id}) SET u.id = p._user_id ', ' MERGE (a:app {id:p._app_id}) SET a.id = p._app_id ', ' MERGE (m:machine {id:p._machine_id}) SET m.id = p._machine_id ', ' MERGE (u)-[:OPENED]-&gt;(a) ', ' MERGE (a)-[:USERS]-&gt;(u) ', ' MERGE (u)-[:WORK_IN]-&gt;(m) ', ' )', ].join("") This is working, but is so slow. I'm controlling balance by changing simultaneous requests and rows per requests. With 5 simultaneous requests and 500 rows each, it works with 4 deadlock errors and takes 2 minutes to complete 5000 rows. The problem is it takes 2-core CPU to 99% (digitalocean 4gb RAM) all the time, and I need scale this to 150 simultaneous requests, not just 5. I think possible solutions are: vertical scale to a quad-core (solve just for now, not long time solution) database replicas to distribute operations (is this possible?) some way to use CREATE instead MERGE. this is extremely faster, but I need ensure unique ID's and different properties. maybe using constraints? is neo4j really able to handle this amount of data?
has answer: http://stackoverflow.com/a/22838890
tagged with: java
has comment: http://stackoverflow.com/comment/34856617
type: Question
possible better answer: http://stackoverflow.com/a/22861843
has comment: http://stackoverflow.com/comment/34811269
answer count: 2
accepted answer: http://stackoverflow.com/a/22838890

http://stackoverflow.com/q/22874109
tagged with: java
tagged with: image
tagged with: import
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22879025
type: Question
has title: Creating a method containing image imported from files
has body: I wanted to create method out of //create textures section to shorten the run() , but if I do and pass the images from //import section as arguments, then call it like: createTextures(texture, texture2,ballTextureImport, greenFlashImport, blueFlashImport); the method drawGraphics can't see them. drawGraphics() is just repeated add(everyParameter); Here's part of the code inside run(): // import Image texture = getImage(getCodeBase(), "texture.png"); Image texture2 = getImage(getCodeBase(), "texture2.png"); Image ballTextureImport = getImage(getCodeBase(), "ballTexture.png"); Image greenFlashImport = getImage(getCodeBase(), "greenFlash.png"); Image blueFlashImport = getImage(getCodeBase(), "blueFlash.png"); // create textures GImage paddleLeftTexture = new GImage(texture); GImage paddleRightTexture = new GImage(texture2); GImage ballTexture = new GImage(ballTextureImport); GImage greenFlash = new GImage(greenFlashImport, -250, 0); GImage blueFlash = new GImage(blueFlashImport, -250, 0); paddleLeftTexture.setSize(WIDTH + 1, HEIGHT + 1); paddleRightTexture.setSize(WIDTH + 1, HEIGHT + 1); ballTexture.setSize(BALL_SIZE, BALL_SIZE); greenFlash.setSize(100, 300); blueFlash.setSize(100, 300); // make objects GOval ball = makeBall(); GRect paddleLeft = makePaddle(); GRect paddleRight = makePaddle(); drawGraphics(ball, paddleLeftTexture, paddleRightTexture, ballTexture, greenFlash, blueFlash, counter, paddleLeft, paddleRight, aiScore, playerScore); the remaining arguments from drawGraphics() are created earlier in run() and in //make objects and look fine (are not underlined in red).
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22879025

http://stackoverflow.com/comment/52350767
type: AnswerComment
comment on: http://stackoverflow.com/a/22815270
has text: Can you please add a code block demonstrating how a bounded type parameter achieves the same goal of a method returning a wildcard? Ideally, provide methods (one for each type) and show that they allow the same expressiveness while eliminating the need for wildcards in client code.
score: 0
type: Comment

http://stackoverflow.com/a/22835662
type: Answer
answers question: http://stackoverflow.com/q/22835472
has body: I'm not great with java but if i remember right, To validate a string in java looks like this: if(cellnum.matches(\\d{3}-\\d{3}-\\d{4}) {//this is valid}
score: 0

http://stackoverflow.com/a/22939056
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35018698
has body: First of all - write out what exactly is contained in file name variable after this line. String fileName = input.next(); Then check what happens in the s.wavRead method. BTW, where does the Sound class comes from? Is it your class? If yes, debug the wavRead method and check what happens there.
answers question: http://stackoverflow.com/q/22938802

http://stackoverflow.com/a/22951374
answers question: http://stackoverflow.com/q/22951325
has body: You need to ask yourself the question: does it matter how fast it is. If it doesn't, don't make code more complex. "Premature optimization is the root of all evil". Once you have confirmed that performance is relevant, try to create a benchmark e.g. using JMH and with that in place, start to optimise.
has comment: http://stackoverflow.com/comment/35123692
has comment: http://stackoverflow.com/comment/35047688
score: 0
has comment: http://stackoverflow.com/comment/35041005
has comment: http://stackoverflow.com/comment/35123130
type: Answer
has comment: http://stackoverflow.com/comment/35047371
has comment: http://stackoverflow.com/comment/35041172
has comment: http://stackoverflow.com/comment/35048039
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/34886402
score: 0
has text: Yes, it just makes the background (the jframe) blue
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22865976

http://stackoverflow.com/a/22915694
has comment: http://stackoverflow.com/comment/34977590
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/34976708
score: 2
accepted answer of: http://stackoverflow.com/q/22915640
answers question: http://stackoverflow.com/q/22915640
has body: Just return the pretty printed Gson output String pretty = gson.toJson(system); return pretty; which has the value { "Lights": "On", "Front Door": "Unlocked", "Window 3": "Unlocked", "Window 2": "Unlocked", "System": "Disarmed", "Back Door": "Unlocked", "Window 1": "Unlocked" }
has comment: http://stackoverflow.com/comment/34977461
has comment: http://stackoverflow.com/comment/34976861
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22968064
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/67610219
has comment: http://stackoverflow.com/comment/35070391
has body: Trying to create an epoch value, in Java, where returned value is between now and 14 days ago. I'm using java.util.Random.nextInt(value) and passing in 1209600, basically 14 days. But the returned value is never older then today, how come? public class Debug { private static final Random rng = new Random(); public static void main(String[] args) { long now = System.currentTimeMillis(); long timeSinceLastVisit = rng.nextInt(14 * 24 * 60 * 60); long timeOfLastVisit = now - timeSinceLastVisit; String date = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new java.util.Date (timeOfLastVisit)); System.out.println("1. " + timeOfLastVisit); System.out.println(date); } } 5 sample outputs: 1. 1397057814065 04/09/2014 16:36:54 1. 1397058754779 04/09/2014 16:52:34 1. 1397058553618 04/09/2014 16:49:13 1. 1397058294674 04/09/2014 16:44:54 1. 1397058408390 04/09/2014 16:46:48
tagged with: random
answer count: 3
linked to: http://stackoverflow.com/q/38922754
has title: Creating a random epoch value ranging from X days ago and now
downvote count: 0
favorite count: 0
tagged with: epoch
has answer: http://stackoverflow.com/a/22968167
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22968167
has answer: http://stackoverflow.com/a/22968440
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/67610219

http://stackoverflow.com/a/22957121
has comment: http://stackoverflow.com/comment/35051993
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35061429
has comment: http://stackoverflow.com/comment/35051570
has comment: http://stackoverflow.com/comment/35051105
accepted answer of: http://stackoverflow.com/q/22956942
type: Answer
has comment: http://stackoverflow.com/comment/35051329
answers question: http://stackoverflow.com/q/22956942
has body: You can use the matching method with wildcard characters in your string: ? represents a single character and * represents any character sequence So your code, for example, could be: Query query = queryBuilder.keyword().onField("normVal").matching("*asthme*").createQuery(); You can find more details here Edit after OP comment If you have fixed values to search, like words with articles, you can also try something like this instead of wildcars: Query query = queryBuilder.bool() .should(queryBuilder.keyword().onField("normVal").matching("l'asthme").createQuery()) .should(queryBuilder.keyword().onField("normVal").matching("d'asthme").createQuery()) .should(queryBuilder.keyword().onField("normVal").matching("asthme").createQuery()) .createQuery(); Please notice that the should method will work like an OR query operator
score: 1
upvote count: 1

http://stackoverflow.com/q/22857822
answer count: 2
has answer: http://stackoverflow.com/a/22858217
downvote count: 0
has title: Take configuration file out of jar and access it?
has comment: http://stackoverflow.com/comment/34871708
has answer: http://stackoverflow.com/a/22857991
has body: I have two project - foo and bar. Foo is the main project and it depends on bar project. Foo is also the project that holds the configuration file (conf.xml). These project are packaged as separate jars. Conf.xml is included in foo.jar and the main class accesses it like this: MyApp.class.getClassLoader().getResource("conf.xml"); To run these i type on command line: java -cp "*" com.example.MyApp Everything works fine. My question is that sometimes i want to change the conf.xml without rebuilding the project. So i would like to take conf.xml out of the jar so i can edit it myself. The problem then is that the class inside the jar cant find the conf.xml anymore. Can this be fixed without changing the code in my classes?
linked to: http://stackoverflow.com/q/2232602
favorite count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/22936711
type: Question
tagged with: jxl
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23090840
type: UnansweredQuestion
has title: Edit cells with number values using JXL
tagged with: numbers
has body: sheetToEdit.addCell(new Label(j, i, s[i])); In the above line, Label takes only the string values. But I want to add the cells in the rows with the number (double) values. Is there any other method in JXL by which I can add cells with number values.
tagged with: java

http://stackoverflow.com/q/22950053
tagged with: android
has body: for (int i = 0; i &lt; nodeList.getLength(); i++) { Element e = (Element) nodeList.item(i); event.setName(parser.getValue(e, NODE_NAME)); event.setDate(parser.getValue(e, NODE_DATE)); event.setLocation(parser.getValue(e, NODE_LOC)); Log.d("Thisworks!:", event.getName()); eventsList.addLast(event); } for (Event curevent : eventsList) { Log.d("ThisDoesnt!?:", curevent.getName()); } Output should be: name1 name1 name1 name2 name2 name3 name3 Thisworks! outputs different values every time, as expected. But when i loop through the list and output, it only outputs: name3 name3 name3 name3 name3 name3 name3 Am i missing something completely obvious here?
tagged with: java
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/22950182
has title: Linked/ArrayList not functioning as expected
has answer: http://stackoverflow.com/a/22950061
type: UnansweredQuestion

http://stackoverflow.com/comment/34874222
type: QuestionComment
comment on: http://stackoverflow.com/q/22858506
has text: An A in ASCII = 0x41. So i would like to be able to use the method like this, writeHex("41") and on the otherside of the Bluetooth connection in hyperterminal get 'A'. For some reason I get 441 come up in hyperterminal
score: 0
type: Comment

http://stackoverflow.com/a/22812428
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22812295
has body: Thanks @mthmulders for the fix! The problem was that Accept-Language was not defined, causing PHP to error. Setting this to a language ("en", "de", "fr") fixed the problem. Fixed Code: DefaultHttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); httpGet.setHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/536.28.10 (KHTML, like Gecko) Version/6.0.3 Safari/536.28.10"); httpGet.setHeader("Accept-Language", "en"); try { HttpResponse execute = client.execute(httpGet); InputStream content = execute.getEntity().getContent(); BufferedReader buffer = new BufferedReader(new InputStreamReader(content)); String s = ""; while ((s = buffer.readLine()) != null) { builder.append(s); } } catch (Exception e) { e.printStackTrace(); }
type: Answer
answers question: http://stackoverflow.com/q/22812295
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/22844853
tagged with: java
accepted answer: http://stackoverflow.com/a/22846123
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/22846123
score: 0
has title: Android View.GONE option and overall app speed
answer count: 1
tagged with: android
has body: My app is really really laggy.Because i'm using many views&amp;layouts with it. If you want to see what i'm talking about check DO Launcher app from playstore. :) I'm developing a launcher and that has a RSS feed &amp; Twitter Stream on left page. But lags happens when page changes to left page. I'm thinking about to use (View.gone) when user changed the page. And is that makes any difference ? i want to block lags.Maybe View.gone can solve the lag problem.So lags never will be happen again when View gone. Or View.gone just hides the view,and keeps all other stuff on background ui and makes device laggy. I mean does View.gone increase the speed overall ?
type: AnsweredQuestion
tagged with: view

http://stackoverflow.com/comment/34880855
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22863079
score: 1
has text: +1 Works for me, in Windows 7. Although looking at other questions on this subject, it's possible results may vary according to platform.

http://stackoverflow.com/comment/34952444
comment on: http://stackoverflow.com/q/22902019
type: Comment
type: QuestionComment
has text: I think you should define default SharedPreference values so first time it sets them as a value and won't give you exception.
score: 0

http://stackoverflow.com/comment/34821635
score: 0
type: Comment
type: QuestionComment
has text: and what do you mean by display? Do you want to print them?
comment on: http://stackoverflow.com/q/22829921

http://stackoverflow.com/comment/34893976
has text: Bottom line: the JAR isn't in the classpath on the server.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22870236

http://stackoverflow.com/comment/35045308
type: Comment
has text: No . . , I tried like this . . , no error but image is not displaying. . .
comment on: http://stackoverflow.com/a/22936708
type: AnswerComment
score: 0

http://stackoverflow.com/q/22887170
tagged with: javafx-2
has answer: http://stackoverflow.com/a/22888726
type: AnsweredQuestion
has title: Using JavaFX's MenuBar causes 'Glass detected outstanding Java exception'
tagged with: java
has comment: http://stackoverflow.com/comment/34927002
has comment: http://stackoverflow.com/comment/34927751
has body: I have a JavaFX Application. I have a button that when clicked calls an action and loads another fxml file. This works perfectly. I decided to place this functionality from within the menu of the application. So, I created a Menu and I added Menu Items from within the Scene builder. I properly assign the 'On Action' event, the same way I did with my other button. However I get the following error when I click: Glass detected outstanding Java exception at -[GlassViewDelegate sendJavaMouseEvent:]:src/com/sun/mat/ui/GlassViewDelegate.m:541 Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException Caused by: java.lang.ClassCastException: javafx.scene.control.MenuItem cannot be cast to javafx.scene.Node at plataformavalidezpredictiva.MainController.handleAction(MainController.java:60) ... 38 more This is the code for the handler. Once again, this works for a button I placed within the UI and doesn't work from the menu bar: public void handleAction(ActionEvent event) throws Exception{ Node node = (Node)event.getSource(); Stage stage=(Stage) node.getScene().getWindow(); FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("fxml/GUIFile.fxml")); Parent root = (Parent)fxmlLoader.load(); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } The line that seems to give me the problem is: Node node = (Node)event.getSource(); Any ideas? Edit: I saw the post here Unable to get Scene from MenuItem in JavaFX but that didn't work for me, because it didn't find the getScene() method for the menu bar.
has comment: http://stackoverflow.com/comment/34926765
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/22888726
answer count: 1
linked to: http://stackoverflow.com/q/20594392

http://stackoverflow.com/comment/34844449
comment on: http://stackoverflow.com/q/22842833
score: 0
type: Comment
has text: I think you don't need this line `LL.addView(b);` because button is already a child of LL
type: QuestionComment

http://stackoverflow.com/q/22848102
has comment: http://stackoverflow.com/comment/34854333
has answer: http://stackoverflow.com/a/22849366
type: AnsweredQuestion
score: 3
has title: Objects from ArrayList to Arrays
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34855091
type: Question
has body: I am fetching some information from a database. I have a method the makes ArrayList of objects of the given tables. Like Tools, Customer and etc. I was wondering if it was possible to make a small helping-method that takes in an ArrayList and return a list(Tool[]) dynamic of the type of content or do i have to make method per type of objects? Is there a more dynamic way to solve it? This is not the method, but an example of a method for a given type of objects, dont bother about compiling and logic in the code, its just for the example: public Verktoy[] ToolsArray(ArrayList&lt;Verktoy&gt; b){ Verktoy[] a = new Verktoy[b.size()]; for(int i = 0; i&lt;b.size(); i++){ a[i] = b.get(i); } return a; }
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22848153
accepted answer: http://stackoverflow.com/a/22849366
has answer: http://stackoverflow.com/a/22848153
tagged with: arraylist
answer count: 3
has comment: http://stackoverflow.com/comment/34855367
downvote count: 0
linked to: http://stackoverflow.com/q/7969023
favorite count: 0
has answer: http://stackoverflow.com/a/22848170
has comment: http://stackoverflow.com/comment/34854739
has comment: http://stackoverflow.com/comment/34855109
has comment: http://stackoverflow.com/comment/34854745

http://stackoverflow.com/a/24003733
has body: If you are able to set a fixed number of calls to expect, it can be done with an ArgumentCaptor: import static org.hamcrest.CoreMatchers.hasItem; @Captor ArgumentCaptor&lt;String&gt; arg; @Before public void setUp() throws Exception { // init the @Captor initMocks(this); } @Test public void testWithTimeoutCallOrderDoesntMatter() throws Exception { // there must be exactly 99 calls verify(myMock, timeout(5000).times(99)).myMethod(arg.capture()); assertThat(arg.getAllValues(), hasItem("expectedArg")); } Another way is to specify all the expected values to verify, but those need to be provided in the exact order that they are invoked. The difference to the above solution is that this doesn't fail even if the mock is additionally called with some non-verified arguments. In other words, no need to know the number of total invocations. Code example: @Test public void testWithTimeoutFollowingCallsDoNotMatter() throws Exception { // the order until expected arg is specific verify(callback, timeout(5000)).call("firstExpectedArg"); verify(callback, timeout(5000)).call("expectedArg"); // no need to tell more, if additional calls come after the expected arg // verify(callback, timeout(5000)).call("randomArg"); }
upvote count: 69
has comment: http://stackoverflow.com/comment/97078160
downvote count: 0
score: 69
type: Answer
answers question: http://stackoverflow.com/q/22944202

http://stackoverflow.com/q/22884892
linked to: http://stackoverflow.com/q/21950672
duplicate of: http://stackoverflow.com/q/4931892
has answer: http://stackoverflow.com/a/22884923
type: Question
upvote count: 1
favorite count: 0
has body: I am using Java 1.6 final double check = 3 / 4; System.out.println(check); Console is showing: 0.0 Why is this happening? Shouldn't it come out 0.75?
has answer: http://stackoverflow.com/a/22884910
has title: Java: Why is this double variable coming out 0?
has answer: http://stackoverflow.com/a/22884913
answer count: 4
duplicate of: http://stackoverflow.com/q/21950672
tagged with: zero
has comment: http://stackoverflow.com/comment/34920880
tagged with: double
has comment: http://stackoverflow.com/comment/34920895
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22884907
accepted answer: http://stackoverflow.com/a/22884907
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/22884910
tagged with: java

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/22962667
type: Tag

http://stackoverflow.com/q/22903953
answer count: 1
type: UnansweredQuestion
tagged with: wildfly
has title: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory for wildfly 8.0
tagged with: java
type: Question
tagged with: jakarta-ee
has body: I am trying to migrate my applicaiton from jboss 3.2 to wildfly.. when I tried to deploy my ear file, I am getting Following exception.. Can't get data source due to JNDI failure, NamingException = JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.MyApp.war:main" from Service Module Loader.. is "org.jnp.interfaces.NamingContextFactory" was removed from wildfly 8.0? Is it any alternative for this?
score: 0
has answer: http://stackoverflow.com/a/22931947

http://stackoverflow.com/comment/34827107
score: 0
comment on: http://stackoverflow.com/q/22832042
type: Comment
type: QuestionComment
has text: edittext is in register_fragment. i tried to implment textwatcher in the activity, but when i added the listner to the edittext in onCreate, the app crashed hen activity is open

http://stackoverflow.com/a/22856349
has body: A quick and dirty solution without checking error conditions: public static void main(String[] args) { String str="Hello 42 World!"; System.out.println(customSubstringMethod(str, "Hello", "World!")); } private static String customSubstringMethod(String str, String start, String stop) { return str.substring(str.indexOf(start) + start.length(), str.indexOf(stop)); } Besides, you need to know more then the index of the prefix string. The length is required as well.
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/22856257
upvote count: 4
answers question: http://stackoverflow.com/q/22856257
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22862207
has comment: http://stackoverflow.com/comment/34879298
answers question: http://stackoverflow.com/q/22862110
accepted answer of: http://stackoverflow.com/q/22862110
has comment: http://stackoverflow.com/comment/34886024
upvote count: 1
type: AcceptedAnswer
has body: Add following line in http connection conn.setRequestProperty("Connection", "close");
type: Answer
has comment: http://stackoverflow.com/comment/34879550
downvote count: 0
score: 1

http://stackoverflow.com/q/22932730
tagged with: java
has title: How to query scheduled processes (timer events)?
has body: If I schedule the start time of processes by using timer start events, how can I query which processes will start and when? Also, I have the same question for the catching timer intermediate event. Does the camunda engine provides an API (Java or REST) to query which timers are running and when they are expected to expire?
has answer: http://stackoverflow.com/a/22935808
downvote count: 0
answer count: 1
favorite count: 0
tagged with: camunda
tagged with: rest
tagged with: business-process-management
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/22935808

http://stackoverflow.com/a/22920511
accepted answer of: http://stackoverflow.com/q/22920343
has body: Where is it, relative to relative to the project, to find it relative it would be BufferedReader reader = new BufferedReader(new File("hierarchy relative to project folder, ex; "bin/com/me/proj/hello"));
score: 3
has comment: http://stackoverflow.com/comment/34991015
has comment: http://stackoverflow.com/comment/34985625
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34987639
answers question: http://stackoverflow.com/q/22920343
type: Answer
upvote count: 3

http://stackoverflow.com/comment/35006155
comment on: http://stackoverflow.com/a/22901432
type: AnswerComment
score: 0
type: Comment
has text: "`public class LList <T extends Comparable <T>> implements Comparable<LList>`" <-- the `LList` at the end is a raw type. `LList` is a generic type and you didn't put type arguments on it.

http://stackoverflow.com/q/22859721
favorite count: 0
has comment: http://stackoverflow.com/comment/34875316
has comment: http://stackoverflow.com/comment/34875765
has title: JTextArea line numbers of menu item
type: UnansweredQuestion
tagged with: swing
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22868310
tagged with: jtextarea
tagged with: java
score: -1
has body: I am trying to develop a project using AWT And SWING concepts of Java. In that I have an one menu item called "Viewline Numbers (i.e. we have chosen a JCheckBox for that)". When I check the Check-box it is displaying line numbers in another Document. But, I want to display the line numbers in same using Document like as Editplus Editor. Here is my code private void ViewLineNumbersActionPerformed(java.awt.event.ActionEvent evt) { lines = new JTextArea(""); lines.setBackground(Color.LIGHT_GRAY); lines.setEditable(false); lines.setSize(10,10); tx.getDocument().addDocumentListener(new DocumentListener(){ public String getText(){ int caretPosition = tx.getDocument().getLength(); // System.out.println("caretPosition"+ caretPosition); Element root = tx.getDocument().getDefaultRootElement(); // System.out.println("root"+ root); String text = "1" + System.getProperty("line.separator"); int c=root.getElementIndex( caretPosition ); // System.out.println(c); for(int i = 2; i &lt; c + 2; i++){ text += i + System.getProperty("line.separator"); } return text; } @Override public void `enter code here`changedUpdate(DocumentEvent de) { lines.setText(getText()); } @Override public void insertUpdate(DocumentEvent de) { lines.setText(getText()); } @Override public void removeUpdate(DocumentEvent de) { lines.setText(getText()); } }); sp.getViewport().add(tx); // sp.setViewportView(tx); sp.setRowHeaderView(lines); }
upvote count: 0
answer count: 1

selection
tags question: http://stackoverflow.com/q/22898530
type: Tag
tag name: selection
tags question: http://stackoverflow.com/q/22857833

http://stackoverflow.com/comment/35052324
type: QuestionComment
has text: you have to synchronize access to "up" field; as others posted, there is no guarantee that `@OnMessage` finishes execution before `@OnClose` is called. Also, after this is done, session field needs to be volatile.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22939753

http://stackoverflow.com/a/22896057
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22895636
has body: You got a typo. The correct xpath is: //table[@id='yfncsumtab']/tbody/tr[2]/td[1]/table[2]/tbody/tr/td/table/tbody/tr[1]/td[2]/span Your last part had a td that should have been a tr. An easy way to debug this is using Chrome developer tools, see Is there a way to get the xpath in google chrome?
accepted answer of: http://stackoverflow.com/q/22895636
has comment: http://stackoverflow.com/comment/34941031

http://stackoverflow.com/q/22866925
has comment: http://stackoverflow.com/comment/34888102
has comment: http://stackoverflow.com/comment/34888019
has comment: http://stackoverflow.com/comment/34887995
linked to: http://stackoverflow.com/q/15996311
has title: Detect if object has overriden toString()
has comment: http://stackoverflow.com/comment/34888148
has comment: http://stackoverflow.com/comment/34887875
has answer: http://stackoverflow.com/a/22867459
linked to: http://stackoverflow.com/q/2315445
linked to: http://stackoverflow.com/q/4821704
answer count: 4
favorite count: 0
has body: I'm receiving an Object and need to log it. Some of them have cusom toString() and then I'd like to use that, but some have none and I get something like mightypork.rogue.bus.events.MouseMotionEvent@2d19587d. I'm looking for a way to dynamically (perhaps with reflection?) check if the incoming object has toString() overridden itself. String objToString(Object o) { if(???) { return o.toString(); } else { // fallback method return o.getClass().getSimpleName(); } } Side note: It's an event bus system, some classes can subscribe and then receive events based on implemented interfaces. I can't possibly require all clients to have toString(), plus I want to use this method for more than this one purpose.
has comment: http://stackoverflow.com/comment/34887927
has answer: http://stackoverflow.com/a/22867096
has comment: http://stackoverflow.com/comment/34887912
has comment: http://stackoverflow.com/comment/34887847
has comment: http://stackoverflow.com/comment/34887900
upvote count: 13
has comment: http://stackoverflow.com/comment/34888026
has answer: http://stackoverflow.com/a/22867204
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34887819
tagged with: reflection
has comment: http://stackoverflow.com/comment/34887802
tagged with: java
duplicate of: http://stackoverflow.com/q/4821704
accepted answer: http://stackoverflow.com/a/22867096
has comment: http://stackoverflow.com/comment/34887787
score: 9
type: Question
has comment: http://stackoverflow.com/comment/34888021
has comment: http://stackoverflow.com/comment/34888490
has comment: http://stackoverflow.com/comment/84481235
downvote count: 4
possible better answer: http://stackoverflow.com/a/22867170
has answer: http://stackoverflow.com/a/22867170
tagged with: overriding

http://stackoverflow.com/q/22819623
has comment: http://stackoverflow.com/comment/34804298
tagged with: imagebutton
tagged with: effects
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34804283
has comment: http://stackoverflow.com/comment/34803912
has comment: http://stackoverflow.com/comment/34804152
has title: ImageButton push effect without changing image using ObjectAnimator
answer count: 0
upvote count: 2
score: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/34803468
has comment: http://stackoverflow.com/comment/34803946
type: Question
has comment: http://stackoverflow.com/comment/34804621
tagged with: java
has comment: http://stackoverflow.com/comment/34804375
has body: The objective is giving some feedback to the user tapping an ImageButton, in the Onclick event. I know It can be done changing the image depending of the state of the button, but It's more difficult when you have too many different images loading in runtime. I did this, but is not that pretty public void homeButtonClick(View view) { ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(view, "scaleX", 1f, 0.9f); ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(view, "scaleY", 1.0f, 0.9f); ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(view, "scaleX", 0.9f, 1f); ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(view, "scaleY", 0.9f, 1.0f); AnimatorSet scaling = new AnimatorSet(); scaling.play(scaleUpX).with(scaleUpY).after(scaleDownX).with(scaleDownY); scaling.setDuration(100); scaling.start(); scaling.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { Intent intent = new Intent(MainActivity.this, ContentActivity.class); startActivity(intent); } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); after doing the animation it calls a new Activity

http://stackoverflow.com/a/22810651
has body: If you are only interested in getting common strings found in mArrayListvarinats variable, then you should use Set data structure. Set in java will only contain unique entries. From the example strings it sounds that you are collecting string which has numeric values. So there won't be any problem due to that. But if you are collecting alpha numeric value then you need to take care of alphabet's case, as Set collects values which are case sensitive. So for Set A is not equal to a.
type: Answer
answers question: http://stackoverflow.com/q/22810107
score: 0

http://stackoverflow.com/a/22959219
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22859618
score: 2
has body: The short answer is size your disruptor to cope with the size of your bursts not your entire volume, bare in mind the disruptor can just contain a reference to the 30kb object, the entire object does not need to be in the ring buffer. With any form of buffering before your database will require the memory for buffering the disruptor offers you the option of back pressure on the rest of the system when the database has fallen too far behind. That is to say you can slow the inputs to the disruptor down. The other option for spooling to files is to look at Java Chronicle which uses memory mapped files to persist things to disk. The much more complicated answer is take advantage of the batching effects of the disruptor so that your DB can catch up. I.e. using a EventHandler which collects events a batch of events together and submits them to the database as one unit. This practice allows the EventHandler to become more efficient as things back up thus increasing throughput.
has comment: http://stackoverflow.com/comment/36653737
has comment: http://stackoverflow.com/comment/36653621
has comment: http://stackoverflow.com/comment/36768732

http://stackoverflow.com/comment/35003873
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22917585
score: 0
has text: @geoand yes I am using initMocks(this), however still getting an error message that I am using an interface and I should use the implementation, but I don't know which implementation Jboss uses. Is there any way to mock an interface with automatically inject an instance?

http://stackoverflow.com/a/22966310
has body: Here you go: // Sort array by arrival times int[] temp = new int[atst.length]; //to avoid any out of bound. for (int i = 0; i &lt; atst.length-1; i++) { //-1 will solve if (atst[i][1] &gt; atst[i + 1][1]) { // Then swap! temp[i] = atst[i][1]; atst[i][1] = atst[i + 1][1]; atst[i + 1][1] = temp[i]; } } Hope this will work. you have been exceeding the array bound in atst[i+1] for the last value of i. This -1 will solve your problem of arrayOutOfBoundException. EDIT: Try this: // Sort array by arrival times int[] temp = new int[atst.length]; //to avoid any out of bound. for (int i = 0; i &lt; atst.length-1; i++) { //-1 will solve for (int j = 0; i &lt; 2; j++) { if (atst[i][j] &gt; atst[i + 1][j]) { // Then swap! temp[i] = atst[i][j]; atst[i][j] = atst[i + 1][j]; atst[i + 1][j] = temp[i]; } } }
upvote count: 1
has comment: http://stackoverflow.com/comment/35067876
has comment: http://stackoverflow.com/comment/35067664
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35067186
has comment: http://stackoverflow.com/comment/35067601
has comment: http://stackoverflow.com/comment/35067692
type: Answer
has comment: http://stackoverflow.com/comment/35067967
accepted answer of: http://stackoverflow.com/q/22966195
answers question: http://stackoverflow.com/q/22966195
score: 1

http://stackoverflow.com/a/22951728
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22951702
has body: You cannot use a switch statement for this. Only integer values, strings or enums can be used with switch case labels.

http://stackoverflow.com/comment/34788888
has text: I'd say any IDE that supports Java, like Netbeans or Eclipse. Enter 'Java IDE' in Google and you'll get lots of results. I can't tell you which IDE is better, that is (in my opinion) a matter of opinion.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22811783

http://stackoverflow.com/a/22850947
accepted answer of: http://stackoverflow.com/q/22850604
type: AcceptedAnswer
downvote count: 0
has body: That's the Java Runtime Environment (JRE) in the System Preferences you're seeing. You'll want to install the Java SE Development Kit (JDK) and install it: JDK 1.7.0 • jdk-7u51-macosx-x64.dmg JDK 1.8.0 • jdk-8-macosx-x64.dmg They don't exactly make it clear that what is here, is not that same as here.
score: 6
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/22850604

run-configuration
type: Tag
tag name: run-configuration
tags question: http://stackoverflow.com/q/22928508

http://stackoverflow.com/comment/34815800
comment on: http://stackoverflow.com/q/22826153
type: Comment
has text: Could you give me an example.of that for future reference? Also, make your comment and answer so i can select it...
score: 0
type: QuestionComment

http://stackoverflow.com/a/55025170
downvote count: 2
score: 6
answers question: http://stackoverflow.com/q/22877350
has body: Below is the Spring way, with autowired request bean in @Controller class: @Autowired private HttpServletRequest request; System.out.println(request.getRemoteHost());
upvote count: 8
has comment: http://stackoverflow.com/comment/101584171
type: Answer

http://stackoverflow.com/comment/34825014
has text: Just that the RI issue is just an acknowledgement that the specification *per se* may be incomplete, ambiguous or even contradictory, so that relating to an specific implementation to decide on those grey areas is needed.
type: AnswerComment
score: 4
type: Comment
comment on: http://stackoverflow.com/a/22824858

http://stackoverflow.com/q/22816777
tagged with: java
has answer: http://stackoverflow.com/a/46365355
has answer: http://stackoverflow.com/a/25724309
has comment: http://stackoverflow.com/comment/35008355
downvote count: 0
has body: After installing opencv 2.4.8.2 with homebrew, I can't seem to find the jar file in /usr/local/Cellar/opencv/2.4.8.2/share/OpenCV I'm using Mavericks, any ideas?
favorite count: 0
accepted answer: http://stackoverflow.com/a/25724309
tagged with: macos
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23042875
upvote count: 3
tagged with: homebrew
has answer: http://stackoverflow.com/a/23042875
has comment: http://stackoverflow.com/comment/40205338
has title: Not finding opencv jar after installing with homebrew
type: Question
tagged with: opencv
score: 3
has answer: http://stackoverflow.com/a/46242952

http://stackoverflow.com/q/22870366
type: UnansweredQuestion
has body: So, when my jar file runs, I want it to delete and rewrite it from a site. Windows locks the files, even though the JVM is done with it. Is there anyway to stop that from happening?
tagged with: java
has answer: http://stackoverflow.com/a/22870764
tagged with: file
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/3715967
score: 0
has title: Update a Jar File while running in windows
answer count: 2
has answer: http://stackoverflow.com/a/22870770
upvote count: 1
tagged with: jar
tagged with: jvm
favorite count: 0

http://stackoverflow.com/comment/34897637
comment on: http://stackoverflow.com/q/22854032
has text: @NidhishKrishnan I edited my answer, Can u please have a look
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22964413
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22964342
type: Answer
has body: The instance of color should be reachable, no? There is no instance, color is null by default, because it is not initialized.
downvote count: 0

http://stackoverflow.com/comment/35414565
type: Comment
has text: This isn't exactly what I was looking for but it is the answer that is correct. The problem is that I do not want to have to specify an entity in the ID. Hibernate forces this behavior and as such your answer is spot on. I don't agree with your first side notes especially for compound keys with more than two fields. In general you are correct but in particular I disagree. What is the benefit of adding @Temporal?
comment on: http://stackoverflow.com/a/22948160
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34805681
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22820527
type: Comment
has text: I am asking to work on new tab , not on new window.

amazon-s3
tags question: http://stackoverflow.com/q/22911950
type: Tag
tag name: amazon-s3

http://stackoverflow.com/q/22870804
answer count: 1
has comment: http://stackoverflow.com/comment/34895050
has body: I'm working on a maven plugin that will, amongst other things, run mvn compile on the project. I've tried adding this to my class that extends AbstractMojo (similar to https://github.com/rzymek/watcher-maven-plugin): @Component private Maven maven; ... maven.execute(request); That complains that maven is null. So then I tried: Maven maven = new DefaultMaven(); maven.execute(request); But that results in a NullPointerException at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:170) as described in this unanswered question Programmatic builds using Maven 3 API I also tried ClassRealm containerRealm = (ClassRealm) Thread.currentThread().getContextClassLoader(); ContainerConfiguration cc = new DefaultContainerConfiguration().setName( "maven" ).setRealm( containerRealm ).setClassPathScanning( PlexusConstants.SCANNING_INDEX ).setAutoWiring( true ); DefaultPlexusContainer container = new DefaultPlexusContainer( cc ); Maven maven = (Maven) container.lookup( "org.apache.maven.Maven", "default" ); maven.execute(request); But that threw a NoSuchElementException: org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException role: org.apache.maven.Maven roleHint: default I tried using the role hint from getPluginContext() with the same result.
has title: execute a Maven build within a Maven plugin
linked to: http://stackoverflow.com/q/14275841
tagged with: maven-plugin
has answer: http://stackoverflow.com/a/22878016
type: UnansweredQuestion
tagged with: maven
tagged with: java
type: Question
score: 0

http://stackoverflow.com/q/22963537
tagged with: webdriver
accepted answer: http://stackoverflow.com/a/22963880
upvote count: 1
answer count: 1
has title: Asserting Meta Tags using Selenium/webdriver (java)
has body: I have the following piece of html: &lt;head&gt; &lt;meta name="twitter:card" content="summary"&gt;&lt;/meta&gt; &lt;/head&gt; Using Selenium Webdriver (Cucumber) I've the following piece of code which doesn't seem to be working: @and("^Meta is being checked with property \"([^\"]*)\"$") public void check_meta(String property) throws Throwable { String meta = driver.findElement(By.xpath("//meta[contains(text(), \"" + property + "\")]")).getText(); Assert.assertTrue(meta.contains(property)); } I'm trying to assert if twitter:card is present, but it gives me assertion errors now. What am I doing wrong? What is the correct definition?
favorite count: 0
has answer: http://stackoverflow.com/a/22963880
type: AnsweredQuestion
downvote count: 0
tagged with: selenium
type: Question
score: 1
tagged with: java

http://stackoverflow.com/q/22821145
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has comment: http://stackoverflow.com/comment/34806798
accepted answer: http://stackoverflow.com/a/22821766
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34807731
type: Question
tagged with: parsing
has answer: http://stackoverflow.com/a/22821766
has title: How to extract json from a json string using GSON?
has body: Below is my JSON String. I am trying to extract hosts from it. {"description":"DescA","process_running":"sf","hosts":{"dc1":["machineA","machineB"]}} Since hosts is a JSON String in itself and I would like to extract that JSON String from it. I am using GSON here - String ss = new String(bytes, Charset.forName("UTF-8")); // here ss is the above JSON String Map&lt;String, Object&gt; data = gson.fromJson(ss, Map.class); // parse I was trying to use Map to deserialize but the result it coming like this in the data- {description=DescA, process_running=sf, hosts={dc1=[machineA, machineB]}} Is there any way, I can extract hosts in the JSON format?
answer count: 1
has comment: http://stackoverflow.com/comment/34807088

http://stackoverflow.com/q/22835382
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22962641
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/33919082
downvote count: 0
favorite count: 0
has title: How may I store images in a database using the Inubit tool set?
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has body: I am learning Inubit. I want to know, how may I store images in a database using the Inubit tool set?
upvote count: 1
tagged with: php
tagged with: xslt

http://stackoverflow.com/q/22882683
score: 1
tagged with: java
has title: How to handle timeouts in httpclient 4.3+ ?
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22884185
has body: In old 4.0 library you would simply do: DefaultHttpClient httpClient = new DefaultHttpClient(); HttpParams params = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(httpParams, connectionTimeoutMillis); HttpConnectionParams.setSoTimeout(httpParams, socketTimeoutMillis); but now DefaultHttpClient is deprecated and in order to create an httpclient you have to do: HttpClients.createDefault(); this is nice but doesn't allow me to set a timeout for requests. So, is there a workaround/way without returning to deprecated class?
downvote count: 0
possible better answer: http://stackoverflow.com/a/22883564
has answer: http://stackoverflow.com/a/22883564
favorite count: 0
tagged with: apache-httpclient-4.x
has answer: http://stackoverflow.com/a/22884185
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/22956975
has comment: http://stackoverflow.com/comment/35057163
has body: I need to put some jar files into extensions directory so I do not have to provide --classpath. I wonder what is the extension path in linux systems ? Basically I need to put mysql-connector-java.jar which is currently under /usr/share/java and each time I run liquibase migration tool it give classpath error. I may provide classpath argument with liquibase but putting mysql-connector-java.jar in shared/extensions directory seems more straight forward ( if there is any) Please guide me
has comment: http://stackoverflow.com/comment/35055842
tagged with: java
has comment: http://stackoverflow.com/comment/35053987
tagged with: liquibase
has comment: http://stackoverflow.com/comment/35052207
tagged with: mysql-connector
type: Question
has comment: http://stackoverflow.com/comment/35057708
has comment: http://stackoverflow.com/comment/35057530
score: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/35050443
has comment: http://stackoverflow.com/comment/35054485
has comment: http://stackoverflow.com/comment/35053892
answer count: 0
type: UnansweredQuestion
has title: What is the java extesions path on linux?

http://stackoverflow.com/comment/34911406
has text: Thanks, that nudged me in the right direction.. I hope. Seems there is an issue with the ivy dependencies, since the projects that work are all maven projects.. I'll post, but you gave me hope.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22857411

http://stackoverflow.com/comment/35314231
has text: Can you provide some evidence please
type: Comment
comment on: http://stackoverflow.com/a/23013020
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34890244
has text: Execution Environment: JavaSE-1.7
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22864931

http://stackoverflow.com/comment/34896151
type: AnswerComment
comment on: http://stackoverflow.com/a/22871049
score: 0
type: Comment
has text: @azurefrog import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class helper{ private static Scanner scan; List<name of list> list = new ArrayList<name of list>(); scan = new Scanner(System.in); int item = 0; the items printed out to choose from boolean quit = false; do{ System.out.print("Please enter your choice: "); item = scan.nextInt(); System.out.println(); switch(item) Does this look like what you mean

http://stackoverflow.com/comment/35033864
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22947362
has text: `Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>` Please post `/res/layout/pilih_level`
score: 1

http://stackoverflow.com/comment/34913467
comment on: http://stackoverflow.com/a/22878828
type: Comment
has text: @float_dublin: Yes, you have two objects and therefore double work. The fact that their content is the same doesn't make it any worse.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35058466
type: QuestionComment
has text: Are you sure the heap size is set correctly? When i run your code with the default heap size, I get an `OutOfMemoryError` but setting `-Xmx2048M` it works just fine. (or any other size over 400M)
score: 0
comment on: http://stackoverflow.com/q/22961215
type: Comment

http://stackoverflow.com/a/22948678
score: 1
answers question: http://stackoverflow.com/q/22948482
has comment: http://stackoverflow.com/comment/35036391
has comment: http://stackoverflow.com/comment/35042996
has comment: http://stackoverflow.com/comment/35043100
has comment: http://stackoverflow.com/comment/35063885
has comment: http://stackoverflow.com/comment/35069198
upvote count: 1
has body: Have you opened the port for inbound traffic? If not follow these steps. Cheers There is more directly on amazon here.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34899614
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22872659
score: 0
has text: I need to use this in a table to print out the fibonacci series in my table but I cannot get them to print continuously, they restart one number later in the series, I added my method and printed table to my code so you can see

http://stackoverflow.com/comment/34825262
score: 0
type: AnswerComment
has text: now see my edited ans and try to delete with this code dude and also refresh it
type: Comment
comment on: http://stackoverflow.com/a/22831050

http://stackoverflow.com/a/31437766
has body: The version 2.0 of PhantomJS fix this issue. If you have a Linux Enviroment, you need clone the sources and compile, like this: git clone git://github.com/ariya/phantomjs.git cd phantomjs git checkout 2.0 ./build.sh More info here
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22832996

http://stackoverflow.com/q/22950995
score: 1
favorite count: 0
has title: Stanford-NER customization to classify software programming keywords
type: Question
answer count: 2
tagged with: nlp
tagged with: classification
has answer: http://stackoverflow.com/a/22999743
tagged with: java
upvote count: 1
has body: I am new in NLP and I used Stanford NER tool to classify some random text to extract special keywords used in software programming. The problem is, I don't no how to do changes to the classifiers and text annotators in Stanford NER to recognize software programming keywords. For example: today Java used in different operating systems (Windows, Linux, ..) the classification results should such as: Java "Programming_Language" Windows "Operating_System" Linux "Operating_system" Would you please help on how to customize the StanfordNER classifiers to satisfied my needs?
tagged with: stanford-nlp
possible better answer: http://stackoverflow.com/a/49444441
has answer: http://stackoverflow.com/a/49444441
accepted answer: http://stackoverflow.com/a/22999743
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/22901556
has body: You could also do it different way. Let's say you create a JFrame and there you could put a textfield for every value, so for every "t" or constants, and then it would be much more simple to get those values. For characters like t or = you could use JLabels, so it would be a mixture of JTextFields and JLabels and I think it wouldn't be that ugly. I used this solution few times.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22901446

http://stackoverflow.com/comment/34926425
comment on: http://stackoverflow.com/a/22887875
score: 0
type: AnswerComment
has text: Thanks , I could make guess but I was searching for [JLS Reference](http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2.5) , thank you for your answer
type: Comment

http://stackoverflow.com/comment/34950216
score: 0
type: QuestionComment
has text: All right then. Thanks for your help. I guess I just misunderstood.
comment on: http://stackoverflow.com/q/22900910
type: Comment

http://stackoverflow.com/comment/36461028
has text: The X11 library is essentially as deep as it gets; X11 then routes the events to the appropriate programs. Added a few more code references to help you out; honestly the best way is to search through the code and read through the docs
comment on: http://stackoverflow.com/a/22881472
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34830140
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22831004
has text: @MadProgrammer hey its done i created but trying to implement if u dont mind asking u some doubts if i face in that.:)

http://stackoverflow.com/a/30399046
has comment: http://stackoverflow.com/comment/83255597
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/112437538
has comment: http://stackoverflow.com/comment/60704564
has body: You could use a custom type in your entity with JPA 2.1 @Convert, so JPA makes the conversion for you (I've tested it with Spring Data JPA also, and it worked transparently!), see: Entity: @Entity class SomeEntity { @Column(name = "my_id_column_name") @Convert(converter = MyIDConverter.class) private ID itsID; } Converter: public class MyIDConverter implements AttributeConverter&lt;ID, String&gt; { @Override public String convertToDatabaseColumn(ItStaticDataKey javaKey) { // your implementation here } @Override public ItStaticDataKey convertToEntityAttribute(final String databaseKey) { // your implementation here } } Notes: Make sure you're using a JPA-2.1-compatible Spring Data JPA version. (I'm sure that Spring Data JPA 1.7.0 (and above) are (or at least should) be compatible). Unfortunately, it won't work if that field should also be annotated with @Id. If you use EclipseLink, you have to define converter in persistence.xml, or it doesn't pick it up. https://bugs.eclipse.org/bugs/show_bug.cgi?id=412454. With JPA on Spring, package containing converters have to appear in property packageToScan on EntityManagerFactoryBean.
has comment: http://stackoverflow.com/comment/112435451
has comment: http://stackoverflow.com/comment/92629197
type: Answer
accepted answer of: http://stackoverflow.com/q/22965178
answers question: http://stackoverflow.com/q/22965178
has comment: http://stackoverflow.com/comment/128438532
upvote count: 21
has comment: http://stackoverflow.com/comment/103434796
score: 21

http://stackoverflow.com/comment/35041642
score: 0
type: Comment
type: QuestionComment
has text: I'm completely new to Java and I've tried to fix it before I asked. The current loops I'm using are what I got after re-editing. I am aware that asking before trying will do nothing, and there is an increment for size but I'm just not aware of why it's not working.
comment on: http://stackoverflow.com/q/22951703

http://stackoverflow.com/q/22878711
score: 0
has comment: http://stackoverflow.com/comment/34910544
answer count: 1
tagged with: polymorphism
has comment: http://stackoverflow.com/comment/34910149
has title: call the same method name from instances different type
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22880944
tagged with: dynamic
tagged with: java
has comment: http://stackoverflow.com/comment/34909890
has body: I have some libraries from external company, I want to use this API. I try to implement calling this API, my logic should call the same method name. I have duplicate codes, I want to avoid to do this. I'm beginner and subjects like interfaces, polymorphism are little bit difficult to me. public void modPeople(Object person) { if (person instanceof com.company.persontype1) { com.company.persontype1 fireman = (com.company.persontype1) person; String name = fireman.getName(); if (name!=null ) { ... fireman.set_name(); fireman.save(); } permissions = fireman.get_Permissions(); ... permissions = fixperm (permissions); fireman.set_Permissions(); }; if (person instanceof com.company.persontype2) { com.company.persontype2 nurse = (com.company.persontype2) person; String name = nurse.getName(); if (name!=null ) { ... nurse.set_name(); nurse.save(); } permissions = nurse.get_Permissions(); ... permissions = fixperm (permissions); nurse.set_Permissions(); }; }
has comment: http://stackoverflow.com/comment/34912216
type: Question

http://stackoverflow.com/a/22923449
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22911030
type: Answer
score: 7
upvote count: 7
has body: The solution is not very efficient, but I think it follows your requirements - it does what you want and it is in one single pipeline - one single sequence of bulk data operations, how Java 8 calls it. import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; Stream&lt;Integer&gt; ranges = Stream.iterate(1, i -&gt; i + 1).limit(15); List&lt;Integer&gt; collect = ranges .sorted(Comparator.reverseOrder()) // sort the stream from the highest to the smallest .skip(1) // discards 1 element from the beginning .sorted() // sort the stream from the smallest to the highest .skip(1) // discards 1 element from the beginning .collect(Collectors.toList()) ; But, as fge suggested and Marco13 wrote in their comment below your question, it would be better and much more efficient just to sort the stream, terminate the pipeline to a list and then remove the first and the last member :P Or even faster without sort - go through all the elements, find min and max, remember their position and then remove them.
accepted answer of: http://stackoverflow.com/q/22911030

http://stackoverflow.com/a/22953250
upvote count: 12
answers question: http://stackoverflow.com/q/22953136
has body: You can make a dictionary of input-to-action. In Java this would be a Map&lt;Integer, Runnable&gt;, with, for instance*: map.put(12, () -&gt; { up(); left(); stop(); }); Then, you can get the appropriate Runnable and run it: Runnable action = map.get(i); if (action != null) { action.run(); } else { // some default action // This is the "default" case in a switch, or the "else" in an if-else } The if-else there isn't strictly necessary, but without it, you'll get a NullPointerException if i isn't an expected value &mdash; that is, one of the values you put into the map. The idea is similar in JavaScript, though with objects instead of Maps, functions (probably anonymous) instead of Runnables, etc. This code is for Java 8. In Java 7 and below, you'd do: map.put(12, new Runnable() { @Override public void run() { up(); left(); stop(); } });
score: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/35044068
type: Answer
has comment: http://stackoverflow.com/comment/35068353
has comment: http://stackoverflow.com/comment/35044113
has comment: http://stackoverflow.com/comment/35082683
has comment: http://stackoverflow.com/comment/35082761

http://stackoverflow.com/q/22917457
has answer: http://stackoverflow.com/a/22917502
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34979322
has body: I'm writing a video poker in java, and I need to ask the player if the want to remove any cards from their hand. I wrote a while loop for that, but it is not working the way it's supposed to right now. I'd appreciate if someone could send me in the right direction--I'm still new to java.. Thanks. (the counter is there so that the player doesn't remove more than 5 cards) String response = "y"; int counter = 0; System.out.println("Remove any cards?"); System.out.println("Enter y for 'yes' and n for 'no'"); response = input.nextLine(); while((response != "n") &amp;&amp; (counter &lt; 5)) { System.out.println("Enter the number of a card to be removed (1-5)"); int l = input.nextInt(); p.removeCard(p.getHand().get(l-1)); p.addCard(cards.deal()); cards.incrementTop(); counter ++; System.out.println("Card removed. More? Type 'yes' or 'no'"); String answer = input.nextLine(); if (answer == "no") { response = "n"; } }
has title: Java while loop never enters loop
score: 0
tagged with: while-loop
accepted answer: http://stackoverflow.com/a/22917502
possible better answer: http://stackoverflow.com/a/22917555
has answer: http://stackoverflow.com/a/22917555
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22970345
type: Answer
has body: Add a PDFmyForm button, this does exactly that. You just add the following two lines to your page: PDF this page!
upvote count: 2
answers question: http://stackoverflow.com/q/22962128
score: 2
downvote count: 0

http://stackoverflow.com/q/22911909
score: 1
tagged with: java
type: Question
tagged with: intersystems-cache
has comment: http://stackoverflow.com/comment/35008321
has body: in my java project I'm using Cache JDBC-driver for DB connection. So, to create connection pool I use: public CacheConnectionPoolDataSource pds = null; ... public final void Connect() { try { pds = new CacheConnectionPoolDataSource(); pds.restartConnectionPool(); pds.setMaxPoolSize(7); pds.setURL("jdbc:Cache://" + host + ":" + port + "/" + namespase); pds.setUser(dblogin); pds.setPassword(dbpassword); } catch (SQLException e) { System.out.println(e.getMessage()); } } To get connection I use: static public Connection GetConnection() { Connection cn = null; try { cn = pds.getConnection(); cn.setAutoCommit(true); } catch (Exception e) { System.out.println(e.getMessage()); if (cn == null) { try { GetInstance().Connect(); cn = pds.getConnection(); cn.setAutoCommit(true); } catch (SQLException e1) { System.out.println(e.getMessage()); } } } return cn; } After making query like this: ResultSet result = Database.GetInstance().Query(query); I use "FreeResultSet(result);": static public void FreeResultSet(ResultSet resultSet) { Connection connection = null; Statement statement = null; try { if (resultSet != null) { statement = resultSet.getStatement(); } } catch (SQLException e) { System.out.println(e.getMessage()); } try { if (statement != null) { connection = statement.getConnection(); } } catch (SQLException e) { System.out.println(e.getMessage()); } try { if (resultSet != null) { resultSet.close(); } } catch (SQLException e) { System.out.println(e.getMessage()); } Database.FreeStatement(statement); Database.FreeConnection(connection); } static public void FreeConnection(Connection con) { try { if (con != null) { con.close(); } } catch (SQLException e) { System.out.println(e.getMessage()); } } static public void FreeStatement(Statement st) { try { if (st != null) { st.close(); } } catch (SQLException e) { System.out.println(e.getMessage()); } } It works almost fine.. But when I'm using many queries at the same time, there appear too many coonections (up to 25) (bigger than…
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: jdbc
has title: How to return connection to connection pool in cache intersystems?
answer count: 0
downvote count: 0

http://stackoverflow.com/q/22923907
has comment: http://stackoverflow.com/comment/34992181
downvote count: 1
has comment: http://stackoverflow.com/comment/34992455
score: 1
tagged with: java
has title: Detecting when multiple downloads are completed
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34992357
has comment: http://stackoverflow.com/comment/34993402
favorite count: 0
has body: I am using DownloadManager to download multiple files (12 to be exact). I have setup a BroadcastReciever and when ACTION_DOWNLOAD_COMPLETE display an AlertDialog like this: manager.enqueue(f1); manager.enqueue(f2); manager.enqueue(f3); ...... BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { //Display an alertdialog } } }; registerReceiver(receiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); However once the downloads complete, the dialog goes into a loop and keeps reappearing until a forcefully exit the app. Does anyone know why this is happening? I have found that this is happening because it displays the alertdialog for each completed download. How can I make it show just once when all of the downloads are done?
tagged with: android-broadcast
has comment: http://stackoverflow.com/comment/34993247
tagged with: android
tagged with: android-alertdialog
tagged with: android-download-manager
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35052042
comment on: http://stackoverflow.com/q/22957665
has text: set char set to unicode. http://docs.oracle.com/javase/tutorial/i18n/text/unicode.html
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22863339
tagged with: jdialog
score: 0
has comment: http://stackoverflow.com/comment/34881287
has answer: http://stackoverflow.com/a/22863697
accepted answer: http://stackoverflow.com/a/22863697
answer count: 1
has comment: http://stackoverflow.com/comment/34881448
tagged with: jframe
has comment: http://stackoverflow.com/comment/34881510
tagged with: swing
has title: Accessing JDialog's JtextArea from parent JFrame?
type: AnsweredQuestion
tagged with: java
has body: I have 2 cases , I am having issue with printing and controlling the JTextArea from parent frame or within JDialog itself. In addition , I have Jbutton added to parent JFrame when I click it , JDialog appears but still having the printing issue. Furthermore , this JButton makes call to another class and does scanning operation which I want to actually pass results to my JDialog's JTextArea , I code for it as well , but when I click the scan button JDialog appears , after I close it then scan operation starts. I want scan operation start within JFrame and Print it to JDialog's Component which is JTextArea added to my JDialog. Here is the Sample Code to understans better my problem // Parent JFrame public class JDialogPrinting extends javax.swing.JFrame { JDialogSample jd ; /** * Creates new form JDialogPrinting */ public JDialogPrinting() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jButton1.setText("Print Text To JDialog"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(78, 78, 78) .addComponent(jButton1) .addContainerGap(97, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(72, 72, 72) .addComponent(jButton1) .addContainerGap(94, Short.MAX_VALUE)) ); pack(); }// &lt;/editor-fold&gt; private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { jd = new JDialog…
has comment: http://stackoverflow.com/comment/34881234
type: Question
tagged with: jtextarea

http://stackoverflow.com/comment/35001525
comment on: http://stackoverflow.com/q/22927480
type: QuestionComment
has text: The Codes above check Windows process in another computer. It can't check with Linux, Unix Operator, so I have to write other codes to check status Linux, Unix Process, Services.
score: 0
type: Comment

http://stackoverflow.com/q/22927526
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: DAO (Dessign Pattern) with User restrictions
has answer: http://stackoverflow.com/a/22929881
downvote count: 0
score: 1
tagged with: java
has body: I was wondering if there is a way of performing the next: I have 2 kinds of user (UserA, UserB). A class Student and a class Classroom. UserB has a List&lt;Classroom&gt; Classrooms;. UserA can save a Student into any Classroom. UserB can save a Student into a Classroom he ownes. So, the StudentDAO has differents methods for each kind of user. How can I do that? I think, the best way is: In the constructor of the users, I instantiate a StudentDAO with the implementation that feets the user. Is that correct? What if ClassroomDAO has the method getAll();. UserA will see every Classroom. But UserB will see all the Classroom that he ownes. But this method will be the same that UserB.getClassrooms();. 2 methods would do the same. Thanks in advance.
tagged with: design-patterns
type: Question
tagged with: dao

http://stackoverflow.com/q/22948368
has body: I am trying to do my java assignment. I am just struggling with some of the issues. I could not make the program calculates and outputs the information needed. When I try to run the program, and input the social security number, I get an error and a message saying Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Salaries.inputData(Salaries.java:34) at Salaries.main(Salaries.java:18) What am I doing wrong? Thanks. Here is a description of the program I am suppose to do. Write a program that reads Social Security numbers and salaries from the keyboard (Test this by only reading 3 or 4 to start). After the data is read in, the program should add a 2% raise to everyone’s salary. After you give the raise, print out 3 nicely formatted columns of information (Social, salary before raise, salary after raise). You will need a 3rd array holding the new salaries. A separate method should be used for the input, raise, and output. This is the code I got so far. import java.util.Scanner; public class Salaries { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner (System.in); int[] ssNumbers = new int [10]; double[] salaries = new double [10]; int c; int rais; c = inputData (ssNumbers, salaries); raise (salaries, c, ssNumbers); output (ssNumbers, salaries, nSalary); } public static int inputData (int[]ssn, double[]sals){ 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(); c++; System.out.print("Please input next security numbers or -1 to quit"); ssn[c] = input.nextInt(); } return c; } public static void raise ( double[] salaries, int c, int[] ssNumbers) { double salar; double rais = 0.02; for (int count = 0; count &lt; c; count++ ) rais+= rais; System.out.printf("the salary after raise is %f\n", rais)…
has answer: http://stackoverflow.com/a/22948424
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35035935
type: Question
has comment: http://stackoverflow.com/comment/35035673
has comment: http://stackoverflow.com/comment/35035752
has answer: http://stackoverflow.com/a/22948421
tagged with: arrays
has title: Having some issues with my java program
has answer: http://stackoverflow.com/a/22948490
score: 0
answer count: 3

http://stackoverflow.com/comment/34947077
has text: java.lang.NullPointerException at testMovie2.sortTitle(testMovie2.java:76) at testMovie2.main(testMovie2.java:26) is the error that I get
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22899372

http://stackoverflow.com/comment/35050763
type: QuestionComment
comment on: http://stackoverflow.com/q/22956779
has text: initComponents(); //readfile(); dtm = (DefaultTableModel)myjtable.getModel();`here it showing an exception` readFile();
score: 0
type: Comment

http://stackoverflow.com/q/22860009
has comment: http://stackoverflow.com/comment/67510639
tagged with: java
has body: As the title says, we have a java cxf client for a web service which is out of our control. The problem is that if that web service goes down, when it comes back up again attempting to consume information from it eventually results in SocketTimeoutException from cxf. If we restart our whole application consuming the web service works as expected. Here is how we configure the http conduit in spring: &lt;http-conf:conduit name="*.http-conduit"&gt; &lt;http-conf:client AllowChunking="false" Connection="close" ReceiveTimeout="${webservices.timeout:30000}" ConnectionTimeout="${webservices.timeout:30000}" /&gt; &lt;/http-conf:conduit&gt; Can anyone think of a reason our client can't recover?
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
has title: Java cxf client can't recover when web service goes down and back up again
favorite count: 0
type: Question
upvote count: 1
tagged with: web-services
tagged with: spring
tagged with: cxf

http://stackoverflow.com/comment/34927454
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22888341
type: Comment
has text: @Pshemo didn't notice the quoted space issue. I think I've got it now

http://stackoverflow.com/q/22899339
tagged with: performance
accepted answer: http://stackoverflow.com/a/22920966
tagged with: derby
has title: JPA and Derby Performance
answer count: 1
tagged with: jpa
downvote count: 0
has body: I wrote an application using JPA. The application makes around 5 or 6 inserts per second on one Table. The insert is done by a simple Transaction begin, persist and transaction commit. With this approach the application has a really heavy cpu load (around 80%). Using the JVisualVM i profiled the application and came to this result: This shows that around 30% percent of the time is spent in writing and flushing to Log Files. Also the setExclusive method has a load of 14% of the time. Is there a way to optimize this? Maybe disabling logging?
favorite count: 0
has answer: http://stackoverflow.com/a/22920966
type: AnsweredQuestion
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34947053
tagged with: java
type: Question

http://stackoverflow.com/comment/79011001
type: AnswerComment
has text: Will this update to the latest version with future java updates? Or do you need to re-run each time?
type: Comment
comment on: http://stackoverflow.com/a/22842806
score: 0

http://stackoverflow.com/comment/35039198
has text: @DavidWallace, you mean the value of a is stored in the stack? I mean the value is stored in stack memory as any other values inside a function is stored?
comment on: http://stackoverflow.com/q/22950240
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34985585
has text: @Quincunx - So why doesn't `String` have a read-only `length` field? There's really no good argument one way or the other -- this is just the way they did it, and it got to be too late to change before there was time to do the change.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22920058
type: QuestionComment

http://stackoverflow.com/q/22927262
has answer: http://stackoverflow.com/a/23045634
tagged with: struts2
answer count: 2
has answer: http://stackoverflow.com/a/22931920
downvote count: 0
tagged with: tomcat
tagged with: maven-2
favorite count: 0
tagged with: spring
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
has title: struts 2.3.16.1 upgrades giving TypeMismatchException for struts xwork and SimpleMessageListenerContainer in Spring framework
has body: I have been upgraded from struts 2.0 to 2.3.16.1 for get the latest security fixes in struts to my web application when I upgraded deployed in tomcat server it gives following errors: Caused by: Unable to load configuration. - interceptor - jar:file:/C:/Projects/apache-tomcat-7.0.50/webapps/myweb/WEB-INF/lib/struts2-core-2.3.16.1.jar!/struts-default.xml:167:106 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489) Caused by: Caught Exception while registering Interceptor class org.apache.struts2.interceptor.FileUploadInterceptor - interceptor - jar:file:/C:/Projects/apache-tomcat-7.0.50/webapps/myweb/WEB-INF/lib/struts2-core-2.3.16.1.jar!/struts-default.xml:167:106 Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.springframework.jms.listener.SimpleMessageListenerContainer] to required type [com.opensymphony.xwork2.inject.Container] for property 'container'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.jms.listener.SimpleMessageListenerContainer] to required type [com.opensymphony.xwork2.inject.Container] for property 'container': no matching editors or conversion strategy found my configurations are given below for your convenience maven configuration in pom.xml is given bellow com.opensymphony xwork 2.1.3 org.apache.struts struts2-spring-plugin 2.3.16.1 org.springframework spring-jms 3.0.5.RELEASE org.apache.struts struts2-core 2.3.16.1 org.apache.struts struts2-spring-plugin 2.3.16.1 ognl ognl 3.0.8 configuration of spring bean.xml <property name="connectionFactory" ref="connectionFactory" /> <property name="messageListener" ref="listener" /> <property name="destination" ref="requestQueue" /> <property name="connectionFactory" ref="connectionF…

http://stackoverflow.com/a/22869227
score: 0
has comment: http://stackoverflow.com/comment/34892560
type: Answer
answers question: http://stackoverflow.com/q/22869081
has body: You need to have a way to safely stop the thread. Check out this option: The Safe Way to Stop a Thread by Bruce Eckel. This way you can call requestStop on the timer thread that's running, then start a new thread. You will have to save a reference to every timer thread you kick off so you can call the .requestStop method on it later.

http://stackoverflow.com/a/22931416
upvote count: 1
answers question: http://stackoverflow.com/q/22929423
type: AcceptedAnswer
has body: The SortField essentially is just going to pass the field name along to the Comparator, and let it handle getting the correct values and doing the comparison. As such, the DistanceFieldComparatorSource just tosses the field name out anyway. This makes a measure of sense, since that comparator needs to accesses two fields (lat and lon in this case) to perform its comparison, rather than just one. Instead, the DistanceFilter wraps up the field names the comparator needs to access, as well as some other attendant data.
has comment: http://stackoverflow.com/comment/35019911
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/35006907
score: 1
accepted answer of: http://stackoverflow.com/q/22929423

http://stackoverflow.com/comment/34929045
type: QuestionComment
type: Comment
has text: Do you have the support library imported? `android.support.v4.app.FragmentActivity`
comment on: http://stackoverflow.com/q/22889434
score: 0

db2-luw
tags question: http://stackoverflow.com/q/22930386
tag name: db2-luw
type: Tag

http://stackoverflow.com/q/22877318
accepted answer: http://stackoverflow.com/a/22877569
favorite count: 0
has title: Why is the Object class's clone() method giving a deep copy of object?
tagged with: deep-copy
tagged with: shallow-copy
answer count: 4
has answer: http://stackoverflow.com/a/22877479
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/22877569
type: Question
has body: As per the JAVA documentation, the super.clone() when called returns a shallow copy of the object. In the code below I have two objects name and id; and one primitive variable num. When the super.clone() method is called on the first object, it seems to be creating a deep copy of the objects(name and id) in addition to an expected copy of only num. After cloning the object obj, I have changed its name and id fields. These changes should be reflected in the cloned object if a shallow copy was being made. Am I right? public class Cloning implements Cloneable { String name; int num; Integer id; Cloning(String name,int num,Integer id) { this.name = name; this.num = num; this.id = id; } public Object clone() { try { return super.clone(); } catch(CloneNotSupportedException E) { System.out.println(E.getMessage()); return null; } } public void print() { System.out.println(name); System.out.println(num); System.out.println(id); } public static void main(String[] args) { // TODO Auto-generated method stub Cloning obj = new Cloning("Annu",203,new Integer(3)); Cloning obj1 = (Cloning)obj.clone(); obj.name = "Annu_modified"; obj.num = 204; obj.id = new Integer(4); obj.print(); obj1.print(); } } I get the following output on running the code: Annu_modified 204 4 Annu 203 3
tagged with: clone
possible better answer: http://stackoverflow.com/a/22877442
tagged with: java
has answer: http://stackoverflow.com/a/22877442
has answer: http://stackoverflow.com/a/22877369
score: 2
has comment: http://stackoverflow.com/comment/100638997
has comment: http://stackoverflow.com/comment/34907488
downvote count: 0

http://stackoverflow.com/q/22954603
has answer: http://stackoverflow.com/a/22954738
has answer: http://stackoverflow.com/a/22954790
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22954730
has title: Access static variables
answer count: 6
has body: I have a following scenario. There are two classes class A and class B. Both of the classes is of following nature. Class A static public int a = 10; static public int b = a-3; Class B A.a = 5; // print b here. b = ? Correct me if I got wrong somewhere. Thank you.
accepted answer: http://stackoverflow.com/a/22954738
has comment: http://stackoverflow.com/comment/35046434
has comment: http://stackoverflow.com/comment/35046324
has comment: http://stackoverflow.com/comment/35046349
score: 0
has comment: http://stackoverflow.com/comment/35046375
has comment: http://stackoverflow.com/comment/35046716
has answer: http://stackoverflow.com/a/22954905
has comment: http://stackoverflow.com/comment/35046288
tagged with: static
has comment: http://stackoverflow.com/comment/35046589
has answer: http://stackoverflow.com/a/22954772
has comment: http://stackoverflow.com/comment/35046536
has comment: http://stackoverflow.com/comment/35046256
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22955384
has answer: http://stackoverflow.com/a/22954730

http://stackoverflow.com/comment/34967741
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22899191
has text: @Bogdan thanx dude, your link was helpful to me ... if you can properly answer above comment as answer.. i can marked it as answer :)
score: 0

http://stackoverflow.com/comment/35025580
score: 1
comment on: http://stackoverflow.com/a/22942898
type: AnswerComment
has text: In this case, the instance variable would have to be Object since it's the only thing that could hold a pure generic type. And getClassTInstanceVariableFromSomewhere would also need to be generified.
type: Comment

http://stackoverflow.com/comment/34861382
type: QuestionComment
comment on: http://stackoverflow.com/q/22851851
has text: You cannot in 100% Java. After all, you cannot do it in Java on Linux, either.
score: 0
type: Comment

http://stackoverflow.com/a/22936086
upvote count: 3
answers question: http://stackoverflow.com/q/22936009
score: 3
downvote count: 0
type: Answer
has body: Try this: str.replaceAll("[\\p{Punct}\\s\\d]+", " "); Replacing punctuation, digits and white spaces with a single space.

http://stackoverflow.com/q/22961410
favorite count: 0
has answer: http://stackoverflow.com/a/22961430
type: Question
has answer: http://stackoverflow.com/a/22961987
tagged with: oracle-database
linked to: http://stackoverflow.com/q/71328
has title: for xss attack prevention do i use prepared statement or callable statement
score: -1
answer count: 2
downvote count: 1
tagged with: java
type: UnansweredQuestion
tagged with: sql
has comment: http://stackoverflow.com/comment/35058068
upvote count: 0
has body: String getDBUSERByUserIdSql = "{call getDBUSERByUserId(?,?,?,?)}"; try { dbConnection = getDBConnection(); callableStatement = dbConnection.prepareCall(getDBUSERByUserIdSql); callableStatement.setInt(1, 10); callableStatement.registerOutParameter(2, java.sql.Types.VARCHAR); callableStatement.registerOutParameter(3, java.sql.Types.VARCHAR); callableStatement.registerOutParameter(4, java.sql.Types.DATE); // execute getDBUSERByUserId store procedure callableStatement.executeUpdate(); or prepared statements
tagged with: jsp

http://stackoverflow.com/a/22958898
has body: Many has suggested permutation, but for this problem, dynamic programming with bit-mask will be another solution. For dynamic programming, the number of digit can be up to 20 digits, while with normal permutation, it can only be used if N has less than 12 digits. (With time constraint is 1 second , typically for competitive programming) So the idea is, starting from the most significant digit to the least significant digit, at each step, we try to find the smallest value starting from this digit to the end, at each digit, we have two cases: If the number being created is already larger than N for example N is 12345 and currently, we are 23xxx. (We need to find the smallest xxx in this case). If the number is not yet larger than N , example N is 12345 and we have 12xxx. Moreover, at the last digit, we need to determine if the created number is even or odd. So, we have our simple recursive code: public int cal(boolean[] selected, int[] num, int digit, boolean larger) { //Arrays selected will tell which digit in N has already selected, //int digit will tell currently, which digit we are checking //boolean larger tells is the number already larger than N if (digit + 1 == selected.length) {//Last digit for (int i = 0; i &lt; selected.length; i++) { if (!selected[i]) { if (num[i] % 2 != 0) { return -1; // -1 means this is an invalid value } else { if (larger) { return num[i]; } else { return -1; } } } } } int result = -1; for (int i = 0; i &lt; selected.length; i++) { if (!selected[i]) { if (larger) { selected[i] = true; int val = (int) (num[i] * Math.pow(10, digit) + cal(selected, num, digit + 1, larger)); if (val != -1 &amp;&amp; (result == -1 || result &gt; val)) { result = val; } } else if (num[i] &gt;= num[digit]) { int val = (int) (num[i] * Math.pow(10, digit) + cal(selected, num, digit + 1, num[i] &gt; num[digit])); if (val != -1 &amp;&amp; (result == -1 || result &gt; val)) { result = val; } } } } return result; } From this state, we notice that actually, the bool…
score: 1
has comment: http://stackoverflow.com/comment/35067440
has comment: http://stackoverflow.com/comment/35070844
has comment: http://stackoverflow.com/comment/35068145
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35071364
has comment: http://stackoverflow.com/comment/35067719
answers question: http://stackoverflow.com/q/22947484
type: Answer
has comment: http://stackoverflow.com/comment/35067673
has comment: http://stackoverflow.com/comment/35067787
has comment: http://stackoverflow.com/comment/35069307
has comment: http://stackoverflow.com/comment/35065264

http://stackoverflow.com/a/22815593
has body: Mu - You are not asking the right question. Do not worry about the efficiency of such trivial operations until it is a known performance bottleneck in your application. You say you will be nulling/creating 6 references 100s of times. So, you will be creating/nulling/looping &lt; 6000 references. Which is trivial in modern programming. There are likely much better places where you should be spending your development time.
score: 3
upvote count: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22815017

http://stackoverflow.com/comment/34818771
type: AnswerComment
comment on: http://stackoverflow.com/a/22828366
type: Comment
score: 1
has text: `this` must be passed as context. Check ArrayAdapter constructor.

http://stackoverflow.com/q/22958391
upvote count: 1
tagged with: excel
has title: java excel to csv file convert
score: 1
tagged with: java
has body: I am trying to convert .xlsx file to .csv, convertion is happening but the data is not formatted properly. Please find code below and suggest changes to the code. Here I am trying to read an .xlsx file and write it to a csv file i.e. converting xlsx to csv but I am not getting the .csv file in proper format all the data is displayed in a single but it must displayed like rows in Excel. import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Iterator; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; class XlstoCSV { static void xls(File inputFile, File outputFile) { // For storing data into CSV files StringBuffer data = new StringBuffer(); try { FileOutputStream fos = new FileOutputStream(outputFile); // Get the workbook object for XLS file HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(inputFile)); // Get first sheet from the workbook HSSFSheet sheet = workbook.getSheetAt(0); Cell cell; Row row; // Iterate through each rows from first sheet Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { row = rowIterator.next(); // For each row, iterate through each columns Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { cell = cellIterator.next(); switch (cell.getCellType()) { case Cell.CELL_TYPE_BOOLEAN: data.append(cell.getBooleanCellValue() + ","); break; case Cell.CELL_TYPE_NUMERIC: data.append(cell.getNumericCellValue() + ","); break; case Cell.CELL_TYPE_STRING: data.append(cell.getStringCellValue() + ","); break; case Cell.CELL_TYPE_BLANK: data.append("" + ","); break; default: data.append(cell + ","); } data.append('\n'); } } fos.write(data.toString().getBytes()); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOE…
has comment: http://stackoverflow.com/comment/35052822
type: Question
has answer: http://stackoverflow.com/a/57037170
downvote count: 0
has answer: http://stackoverflow.com/a/22958522
has answer: http://stackoverflow.com/a/40879938
has comment: http://stackoverflow.com/comment/35052815
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/35052719
favorite count: 0
has answer: http://stackoverflow.com/a/22958527
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/47098596

http://stackoverflow.com/a/22875118
answers question: http://stackoverflow.com/q/22875013
has body: here's a practice to copy one object from another: public class Contact { private String firstName; private String lastName; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public void clone(Contact c) { setFirstName(c.getFirstName()); setLastName(c.getLastName()); } }
has comment: http://stackoverflow.com/comment/34903739
score: 0
type: Answer

http://stackoverflow.com/comment/34872472
comment on: http://stackoverflow.com/q/22855494
has text: hope this helps.. http://stackoverflow.com/questions/6068803/how-turn-on-camera-flash-light-programmatically-in-android
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22825272
answer count: 1
has comment: http://stackoverflow.com/comment/34823742
tagged with: jdbc
type: AnsweredQuestion
tagged with: java
type: Question
has title: Records are not getting updated with ResultSet
has answer: http://stackoverflow.com/a/22830782
accepted answer: http://stackoverflow.com/a/22830782
has body: I have some JDBC stuff defined over here. I am basically, grabbing records from one table(test.selectiontable) located at 11.11.1.111 and inserting into 22.22.2.222(test.insertiontable). It's a thread based process, so the thread will keep on looking &amp; transferring the records until all records are transferred. and Since I don't want to insert duplicate records into another table, I have a field in test.selectiontable, called DTSStatusType_ti which has initial value of 1 in the table. Hence,I am updating it after transferring the records to test.insertiontable as follows: Line # 112 SelectQueueRS.updateInt( "DTSStatusType_ti", 3 ); Line # 113 SelectQueueRS.updateString( "Queued_DialerIP_vch", 22.22.2.222 ); The initial value of Queued_DialerIP_vch in test.selectiontable is 11.11.1.111. Although the records are getting updated using above two lines of code in my code but I don't think it's an efficient way to update. Could anyone please suggest some efficient way to update the records and 100% make sure that these records are not duplicated ever. Please feel free to suggest any changes in my code. Thanks
score: 0

http://stackoverflow.com/a/22823555
answers question: http://stackoverflow.com/q/22823514
has body: This is just the ability to use any expression as an object, whether a variable, or constructor. As an analogy, the first is like "Grow an apple and put it on the table. Then, make a pie from that apple on the table" The second is akin to "Grow an apple and make a pie out of it". It simply avoid an intermediate variable to hold the apple (in the code, a runnable) If you needed to do something to the apple other than to pass it, you'd need to (in most cases) store to an intermediate variable. The analogy here is "Grow the apple, put it on the table. Peel the apple. Make a new pie using the apple"
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34810411
upvote count: 2

http://stackoverflow.com/q/22942245
has answer: http://stackoverflow.com/a/60971982
has comment: http://stackoverflow.com/comment/35024578
has title: Maven ignores local repository
has comment: http://stackoverflow.com/comment/35024641
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/60971982
tagged with: eclipse
type: Question
has body: I'm trying to use jackson at a json project. And Maven is ignoring my local repository (where I have the library already set, from a previous project) and downloading from codehaus repo. The catch is that my workplace has blocked access to external repos, so I must use local repository for this. How do I force Maven to look first at local and use the library there? Thanks in advance
answer count: 2
upvote count: 6
favorite count: 0
accepted answer: http://stackoverflow.com/a/22942558
has answer: http://stackoverflow.com/a/22942558
score: 6
tagged with: maven

http://stackoverflow.com/comment/34884899
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22864607
has text: Its a initial start-up for you. Now you add new functionality in it. I have just given you a way to iterate all the children.

http://stackoverflow.com/a/22908545
accepted answer of: http://stackoverflow.com/q/22906398
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/22906398
type: Answer
has body: try { Path dir = Paths.get("./brieven").toRealPath(); if (Files.exists(dir) &amp;&amp; Files.isDirectory(dir) &amp;&amp; Desktop.isDesktopSupported()) { Desktop.getDesktop().open(dir.toFile()); } } catch (IOException exc) { exc.printStackTrace(); }

http://stackoverflow.com/a/22900490
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22898629
score: 2
accepted answer of: http://stackoverflow.com/q/22898629
has comment: http://stackoverflow.com/comment/34953820
type: AcceptedAnswer
has body: OK, I got it. I thought the method getDeclaredField is native and JVM stores fields in some hash table. In such a case, my solution would be probably really very fast. However, getDeclaredField is not native. Somehow it obtains all declared fields as an array and then, using searchFields, finds a correct one. Here is an excerpt from the Oracle JDK: private Field searchFields(Field[] fields, String name) { String internedName = name.intern(); for (int i = 0; i &lt; fields.length; i++) { if (fields[i].getName() == internedName) { return getReflectionFactory().copyField(fields[i]); } } return null; } From what we see, it iterates through the array and compares the names. Now it makes sense perfectly. In the example above, there is 17 576 fields. When we assume that typically a field will be located somewhere in the middle, it give us about 8800 iterations just to locate a field. Field's methods set and get are native neither. In some point, it must obviously fall out into the native code, but it is done much later than I expected. So, what my code really does? Instead of using some JVM's internal hash table (which might not even exist), it actually uses an ordinary array on at least one layer. Just from this, not even taking care of the other layers, it must be terribly slower - and it is. Credits: Antimony and NSF for kicking in the right way.
downvote count: 0

http://stackoverflow.com/comment/34914059
comment on: http://stackoverflow.com/a/22881086
type: Comment
score: 0
type: AnswerComment
has text: @MihaiBratulescu No, an empty folder will cause `listFiles()` to provide an empty array.

http://stackoverflow.com/comment/34814310
comment on: http://stackoverflow.com/q/22815199
has text: to Lucas: Employee is public class;
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22946141
has title: using android TextToSpeech feature with a pdf file
type: Question
tagged with: google-text-to-speech
tagged with: android
has answer: http://stackoverflow.com/a/22946878
tagged with: java
tagged with: text-to-speech
upvote count: 1
has body: Android provides as with a feature called TextToSpeech with is capable of speaking the text aloud using this code i can make any sentence to be heard aloud in android . TextToSpeech tts= new TextToSpeech(this, this); int result = tts.setLanguage(Locale.US); tts.speak(**text**, TextToSpeech.QUEUE_FLUSH, null); Here the text variable stores the sentence to be heard but my problem is that i don't want just a variable there what i want is to place an entire pdf or .doc file over there.So that when i click on play button it starts reading the current pdf or (any extension) file aloud with android TextToSpeech feature . any tutorial with pdf reading capability would help me alot.Thanks
answer count: 1
has comment: http://stackoverflow.com/comment/35031898
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35032455
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/34882578
type: QuestionComment
comment on: http://stackoverflow.com/q/22859510
has text: Check My answer on what I am trying to explain. Hope it helps.
score: 0
type: Comment

http://stackoverflow.com/comment/34990636
has text: Yes, i want to makeFrame() if item 2 is selected.. and not just when any other item is selected
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22923054

http://stackoverflow.com/q/22924607
upvote count: 1
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22924664
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/35016982
has body: I am developing a web application in spring, Struts 2,Hibernate with Maven. With the maven I can make war file successfully but when I am deploying it on tomcat 7 I am getting following error. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myTransactionManager' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: entity class not found: dto.CityDTO at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry…
score: 1
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/35321703
has title: org.hibernate.MappingException: entity class not found: dto.CityDTO
tagged with: tomcat
tagged with: struts2

http://stackoverflow.com/a/22812163
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22812001
answers question: http://stackoverflow.com/q/22812001
score: 1
has body: What should I do now? like where do I get this third application server? (amazon web services?) AWS is a good place to start. and is it affordable for students? You pay for what you use. I have no idea of your finances or usage. Only you can answer. Can I use XAMPP to set up a local server and connect it to GCM server? Pass. GCM says that the app server must be able to store the api key and client registration IDs. So I need to learn SQL to store them in the database and learn PHP to communicate with the database? One question mark will do... Anyone who writes code should understand relational databases and SQL. Yes, you should learn it. I only know java, can I write the code that specifies what the server should do in java? You can write the server side in Java.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34789092
has comment: http://stackoverflow.com/comment/34789397
type: Answer

http://stackoverflow.com/q/22914964
has comment: http://stackoverflow.com/comment/34974683
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34974696
has body: I want be able to extract the insides of a method using java reflection (or any other method that might exist). I have a test data where i am generating different styles of charts. I want to be able to display the chart, and then in a panel next to it, display the java code that created that chart. All I need to do is to get into these methods, and pull out the insides. Does reflection allow this? chart = TestData.createChart1(); chart.display() chart = TestData.createChart2(); chart.display() chart = TestData.createChart3(); ... chart = TestData.createChartN(); chart.display() Inside one of my methods i might have something like this : public static PieChart createChart1() { //I WANT ALL THE CODE FROM HERE.... ArrayList&lt;Segment&gt; values = new ArrayList&lt;Segment&gt;(); values.add(new Segment(0, null, 15, "music", Color.RED)); values.add(new Segment(0, null, 52, "photos", Color.BLUE)); values.add(new Segment(0, null, 33, "applications", Color.GREEN)); PieChart pieChart = new PieChart(values, "Disk Space Usage"); pieChart.width = 600; pieChart.height = 600; pieChart.topOffset = 50; pieChart.leftOffset = 50; pieChart.rightOffset = 50; pieChart.bottomOffset = 50; pieChart.initialWidth = 100; pieChart.incrementWidth = 50; //TO HERE.... return pieChart; }
has comment: http://stackoverflow.com/comment/34974832
tagged with: reflection
type: UnansweredQuestion
tagged with: java
has title: Java Reflection : looking at the lines of code in a method?
upvote count: 1
has answer: http://stackoverflow.com/a/22915657
type: Question
has answer: http://stackoverflow.com/a/22916168
has comment: http://stackoverflow.com/comment/34974914
has comment: http://stackoverflow.com/comment/34974895
answer count: 2

http://stackoverflow.com/q/22855836
score: 4
has comment: http://stackoverflow.com/comment/34957289
has answer: http://stackoverflow.com/a/22855955
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34957644
favorite count: 0
has answer: http://stackoverflow.com/a/22855975
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34957577
has title: Eclipse not showing deprecated warning?
tagged with: android
has answer: http://stackoverflow.com/a/22856000
upvote count: 4
tagged with: deprecated
has comment: http://stackoverflow.com/comment/34962307
has comment: http://stackoverflow.com/comment/34868382
tagged with: java
has comment: http://stackoverflow.com/comment/34904466
has comment: http://stackoverflow.com/comment/34957026
has comment: http://stackoverflow.com/comment/34957760
has comment: http://stackoverflow.com/comment/34957565
has comment: http://stackoverflow.com/comment/34899950
type: Question
has body: As per Javadocs: public Date (int year, int month, int day) This constructor was deprecated in API level 1. Date date = new Date(year,month,date); This constructor was deprecated in API Level 1 but my Eclipse isn't giving me deprecation warning in the Android project I'm creating. What can be the issue? Is there a silly mistake that I'm making? I've compiled the project at 4.0 version. I've checked the Lint preferences and it's fine. I've not set an @SuppressWarnings, so that is ruled out. This is the code that I'm using: import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import android.app.Activity; import android.app.DatePickerDialog; import android.app.DatePickerDialog.OnDateSetListener; import android.app.Dialog; import android.content.Context; import android.graphics.Paint; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ListView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; @Override protected Dialog onCreateDialog(int id) { Calendar mCalen = Calendar.getInstance(); int day = mCalen.get(Calendar.DAY_OF_MONTH); int month = mCalen.get(Calendar.MONTH); int year = mCalen.get(Calendar.YEAR); return new DatePickerDialog(this, new OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { String newDate = new StringBuilder().append(dayOfMonth) .append("/").append(monthOfYear + 1).append("/") .append(year).toString(); date = null; timeStamp = null; dateStamp = 0; date = newDate; timeStamp = new Date(year, monthOfYear, dayOfMonth); dateStamp = timeStamp.getTime(); dateTextView.setText(date); } }, year, month, day); }
has comment: http://stackoverflow.com/comment/34957502

http://stackoverflow.com/comment/87018927
type: Comment
has text: Also, this doesn't work if socket is manager by APR (i.e. `https`).
comment on: http://stackoverflow.com/a/32629586
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34969032
comment on: http://stackoverflow.com/a/22911923
score: 1
type: AnswerComment
type: Comment
has text: @Duncan, true but it is a little more "readable" when you do ;)

http://stackoverflow.com/q/22850587
has body: i have this program that encrypt using a DES key in CBC mode , i need an IV: for(double ii=0;ii&lt;9999999999999999;ii++) { String IIV=String.valueOf(ii); IV=String.valueOf(ii); for(int x=0;x&lt;(16-IIV.length());x++) { IV=("0"+IV); } Encrypt.ENC(Secretkey,IV,"Hi"); } i tried to use double and long in the for loop and i still cant initialise the value 9999999999999999 to ii since the IV should be from 0000000000000000 to 9999999999999999
score: 0
has comment: http://stackoverflow.com/comment/34859243
has answer: http://stackoverflow.com/a/22850760
accepted answer: http://stackoverflow.com/a/22934336
has comment: http://stackoverflow.com/comment/34859347
has title: Can't use 9999999999999999 value
has answer: http://stackoverflow.com/a/22850958
has answer: http://stackoverflow.com/a/22850594
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22850594
tagged with: java
has answer: http://stackoverflow.com/a/22934336
has comment: http://stackoverflow.com/comment/34859316
has comment: http://stackoverflow.com/comment/34859157
type: Question
tagged with: long-integer
has comment: http://stackoverflow.com/comment/34859284

http://stackoverflow.com/q/22874129
favorite count: 0
has title: Quicksort WAY slower than Insertion and Selection Sort in Java?
tagged with: quicksort
type: AnsweredQuestion
score: 3
tagged with: performance
downvote count: 0
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/22874145
accepted answer: http://stackoverflow.com/a/22874145
type: Question
has body: So I'm brushing up on my algorithms knowledge and testing runtimes of different sorts, and I've found that my implementation of quicksort is much, much slower than even insertion and selection sorts. The algorithm looks right to me, and it looks identical in practice to several other implementations I found online. But it has to be wrong somehow, because it's on the order of 500x slower than the O(N^2) sorts. Timing the sorts on 3 (deep) copies of a randomized 10000 element array gives: Insertion Sort: (75355000 ns) Selection Sort: (287367000 ns) Quick Sort: (44609075000 ns) Here's the code: public static void quickSort(Thing [] theThings, int left, int right) { int i= left; int j = right; int pivot = theThings[(int)(left + (right-left)*0.5)].getValue(); while (i &lt;= j) { while (theThings[i].getValue() &lt; pivot) i++; while (theThings[j].getValue() &gt; pivot) j--; if (i &lt;= j) { Thing temp = theThings[i]; theThings[i] = theThings[j]; theThings[j] = temp; i++; j--; } if (left &lt; j) quickSort(theThings, left, j); if (right &gt; i) quickSort(theThings, i, right); } } The Thing class is just a dummy I made to play with in my algorithms. It has an integer value generated by Random in the constructor, and not much else. I've verified that the quicksort does correctly sort the array - just much slower than it should. I've tried different pivot choosing methods. I've tried everything I could think of. Maybe I'm just too close to see it, but could anyone tell me what is killing my algorithm?
tagged with: sorting
upvote count: 3
answer count: 1

pruning
tags question: http://stackoverflow.com/q/22952023
type: Tag
tag name: pruning

http://stackoverflow.com/q/22845663
answer count: 1
has title: How do i parse the Ping-Time(integer) of an Ping request(string)?
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/22846416
accepted answer: http://stackoverflow.com/a/22846416
has body: I'm quite new to Android Programming and I'm not that experienced with Java/Android Programming. I wanted to make an app, which pings an address entered by the user. So I found a quit nice script, which does an ICMP Ping Request to an address and gives back the output of the command-line. (In fact it's just the Ping-command, which is ran in an process): public String ping(String url){ int count = 0; String str = ""; try { Process process = Runtime.getRuntime().exec( "/system/bin/ping -c 1 " + url); BufferedReader reader = new BufferedReader(new InputStreamReader( process.getInputStream())); int i; char[] buffer = new char[4096]; StringBuffer output = new StringBuffer(); while ((i = reader.read(buffer)) &gt; 0) output.append(buffer, 0, i); reader.close(); //int time = Integer.parseInt(output[10]) // body.append(output.toString()+"\n"); str = output.toString(); str = str.substring(str.indexOf("time="), str.indexOf("ms")); //str = output.toString(); // Log.d(TAG, str); } catch (IOException e) { // body.append("Error\n"); e.printStackTrace(); } return str; } Output: time = 43 However I don't really understand what everything does here, because it's an script from the Internet. Because I'm just interrested in the time of the response, I want to parse it and turn it into an Integer. In my opinion there are two possibilities Modify the ping command to just give back the time Parse the Integer of the time out of the String I never worked with that kind of stuff, so I wanted to ask you guys if you could help me. :)
tagged with: parsing
has comment: http://stackoverflow.com/comment/34850722
upvote count: 2
tagged with: process
tagged with: ping
downvote count: 1
has comment: http://stackoverflow.com/comment/34849947
has comment: http://stackoverflow.com/comment/34850255
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34850509
has comment: http://stackoverflow.com/comment/34850657
type: Question
has comment: http://stackoverflow.com/comment/34850380
has comment: http://stackoverflow.com/comment/34850632
has comment: http://stackoverflow.com/comment/34850698

http://stackoverflow.com/a/22964383
has body: You do not initialize color variable.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22964342

http://stackoverflow.com/a/22838681
answers question: http://stackoverflow.com/q/22838051
score: 1
upvote count: 1
has body: Assuming that you have managed to compile your code and are having trouble executing it. You need to have the following in your classpath : Compiled classes External dependencies Let's say your project structure looks like follows : | |-- classes |-- package |-- Server.class |-- lib |-- jdbc.jar Here classes contain your compiled java classes (eclipse does it neatly but you might want to look into system specific builds if you are to run them on a different remote server) and lib contains all the external dependencies (jdbc.jar in your case). You can now run your code from the project root by adding classes and lib folders to your classpath : java -cp ./classes:./lib package.Server However, I strongly recommend using a standard project structure and looking into project managers like maven for maintaining projects and building across servers.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/35006533
has text: Better write a batch file.
score: 0
comment on: http://stackoverflow.com/q/22932453
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34944015
comment on: http://stackoverflow.com/a/22896575
score: 0
has text: Make sure to add the right import statement: import java.io.IOException;
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34852266
score: 0
comment on: http://stackoverflow.com/a/22846973
type: Comment
has text: OK, I've removed my downvote now that you've fixed it.
type: AnswerComment

http://stackoverflow.com/q/22840851
has comment: http://stackoverflow.com/comment/34851247
answer count: 1
downvote count: 0
has body: I'm currently puzzled with the way Glassfish 3.1.2.2 handles EJBs. I have an OSGi project, which consists of many OSGi bundles (jars). Also, there are a few WARs, including a Tapestry web application. In one such bundle, let's call it "interfaces.jar", I have an interface defined: public interface MyInterface() { public static final String JNDI_NAME = "java:global/MyInterface"; void myMethod(); } The implementation of that interface is as following, and it's contained in bundle "beans.jar": @Stateless @EJB(name = MyInterface.JNDI_NAME, beanInterface = MyInterface) public class MyBean implements MyInterface() { void myMethod() { ... } } I am calling it from my Tapestry WAR app via JNDI lookup: InitialContext.doLookup(MyInterface.JNDI_NAME); Now, I was reading EJB 3.1 specification, and it says that I can one of the following scenarios: Interface has @Local annotation; EJB is implementing this interface. Interface is a plain Java interface without annotation; EJB with @Local annotation is implementing it. Interface is a plain Java interface without annotation; EJB is implementing it. Interface is a plain Java interface without annotation; EJB with @Local annotation is not implementing it. EJB doesn’t have any special annotations. So, by elimination: I don't have @Local on interface I don't have @Local on EJB Seems somewhat right I don't have @Local on EJB I have @EJB annotation on my EJB So, it seems that it's case 3: "Because it’s the only implemented interface of the EJB, a container assumes that it must be a local business interface." Now, a few questions: Is my interface a local or remote one, since there is no local or remote annotation? If it is local, I should be able to inject it with @EJB annotation, but it fails? If it's remote, it is not in compliance with the explanation a few lines above? If I add either @Local or @Remote, and perform JNDI lookup, I get a naming exception and NPE telling me there is nothing under that JNDI_NAME. How is that possible? What…
tagged with: tapestry
favorite count: 0
type: UnansweredQuestion
has title: Demistifying EJB annotations and injection
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24888380
upvote count: 1
type: Question
tagged with: jakarta-ee
tagged with: ejb
tagged with: jndi

http://stackoverflow.com/comment/39090670
score: 0
type: Comment
type: QuestionComment
has text: You may develop some web services with SAP integration team, that will implement required logic. It isn't hard task from technical point of view. All you need then is to call exposed web serivce from any application using VBA.
comment on: http://stackoverflow.com/q/22918830

http://stackoverflow.com/a/22944196
has comment: http://stackoverflow.com/comment/35028281
answers question: http://stackoverflow.com/q/22943311
type: Answer
accepted answer of: http://stackoverflow.com/q/22943311
has body: Something like Camel is completely appropriate for this task. Things like Camel provide toolsets and components that make stitching together workflows like you describer easier, with the caveat that you must learn the overall tool (i.e. Camel, in this case), first. For a skilled, experience developer, and simple use cases, you can see where they might take the approach that you're taking. Provisioning the workflow with tools at hand, including, perhaps, custom code, rather than taking the time to learn a new tool. Recall while tools can be a great benefit (features, testing, quality, documentation), they also bring a burden (support, resources, complexity). A key aspect of bringing tool sets in to your environment is that while you may not have written the code, you are still ultimately responsible for it's behavior in your environment. So, all that said, you need to ascertain whether the time investment of incorporating a tool like Camel is worth the benefit to your current project. Odds are that if you intend to continue and do more integrations in the future, investing in such a tool would be a good idea, as the tool will make those integration easier. But be conscious that something like Camel, which is quite flexible, also brings along with it inherent complexity. But for simple stuff like what you're talking about, I think it's a solid fit.
has comment: http://stackoverflow.com/comment/35045465
score: 5
has comment: http://stackoverflow.com/comment/35029736
type: AcceptedAnswer
downvote count: 0
upvote count: 5

http://stackoverflow.com/q/22822353
type: Question
has title: Change chracters in String between some other chracters
accepted answer: http://stackoverflow.com/a/22822401
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/34808171
has answer: http://stackoverflow.com/a/22822401
has body: Here is some HTML code. How can delete whitespaces before each string but not touch the whitespaces inside the tags?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34808172

http://stackoverflow.com/comment/34959258
has text: Is it possible for you, to provide a minimum executable JUnit test class, that reproduces your problem? I just tried to reproduce your problem with no luck - i.e. calling `fooImpl.bar(Snafu.class, someStaticFunctionThatReturnsASnafu());` with the `context.checking` method provided by you didn't throw any exceptions (but I didn't really know where you got the `broker` argument from)...
comment on: http://stackoverflow.com/q/22842572
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/22853830
answers question: http://stackoverflow.com/q/22853775
upvote count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34864896
has comment: http://stackoverflow.com/comment/34864738
type: Answer
has comment: http://stackoverflow.com/comment/34865081
has body: int n = arrInt.length; int temp = 0; for (int i = 0; i &lt; n; i++) { for (int v = 1; v &lt; (n - i); v++) { if (arrInt[v - 1] &lt; arrInt[v]) { temp = arrInt[v - 1]; arrInt[v - 1] = arrInt[v]; arrInt[v] = temp; } } } Try this. Update - Replaced j with v

http://stackoverflow.com/comment/35045164
comment on: http://stackoverflow.com/a/22952285
type: AnswerComment
has text: Does halting equate to stopping? And do you think the question of whether it causes the program to quit immediately is too broad and general?
score: 0
type: Comment

http://stackoverflow.com/a/22876535
type: Answer
answers question: http://stackoverflow.com/q/22876161
score: 0
has body: Okay, thanks to you all, I figured out that I needed to add a few more if statements to handle when the distance was zero. Original: if(list.get(i).getX() == list.get(j).getX() &amp;&amp; list.get(i).getY() == list.get(j).getY()){ list.get(i).setXVelocity((float) (list.get(i).getXVelocity())); list.get(i).setYVelocity((float) (list.get(i).getYVelocity())); } else{ list.get(i).setXVelocity((float) (list.get(i).getXVelocity() + calcVelocity(list.get(i),list.get(j),0))); list.get(i).setYVelocity((float) (list.get(i).getYVelocity() + calcVelocity(list.get(i),list.get(j),1))); } Revised: if(list.get(i).getX() == list.get(j).getX()){ list.get(i).setXVelocity((float) (list.get(i).getXVelocity())+1); list.get(i).setYVelocity((float) (list.get(i).getYVelocity() + calcVelocity(list.get(i),list.get(j),1))); } else if(list.get(i).getY() == list.get(j).getY()){ list.get(i).setYVelocity((float) (list.get(i).getYVelocity())+1); list.get(i).setXVelocity((float) (list.get(i).getXVelocity() + calcVelocity(list.get(i),list.get(j),0))); } else if(list.get(i).getX() == list.get(j).getX() &amp;&amp; list.get(i).getY() == list.get(j).getY()){ list.get(i).setXVelocity((float) (list.get(i).getXVelocity())+1); list.get(i).setYVelocity((float) (list.get(i).getYVelocity())+1); } else{ list.get(i).setXVelocity((float) (list.get(i).getXVelocity() + calcVelocity(list.get(i),list.get(j),0))); list.get(i).setYVelocity((float) (list.get(i).getYVelocity() + calcVelocity(list.get(i),list.get(j),1))); }

http://stackoverflow.com/q/22863534
score: 4
has body: In a XML file Some entity are declared for exp: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!--Arbortext, Inc., 1988-2004, v.4002--&gt; &lt;!DOCTYPE test PUBLIC "-//Atul//DTD ATM - TEST//EN//-" "test.dtd" [ &lt;!ENTITY ent1 SYSTEM "Graphic/test1.txt" NDATA ccitt4&gt; &lt;!ENTITY ent1 SYSTEM "Graphic/test1.txt" NDATA ccitt4&gt; &lt;!ENTITY ent2 SYSTEM "Graphic/test2.txt" NDATA ccitt4&gt; &lt;!ENTITY ent3 SYSTEM "Graphic/test4.txt" NDATA ccitt4&gt; ]&gt; &lt;test id="01" &gt; &lt;/test&gt; I Have to find that ent1 is declared more than once . For the moment we are using getEntities method NamedNodeMap entities = lJDocumentXML.getDoctype().getEntities(); http://docs.oracle.com/javase/7/docs/api/org/w3c/dom/DocumentType.html#getEntities() Which do not returns duplicate entity (it returns only ent1 ,ent2 and ent3) and external entity if any in the referenced dtd Is there any way to get all the four entities ? Thanks Atul
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/57794420
has title: Find Duplicate Entity tag from XML using java
tagged with: java
tagged with: dom
has answer: http://stackoverflow.com/a/57807482
upvote count: 4
answer count: 2
tagged with: xml-parsing
downvote count: 0

http://stackoverflow.com/a/22875365
has body: Byte.decode accepts a String that may begin with 0x or 0X. (It may also parse a decimal or octal number depending on what the string looks like.)
answers question: http://stackoverflow.com/q/22875308
score: 0
type: Answer

http://stackoverflow.com/comment/35004960
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22930660
has text: You have some bean which is autowired with `Properties`. You have to specify `byName` for this one. Which bean is affected you can see by that StackTrace.
type: AnswerComment

structure
tags question: http://stackoverflow.com/q/22882892
tag name: structure
tags question: http://stackoverflow.com/q/22903647
type: Tag

http://stackoverflow.com/comment/34952647
has text: Some good points, not sure about the last one (15 lines), especially when you need to do things like I/O or database access, easy to 10-15 lines dedicated to state management along - just saying ;) - definitely should do one thing and do it will though...
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22902456

import
type: Tag
tags question: http://stackoverflow.com/q/22949618
tags question: http://stackoverflow.com/q/22945684
tag name: import
tags question: http://stackoverflow.com/q/22937127
tags question: http://stackoverflow.com/q/22882764
tags question: http://stackoverflow.com/q/22955840
tags question: http://stackoverflow.com/q/22931020
tags question: http://stackoverflow.com/q/22874109
tags question: http://stackoverflow.com/q/22868371
tags question: http://stackoverflow.com/q/22840259

http://stackoverflow.com/comment/34881356
type: AnswerComment
has text: @GroovyDotCom Which part do you not want to do, and why?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22856260

http://stackoverflow.com/q/22867872
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/22872746
type: Question
has answer: http://stackoverflow.com/a/22869942
accepted answer: http://stackoverflow.com/a/22869942
has body: I'm wondering : I have to manage an application on GAE, and have to manage this application at different stages of its life cycle. The app uses datastore, Google Cloud Storage, and a bit of Google Maps API. I would like to have at least two environment, development and production, if not more. Is it possible to do so easily ? How should I do that ? For instance, do I need to have two separate apps in my appengine console ? Also, there is a big datastore with many users (about 9000 and counting), which I need to manage, but i would like to be able to copy this datastore form an environment to another (to avoid polluting the production datastore with dev values). Is it possible? and if yes, how slow would it be to do an automatic backup of the production datastore in the dev datastore, knowing that there are about 1 000 000 entities in it? Are there some tools that can provide help in my case (besides Git and Maven ;) ?
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22872746
favorite count: 0
tagged with: google-app-engine
tagged with: dev-to-production
has title: Manage different stages of development with AppEngine

http://stackoverflow.com/comment/34853215
has text: which version of commons-collections are you using?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22847455

http://stackoverflow.com/q/22912432
answer count: 1
has answer: http://stackoverflow.com/a/22946211
has comment: http://stackoverflow.com/comment/34970170
tagged with: awt
has comment: http://stackoverflow.com/comment/34970552
has comment: http://stackoverflow.com/comment/34970850
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22946211
tagged with: applet
tagged with: macos
has title: Null Pointer Exception when calling java.awt.Toolkit.getDefaultToolkit() from OS X Applet
type: Question
has body: I'm getting the following NPE when trying to view a Java applet on OS X 10.7.5: [2014-04-07T11:39:22.035] [thread applet-com.OTHERCOMPANY.wave.applets.PRODUCT.PRODUCT.class-2] com.COMPANY.nm.logging.LogMaster.auditLoggingMessage AUDIT: HEMXL0001A=Audit logging is enabled. Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException at com.COMPANY.XYZ.applets.PRODUCT.ui.table.TableMouseListener.&lt;init&gt;(TableMouseListener.java:71) at com.COMPANY.XYZ.applets.PRODUCT.PRODUCTTable.&lt;init&gt;(PRODUCTTable.java:315) I do not have the source but assume to have found TableMouseListener.java:71 using javap: public com.COMPANY.XYZ.applets.PRODUCT.ui.table.TableMouseListener(com.COMPANY.XYZ.applets.PRODUCT.PRODUCTContext, javax.swing.JTable); flags: ACC_PUBLIC Code: stack=5, locals=4, args_size=3 0: aload_0 1: invokespecial #1 // Method com/OTHERCOMPANY/wave/uicomponents/PopupListener."&lt;init&gt;":()V 4: aload_0 5: aconst_null 6: putfield #2 // Field firstClickEvent:Ljava/awt/event/MouseEvent; 9: aload_0 10: aload_1 11: putfield #3 // Field context:Lcom/COMPANY/XYZ/applets/PRODUCT/PRODUCTContext; 14: aload_0 15: aload_2 16: putfield #4 // Field table:Ljavax/swing/JTable; THIS ---&gt; 19: invokestatic #5 // Method java/awt/Toolkit.getDefaultToolkit:()Ljava/awt/Toolkit; 22: ldc #6 // String awt.multiClickInterval 24: invokevirtual #7 // Method java/awt/Toolkit.getDesktopProperty:(Ljava/lang/String;)Ljava/lang/Object; 27: checkcast #8 // class java/lang/Integer 30: invokevirtual #9 // Method java/lang/Integer.intValue:()I 33: istore_3 34: aload_0 THIS ---&gt; 35: new #10 // class javax/swing/Timer 38: dup 39: iload_3 40: aload_0 41: invokespecial #11 // Method javax/swing/Timer."&lt;init&gt;":(ILjava/awt/event/ActionListener;)V 44: putfield #12 // Field clickTimer:Ljavax/swing/Timer; 47: return LineNumberTable: line 65: 0 line 62: 4 line 66: 9 line 67: 14 line 71: 19 line 72: 34 line 73: 47 Any good ideas what might cause this and what could be a workaround? I'm …
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34972054

http://stackoverflow.com/comment/35012402
comment on: http://stackoverflow.com/q/22935550
score: 0
has text: use a Timer and check Time between
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35060582
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22962284
type: Comment
has text: Oh, right. You'll have to use an initialization block. I edited my post.

http://stackoverflow.com/q/22926420
has comment: http://stackoverflow.com/comment/34996481
tagged with: sql
downvote count: 0
has comment: http://stackoverflow.com/comment/34996385
has comment: http://stackoverflow.com/comment/35001359
has comment: http://stackoverflow.com/comment/34996347
favorite count: 0
type: Question
tagged with: exception
has answer: http://stackoverflow.com/a/37855018
answer count: 2
tagged with: jdbc
upvote count: 6
tagged with: java
has comment: http://stackoverflow.com/comment/34996513
tagged with: mysql
has comment: http://stackoverflow.com/comment/34996377
has comment: http://stackoverflow.com/comment/34999111
has comment: http://stackoverflow.com/comment/34999805
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34999405
has title: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '' for key 'PRIMARY'
has answer: http://stackoverflow.com/a/22928560
has body: I am getting this exception from today onwards. Yesterday things were fine. I will post my code : public void enterStaff() throws ClassNotFoundException, SQLException { try { Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager .getConnection("jdbc:mysql://localhost:3306/project?" + "user=root&amp;password=virus"); statement = connect.createStatement(); preparedStatement = connect .prepareStatement("SELECT count(*)FROM information_schema.tables\n" + "WHERE table_schema = 'project' AND table_name = 'staff'"); rs = preparedStatement.executeQuery(); rs.next(); int chk = rs.getInt(1); if (chk != 1) { preparedStatement = connect .prepareStatement("create table staff (staffname varchar(30) primary key);"); preparedStatement.executeUpdate(); } preparedStatement = connect .prepareStatement("insert into staff values(?);"); preparedStatement.setString(1, addSubName.getText()); preparedStatement.executeUpdate(); } catch (ClassNotFoundException | SQLException e) { throw e; } finally { close2(); } } private void close2() { try { if (statement != null) { statement.close(); } if (connect != null) { connect.close(); } } catch (SQLException e) { } } I am trying to create a table with only one column and that column is the primary key. When the code is run for the first time the table is getting created. But value is not getting entered. No exception is shown then. But when I try to enter value for the second time, the exception comes up. How can I correct this ? If anyone needs to see some more code I will post it. This is the code through which the user enters the data : addSubName = new TextField(); addSubName.setPromptText("Staff Name"); addSubName.setPrefSize(200, 30); final Button b2 = new Button("Add"); b2.setFont(Font.font("Calibri", FontWeight.BOLD, 17)); b2.setPrefSize(70, 30); b2.setStyle(" -fx-base: #0066ff;"); b2.setTextFill(Color.BLACK); b2.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent e) { data.add(new Staff(add…
score: 6

http://stackoverflow.com/q/22885917
tagged with: eclipse
linked to: http://stackoverflow.com/q/21289516
type: Question
tagged with: executable-jar
tagged with: jar
has comment: http://stackoverflow.com/comment/34924120
score: 0
has title: Connecting to Microsoft Access Database from Runnable JAR file
has comment: http://stackoverflow.com/comment/34929169
tagged with: ms-access
answer count: 0
type: UnansweredQuestion
has body: When I use eclipse to create a runnable JAR file, it opens, however, it does not connect to the database. When I use eclipse to to run the said file and, there is no problem. NOTE Db is a System Data Source that connects to the Microsoft Access Database The specific error is java.sql.SQLException:[Microsoft][OBDC Driver Manager] The specific DSN contains an architechture mismatch between the Driver Application Is there a way to solve this? Code to connect to database is below. private void formWindowOpened(java.awt.event.WindowEvent evt) { try{ String driver = "sun.jdbc.odbc.JdbcOdbcDriver"; Class.forName(driver); String login = "jdbc:odbc:Db"; conn = DriverManager.getConnection(login); System.out.print("Connected"); }catch (Exception ex){} }
has comment: http://stackoverflow.com/comment/34939425
has comment: http://stackoverflow.com/comment/34925787
tagged with: java

http://stackoverflow.com/comment/34882906
type: QuestionComment
comment on: http://stackoverflow.com/q/22864164
has text: Depends on what kind of `Panel` you are using. `ComplexPanel` and subclasses have the method [getChildren()](http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/ComplexPanel.html#getChildren()) which will return an `Iterator`. You would have to implement some recursive logic as well. Don't think there is something built-in that will return all children (maybe on `Element` level?).
score: 0
type: Comment

http://stackoverflow.com/a/22837773
upvote count: 2
has body: Here I found Solution to my question please observer here. "itemList_dump" is an arraylist which contains data. if (i &lt; itemList_dump.size()) { MyBitamp Data = itemList_dump.get(original_position_val); // setting Values according to our algorithm Data.setItemCurPos(original_position_val); Data.setItemPosition(current_positon_val); Data.setrotation(rotataion_val); } } Collections.sort(itemList_dump, new Comparator&lt;MyBitamp&gt;() { @Override public int compare(MyBitamp o1, MyBitamp o2) { if (o1.getItemPosition() &gt; o2.getItemPosition()) { return 1; } else if (o1.getItemPosition() &lt; o2.getItemPosition()) { return -1; } else { return 0; } } });
accepted answer of: http://stackoverflow.com/q/22809348
answers question: http://stackoverflow.com/q/22809348
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/34898785
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22872362
has text: Why do you prepare a new object for this?
score: 0

http://stackoverflow.com/a/22819581
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22819319
has comment: http://stackoverflow.com/comment/50470233
has body: You are not compiling the code , before you execute the line. javac line is missing in run.sh Why dont you try j2sch, it make your life even simpler.

http://stackoverflow.com/a/22963209
type: Answer
downvote count: 0
score: 1
type: AcceptedAnswer
has body: This is because the reading method is a blocking method. This means it is trying to read until it gets a -1 to show that the read data are finished. Ensure that the OutputStream which writes to this socket is sending this. So you invoke at sending socket the ObjectOutputStream.flush(); method after you wrote the data or just close the output stream after writing. Closing this one would'nt be reasonable, because probably you may want to send further data throug this stream later. Just a general thing: You don't need to flush the outputstream immediatley after you have created it
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22962932
has comment: http://stackoverflow.com/comment/35062384
answers question: http://stackoverflow.com/q/22962932

http://stackoverflow.com/comment/34892433
has text: @ramesh027 Is `/spring/application-config.xml` the your dispatcher servlet config? If it isn't, switch it.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22869127

http://stackoverflow.com/q/22891021
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34932054
has comment: http://stackoverflow.com/comment/34932036
possible better answer: http://stackoverflow.com/a/22891091
type: Question
has body: In netbeans I can see two different icons in front of two different java files which are and What is the difference between them?
has comment: http://stackoverflow.com/comment/34932090
answer count: 2
has comment: http://stackoverflow.com/comment/34932024
has comment: http://stackoverflow.com/comment/34932001
has answer: http://stackoverflow.com/a/22891091
has comment: http://stackoverflow.com/comment/34932140
upvote count: 1
has comment: http://stackoverflow.com/comment/34932156
has title: Java Files in Netbeans
has comment: http://stackoverflow.com/comment/34932238
favorite count: 0
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/22891145
downvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22891145
has comment: http://stackoverflow.com/comment/34932017

http://stackoverflow.com/q/22959124
score: 0
answer count: 1
has body: Actually I deploy my projects on the server with Maven ("mvn deploy"), I would like to just deploy jar and not the files md5, sha1, xml ... For the connection I use : <distributionManagement> myID <url>scp://myURL/url> </distributionManagement> and org.apache.maven.wagon wagon-ssh 2.4 Thanks in advance !
tagged with: tomcat
has title: How to just deploy jar from Maven?
has comment: http://stackoverflow.com/comment/35059949
tagged with: maven
has answer: http://stackoverflow.com/a/22964755
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/35060836
tagged with: deployment
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35062381
type: Question

http://stackoverflow.com/q/22857120
has title: Assigning null to variable in finally block
tagged with: exception
type: UnansweredQuestion
score: -2
tagged with: java
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/34870392
has body: The output of the following piece of code is "Test Passed"; can someone explain to me why ? public class Test { public static void main(String args[]) { System.out.println(new Test().print()); } protected StringBuilder print() { StringBuilder builder = new StringBuilder(); try { builder.append("Test "); return builder.append("Passed!!!"); } finally { builder = null; } }
linked to: http://stackoverflow.com/q/65035
type: Question
tagged with: try-catch
tagged with: stringbuilder
duplicate of: http://stackoverflow.com/q/65035
has answer: http://stackoverflow.com/a/22857238
answer count: 2
has answer: http://stackoverflow.com/a/22857219
tagged with: finally
favorite count: 0

http://stackoverflow.com/q/22877256
tagged with: java
upvote count: 1
has body: Is there a way to make ebean eagerly fetch the blobs under certain cases using the ebean Query API? I know that discarding the @Lob annotation will make ebean fetch the blobs but this will fetch the blobs under all cases which is not what I want.
answer count: 1
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: ebean
has title: Eager fetching blobs in Ebean under certain cases
has answer: http://stackoverflow.com/a/22892291
tagged with: playframework-2.0

http://stackoverflow.com/a/22860344
score: 1
has body: If you are doing benchmarks, you should: doing a warm-up phase (due to JIT compilation and class loading), repeat the test several times (due to garbage collection). If I create such a benchmark that is similar to your benchmark, I get the following results: Warmup... Benchmark... 4 * 500000: 0.22s / 0.04s 4 * 1000000: 0.55s / 0.10s 4 * 1500000: 1.10s / 0.16s 4 * 2000000: 0.90s / 0.19s 4 * 2500000: 1.68s / 0.25s The first number shows the number of threads, the second number the size of the int ranges, the third number is the duration for a synchronized Map and the fourth number the duration for ConcurrentHashMap. As you can see, the ConcurrentHashMap is in all cases significantly faster. Below you can find the whole Java code. Note that is makes use of features from Java 8. However, that should have no impact on the results: public static void main(String... args) { System.out.println("Warmup..."); for (int i = 0; i &lt; 10000; ++i) { test(Collections.synchronizedMap(new HashMap&lt;&gt;()), 2, 1000); test(new ConcurrentHashMap&lt;&gt;(), 2, 1000); } System.out.println("Benchmark..."); for (int i = 0; i &lt; 5; ++i) { int threads = 4; int range = 500000 * (i + 1); System.out.printf("%2d * %7d: %s / %s\n", threads, range, test(Collections.synchronizedMap(new HashMap&lt;&gt;()), threads, range), test(new ConcurrentHashMap&lt;&gt;(), threads, range)); } } public static String test(Map&lt;Integer,Object&gt; map, int threads, int range) { long duration = IntStream.range(0, 10) .mapToLong(i -&gt; execute( IntStream.range(0, threads) .&lt;Runnable&gt;mapToObj(t -&gt; () -&gt; bulkPut(map, t * range, (t + 1) * range, new Object())) .toArray(Runnable[]::new))) .min().getAsLong(); return String.format("%4.2fs", duration / 1000.0, threads, range); } public static &lt;T&gt; void bulkPut(Map&lt;Integer,T&gt; map, int from, int to, T value) { for (int i = from; i &lt; to; ++i) { map.put(i, value); } } public static long execute(Runnable... runnables) { List&lt;Thread&gt; threads …
answers question: http://stackoverflow.com/q/22854622
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/66321447
answers question: http://stackoverflow.com/q/22895936
has body: Scanner input = new Scanner (System.in); int num , counter = 0 ,temp; System.out.print("Enter Nmber :"); num = input.nextInt(); int lnum = num; while ( num != 0 ){ num = num/10 ; counter++; } int store_num_keyboard_input = lnum; int new_tot = 0; int c = counter; while(lnum > 0){ temp = lnum % 10; lnum = lnum / 10 ; int m = 0; //m is counter int tot = 1; while (m != c){ tot = tot * temp; m++; } new_tot = new_tot + tot; } System.out.println("new total "+ new_tot ); if(new_tot == store_num_keyboard_input){ System.out.println(store_num_keyboard_input + " is an Armstrong number" ); } else{ System.out.println(store_num_keyboard_input + " is not an Armstrong number" ); }
has comment: http://stackoverflow.com/comment/117252867
downvote count: 1
score: -1
upvote count: 0
type: Answer

http://stackoverflow.com/comment/35054438
type: Comment
has text: Directed at who ever wants to close this. I do not see how this would be primarily opinion-based. As there are always **reasons** behind why a feature may not be in a language, I also might be overlooking functionality, and the Java Expert Group uses mailing list conversations, and in there this might have been brought up.
type: QuestionComment
comment on: http://stackoverflow.com/q/22959427
score: 3

http://stackoverflow.com/q/22894996
upvote count: 1
has title: Java class to give the long string format of a date? (In words, as if spoken)
favorite count: 0
downvote count: 0
has body: After looking through the calendar and date classes, it seeems as though there is no conventional way of turning a time into its word alternative. For xample, If the time was 12:20 pm, then I would like it to be converted to twelve forty five p.m. Is there any premade class for this? Half the methods in the date class are deprecated.
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: date
type: Question
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/34939590
has answer: http://stackoverflow.com/a/22895426
accepted answer: http://stackoverflow.com/a/22895426

sockets
tags question: http://stackoverflow.com/q/22882430
tags question: http://stackoverflow.com/q/22931811
tags question: http://stackoverflow.com/q/22881227
tags question: http://stackoverflow.com/q/22928114
tags question: http://stackoverflow.com/q/22870027
tags question: http://stackoverflow.com/q/22821402
tags question: http://stackoverflow.com/q/22865969
tags question: http://stackoverflow.com/q/22883873
tags question: http://stackoverflow.com/q/22821056
tags question: http://stackoverflow.com/q/22817969
tags question: http://stackoverflow.com/q/22894748
tags question: http://stackoverflow.com/q/22901328
tags question: http://stackoverflow.com/q/22920753
tags question: http://stackoverflow.com/q/22867385
tags question: http://stackoverflow.com/q/22891008
tags question: http://stackoverflow.com/q/22820601
tags question: http://stackoverflow.com/q/22809876
tags question: http://stackoverflow.com/q/22870782
tags question: http://stackoverflow.com/q/22832700
tags question: http://stackoverflow.com/q/22831544
tags question: http://stackoverflow.com/q/22846816
tags question: http://stackoverflow.com/q/22922200
type: Tag
tags question: http://stackoverflow.com/q/22900261
tags question: http://stackoverflow.com/q/22811237
tags question: http://stackoverflow.com/q/22826357
tags question: http://stackoverflow.com/q/22921402
tags question: http://stackoverflow.com/q/22935172
tags question: http://stackoverflow.com/q/22812575
tags question: http://stackoverflow.com/q/22889264
tags question: http://stackoverflow.com/q/22851289
tags question: http://stackoverflow.com/q/22824750
tags question: http://stackoverflow.com/q/22896241
tags question: http://stackoverflow.com/q/22900547
tags question: http://stackoverflow.com/q/22926666
tags question: http://stackoverflow.com/q/22939344
tags question: http://stackoverflow.com/q/22897840
tags question: http://stackoverflow.com/q/22927210
tags question: http://stackoverflow.com/q/22911464
tag name: sockets
tags question: http://stackoverflow.com/q/22817024
tags question: http://stackoverflow.com/q/22820330
tags question: http://stackoverflow.com/q/22940216
tags question: http://stackoverflow.com/q/22876038
tags question: http://stackoverflow.com/q/22813377
tags question: http://stackoverflow.com/q/22942939
tags question: http://stackoverflow.com/q/22819718
tags question: http://stackoverflow.com/q/22869921
tags question: http://stackoverflow.com/q/22884342
tags question: http://stackoverflow.com/q/22935541
tags question: http://stackoverflow.com/q/22847799
tags question: http://stackoverflow.com/q/22846898

http://stackoverflow.com/comment/119914468
comment on: http://stackoverflow.com/a/25598591
type: AnswerComment
has text: And, then to get the total bytes, like Java's `.getBytes()`? Add values in array? i.e. `Array.from(new TextEncoder().encode('some delicious cookie')).reduce((acc, current) => acc + current, 0)`
score: 0
type: Comment

http://stackoverflow.com/a/22849166
has comment: http://stackoverflow.com/comment/69905323
score: 9
has comment: http://stackoverflow.com/comment/69905667
upvote count: 9
has comment: http://stackoverflow.com/comment/34895407
answers question: http://stackoverflow.com/q/22848738
has body: The different proxying methods available, JDK and CGLIB, allow you to add more types to your object than those that it inherits. For example, you can declare a Foo bean that extends no classes (except Object) and implements no interfaces. For whatever reason, you can decide that you want to proxy this bean and make it implement the Bar interface and extend the SomeRandomType class. The target object here would be the bean of type Foo. The Spring proxy is an object that delegates to the target bean, shares its type, and additionally can have more types, as in the example above. Therefore target refers to the proxied bean and this refers to the proxy.
downvote count: 0
has comment: http://stackoverflow.com/comment/69905616
has comment: http://stackoverflow.com/comment/69905517
type: Answer

http://stackoverflow.com/comment/34951552
has text: I understand your code, but where would I go inserting it? My method needs to be return type double.
type: AnswerComment
comment on: http://stackoverflow.com/a/22901836
score: 0
type: Comment

http://stackoverflow.com/comment/34962033
comment on: http://stackoverflow.com/a/22815989
type: Comment
score: 0
type: AnswerComment
has text: hi, Thanks for replying... Can You give me some example or reference ?

http://stackoverflow.com/comment/34821633
type: Comment
comment on: http://stackoverflow.com/q/22829071
score: 0
type: QuestionComment
has text: which component should i use within Custom ListView??

http://stackoverflow.com/comment/34790060
type: AnswerComment
score: 0
type: Comment
has text: i know this is alternative but link is create every true condition
comment on: http://stackoverflow.com/a/22812581

http://stackoverflow.com/a/22904620
has body: if you want you can do: HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(){ @Override public boolean equals(Object o) { // TODO comparison here return super.equals(o); } }; map.equals(new HashMap&lt;String, String&gt;());
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22904511

http://stackoverflow.com/comment/34796283
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22815786
type: Comment
has text: I'm very curious as well as to why the one situation can be caught and the other can't. My guess right now would simply be that the compiler only does it for classes and not for interfaces, but I don't see why it would restrict itself to that.

http://stackoverflow.com/comment/34890536
type: Comment
comment on: http://stackoverflow.com/q/22868429
has text: You're getting a 404. Can we see your mvc configuration?
score: 0
type: QuestionComment

javascript
tags question: http://stackoverflow.com/q/22948704
tags question: http://stackoverflow.com/q/22938813
tags question: http://stackoverflow.com/q/22852288
tags question: http://stackoverflow.com/q/22891808
tags question: http://stackoverflow.com/q/22858488
tags question: http://stackoverflow.com/q/22827264
tags question: http://stackoverflow.com/q/22821590
tags question: http://stackoverflow.com/q/22968344
tags question: http://stackoverflow.com/q/22876959
tags question: http://stackoverflow.com/q/22961403
tag name: javascript
tags question: http://stackoverflow.com/q/22909052
tags question: http://stackoverflow.com/q/22831549
tags question: http://stackoverflow.com/q/22810214
tags question: http://stackoverflow.com/q/22872625
tags question: http://stackoverflow.com/q/22966019
tags question: http://stackoverflow.com/q/22906098
tags question: http://stackoverflow.com/q/22956260
tags question: http://stackoverflow.com/q/22809876
tags question: http://stackoverflow.com/q/22868379
type: Tag
tags question: http://stackoverflow.com/q/22922245
tags question: http://stackoverflow.com/q/22829654
tags question: http://stackoverflow.com/q/22856279
tags question: http://stackoverflow.com/q/22905896
tags question: http://stackoverflow.com/q/22917065
tags question: http://stackoverflow.com/q/22854513
tags question: http://stackoverflow.com/q/22929582
tags question: http://stackoverflow.com/q/22966976
tags question: http://stackoverflow.com/q/22914599
tags question: http://stackoverflow.com/q/22897000
tags question: http://stackoverflow.com/q/22908264
tags question: http://stackoverflow.com/q/22962677
tags question: http://stackoverflow.com/q/22911512
tags question: http://stackoverflow.com/q/22893520
tags question: http://stackoverflow.com/q/22891360
tags question: http://stackoverflow.com/q/22829448
tags question: http://stackoverflow.com/q/22881297
tags question: http://stackoverflow.com/q/22911806
tags question: http://stackoverflow.com/q/22855661
tags question: http://stackoverflow.com/q/22901206
tags question: http://stackoverflow.com/q/22922912
tags question: http://stackoverflow.com/q/22953915
tags question: http://stackoverflow.com/q/22872926
tags question: http://stackoverflow.com/q/22827974
tags question: http://stackoverflow.com/q/22814284
tags question: http://stackoverflow.com/q/22885484
tags question: http://stackoverflow.com/q/22928025
tags question: http://stackoverflow.com/q/22865047
tags question: http://stackoverflow.com/q/22865815
tags question: http://stackoverflow.com/q/22831111
tags question: http://stackoverflow.com/q/22965297
tags question: http://stackoverflow.com/q/22953490
tags question: http://stackoverflow.com/q/22808798
tags question: http://stackoverflow.com/q/22891062
tags question: http://stackoverflow.com/q/22945720
tags question: http://stackoverflow.com/q/22860001
tags question: http://stackoverflow.com/q/22852420
tags question: http://stackoverflow.com/q/22851195
tags question: http://stackoverflow.com/q/22861828
tags question: http://stackoverflow.com/q/22852074
tags question: http://stackoverflow.com/q/22892675
tags question: http://stackoverflow.com/q/22928688
tags question: http://stackoverflow.com/q/22844044
tags question: http://stackoverflow.com/q/22864729
tags question: http://stackoverflow.com/q/22953136
tags question: http://stackoverflow.com/q/22949988

http://stackoverflow.com/q/22900125
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/22900166
upvote count: 0
has comment: http://stackoverflow.com/comment/34948503
has answer: http://stackoverflow.com/a/22900218
has body: I have a toString method with a bunch of nested if statements. I think I have everything right but I'm getting a "missing return statement" error. Anyone can see why? Thanks. public String toString() //to tell the user what card/s they have //c.toString() { //for printing?// // ArrayList&lt;String&gt; forPrint = new ArrayList&lt;String&gt;(); getSuit(); getValue(); for(int i = 0; i &lt; 5; i++) { if(suit == 1) { if(value == 11) { return "Jack of Clubs"; // forPrint.add("Jack of Clubs"); } else if(value == 12) { return "Queen of Clubs"; // forPrint.add("Queen of Clubs"); } else if(value == 13) { return "King of Clubs"; // forPrint.add("King of Clubs"); } else if(value == 1) { return "Ace of Clubs"; // forPrint.add("Ace of Clubs") } else { return value + " of Clubs"; // forPrint.add(value + " of Clubs"); } } else if(suit == 2) { if(value == 11) { return "Jack of Diamonds"; // forPrint.add("Jack of Diamonds"); } else if(value == 12) { return "Queen of Diamonds"; // forPrint.add("Queen of Diamonds"); } else if(value == 13) { return "King of Diamonds"; // forPrint.add("KIng of Diamonds"); } else if(value == 1) { return "Ace of Diamonds"; // forPrint.add("Ace of Diamonds"); } else{ return value + "of Diamonds"; // forPrint.add(value + " of Diamonds"); } } else if(suit == 3) { if(value == 11) { return "Jack of Hearts"; // forPrint.add("jack of Hearts"); } else if(value == 12) { return "Queen of Hearts"; // forPrint.add("Queen of Hearts"); } else if(value == 13) { return "King of Hearts"; // forPrint.add("King of Hearts"); } else if(value == 1) { return "Ace of Hearts"; // forPrint.add("Ace of Hearts"); } else { return value + "of Hearts"; // forPrint.add(value + " of Hearts"); } } else if(suit == 4) { if(value == 11) { return "Jack of Spades"; // forPrint.add("Jack of Spades"); } else if(value == 12) { return "Queen of Spades"; // forPrint.add( } else if(value == 13) { return "King of Spades"; } else if(value == 1) { return "Ace of Spades"; } else { return value + "of Spad…
has answer: http://stackoverflow.com/a/22900178
favorite count: 0
has answer: http://stackoverflow.com/a/22900148
tagged with: compiler-errors
type: UnansweredQuestion
score: -3
answer count: 4
has title: missing return type compile error
tagged with: java

http://stackoverflow.com/q/22825452
has answer: http://stackoverflow.com/a/22848918
accepted answer: http://stackoverflow.com/a/22848918
type: AnsweredQuestion
tagged with: ant
tagged with: svn
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/12891893
has body: I have a property file (x.props) that contains properties required for an Ant build: x.props: prop1=something prop2=somethingElse set in build.xml: &lt;property file="x.props" /&gt; The properties contained in x.props are then used in a path task: &lt;path id="project.class.path"&gt; &lt;pathelement location="${prop1}/important.jar"/&gt; &lt;pathelement location="${prop2}/anotherImportant.jar"/&gt; &lt;/path&gt; Before compilation starts. I don't explicitly create these properties in build.xml The x.props file can be different for each local user, but for server builds it doesn't change. I created an x.props.template file to address the problem of users accidentally checking in or updating this file (but they need to be able to check it out). I want to be able to create an x.props file from the x.props.template (I set x.props as svn:ignore). Users can save the template file as x.props and edit it and - theoretically, the server Ant build.xml can copy the template file to the server x.props if it doesn't exist. But that's not happening. I tried using a target: &lt;target name="x-props-file" unless="prop1" description="create a local.properties file if it doesn't exist"&gt; &lt;copy file="x.props.template" tofile="x.props" /&gt; &lt;/target&gt; But it's called AFTER the path is set. I tried creating the file as a condition: &lt;condition available="x.props"&gt; &lt;not&gt; &lt;copy file="x.props.template" tofile="x.props" /&gt; &lt;/not&gt; &lt;/condition&gt; But 'not' and 'condition' don't work with copy. loadProperties will fail if the file isn't found - but it won't copy a file. Ideally I'd like to be able to copy the new x.props right after the initial file load fails. Is there any way around this? ant version 1.1 java 7 Thanks
has title: Apache Ant conditionally copy file from template and load properties
answer count: 1
score: 0

http://stackoverflow.com/comment/34950704
comment on: http://stackoverflow.com/a/22901340
score: 2
has text: That's a good point. If this thing is implemented as a heap, for example, under the hood, then yeah you're likely to see some really funny things when you serialize it. (in fact maintaining a full sort on the priority queue is often very inefficient for the task)
type: AnswerComment
type: Comment

http://stackoverflow.com/a/59213964
downvote count: 0
answers question: http://stackoverflow.com/q/22911722
type: Answer
score: 1
has body: Another functional implementation int array[] = new int[]{1,3,7,5}; int maxIndex =IntStream.range(0,array.length) .boxed() .max(Comparator.comparingInt(i -&gt; array[i])) .map(max-&gt;array[max]) .orElse(-1);
upvote count: 1

http://stackoverflow.com/comment/35067614
has text: If you know better option to do this I will follow to that with pleasure. @eis I've seen the oracle forums as well and I thought all developers are here and it could be helpful for everyone. This was the purpose.
score: 1
comment on: http://stackoverflow.com/q/22961733
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34925445
type: Comment
has text: you must return rootView at the end of onCreateView(), not ourBrow. You have to return your fragment View.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22887034

http://stackoverflow.com/comment/34899518
type: QuestionComment
has text: I think it is a JS error. Because all others working fine. Except when i remove ` alert("${msg.description}");` it works fine.
score: 0
comment on: http://stackoverflow.com/q/22872994
type: Comment

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/22936660
tag name: session-timeout

http://stackoverflow.com/a/22870258
has comment: http://stackoverflow.com/comment/34895354
has comment: http://stackoverflow.com/comment/34895317
has comment: http://stackoverflow.com/comment/34903623
answers question: http://stackoverflow.com/q/22870027
has comment: http://stackoverflow.com/comment/34896205
score: 3
has comment: http://stackoverflow.com/comment/34894871
has comment: http://stackoverflow.com/comment/34895159
has comment: http://stackoverflow.com/comment/34895308
has comment: http://stackoverflow.com/comment/34895268
upvote count: 3
has comment: http://stackoverflow.com/comment/34896293
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34894413
has comment: http://stackoverflow.com/comment/34912313
has comment: http://stackoverflow.com/comment/34895713
has comment: http://stackoverflow.com/comment/34895079
type: Answer
has comment: http://stackoverflow.com/comment/34895818
has body: It looks like you're confusing client and server. Normally, server starts only once and binds to s port. Usually, there's no need to close there anything as the port gets freed when the program exits. Obviously, you must close the Sockets obtained by ServerSocket.accept(), but that's another story. I guess you've got confused by your variable names (just like it happened to me as I started with this). Try to call all things according to their type, here was Hungarian really helpful for me. The code I wrote for testing this is long, stupid, and boring. But it seems to work.
has comment: http://stackoverflow.com/comment/34896346
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22870027

http://stackoverflow.com/comment/34929246
type: QuestionComment
type: Comment
has text: @EJP I am reading a file into bytes and creating a packet of it. I want to add a sequence number to each packet. But I am not able to do that. Can you please guide me through the process of adding a seq number.
comment on: http://stackoverflow.com/q/22889264
score: 0

http://stackoverflow.com/q/22833088
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/28558337
possible better answer: http://stackoverflow.com/a/39647394
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/28558337
has body: Here is what I did: Installed Jadclipse plugin for Eclipse 4.* Ran Eclipse with -clean Set the editor for "Class without source" to "Class decompiler viewer" (there were no explicit jad decompiler or the like) Opened a .class file with "Class decompiler viewer" It still says that "Source not found" and I get the same old... What could have gone wrong? If you can point me to a wiki page or something that would be fine since the plugin's wiki is empty and googling for it did not help either.
tagged with: jad
has answer: http://stackoverflow.com/a/39647394
has title: Jadclipse is not working in Eclipse Kepler SR2
tagged with: eclipse-kepler

http://stackoverflow.com/a/22908743
has body: Try Eroding the image (experiment with size of kernel) and then Dilate back to recover. If the line/pixel noise(remaining noise or original) is very small, try median blur on it. It should work, if not, please share your result to work on further.
score: 0
answers question: http://stackoverflow.com/q/22898996
type: Answer
has comment: http://stackoverflow.com/comment/35029254

http://stackoverflow.com/a/22989668
has comment: http://stackoverflow.com/comment/35269827
upvote count: 5
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/51709601
answers question: http://stackoverflow.com/q/22959977
score: 5
has body: You could use the same machine to run multiples Hazelcast instance. Under the hoods, Hazelcast binds differents ports for each instance. Following, a simple test with two instances: HazelcastInstance firstInstance = Hazelcast.newHazelcastInstance(new Config()); HazelcastInstance secondInstance = Hazelcast.newHazelcastInstance(new Config()); // Introducing a sample data in a map using the first instance firstInstance.getMap("TEST_MAP").put("key", "test_value"); // Prints the value using the second instance. The result will be 'test_value' System.out.println(secondInstance.getMap("TEST_MAP").get("key")); When this code starts the console output is: Members [2] { Member [192.168.216.1]:5702 Member [192.168.216.1]:5703 this } As you can see, two instances were registered in the same IP but different ports.
has comment: http://stackoverflow.com/comment/72431514

http://stackoverflow.com/q/22911569
tagged with: swing
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22911790
type: Question
answer count: 2
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34968529
tagged with: timer
tagged with: imageicon
accepted answer: http://stackoverflow.com/a/22911790
linked to: http://stackoverflow.com/q/21247898
has comment: http://stackoverflow.com/comment/34968716
has answer: http://stackoverflow.com/a/22913242
has body: I am trying to shuffle image from my folder image which I am able to do. what I have to pass the name of image but I don't want pass the name of image I just want to give the name of folder and all image should from there how can I do this Here is my code public class main1 extends javax.swing.JFrame { private JLabel ecause = new JLabel(); private List&lt;BufferedImage&gt; list = new ArrayList&lt;BufferedImage&gt;(); private List&lt;BufferedImage&gt; shuffled; private JLabel label = new JLabel(); private int width = 700; private int height = 700; private Timer timer = new Timer(4000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { update(); } }); public main1() { this.getContentPane().setBackground(new java.awt.Color(153, 153, 0)); this.setUndecorated(true); ecause.setText(" eCause List"); ecause.setBounds(0, 1278, 496, 88); ecause.setFont(new java.awt.Font("Times New Roman", 1, 40)); ecause.setBackground(new java.awt.Color(255, 153, 0)); ecause.setOpaque(true); this.add(ecause); initComponents(); try { list.add(resizeImage(ImageIO.read(new File("images\\Picture2.png")))); list.add(resizeImage(ImageIO.read(new File("images\\Picture3.png")))); list.add(resizeImage(ImageIO.read(new File("images\\Picture4.png")))); list.add(resizeImage(ImageIO.read(new File("images\\Picture5.png")))); } catch (IOException e) { e.printStackTrace(); } shuffled = new ArrayList&lt;BufferedImage&gt;(list); Collections.shuffle(shuffled); timer.start(); } private BufferedImage resizeImage(BufferedImage originalImage) throws IOException { BufferedImage resizedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = resizedImage.createGraphics(); g.drawImage(originalImage, 0, 0, width, height, null); g.dispose(); return resizedImage; } private void update() { if (shuffled.isEmpty()) { shuffled = new ArrayList&lt;BufferedImage&gt;(list); Collections.shuffle(shuffled); } BufferedImage icon = shuffled.remove(0); jLabel3.setIcon(new ImageIc…
has comment: http://stackoverflow.com/comment/34968831
tagged with: jlabel
linked to: http://stackoverflow.com/q/7943584
upvote count: 2
possible better answer: http://stackoverflow.com/a/22913242
has title: How to retrieve image from project folder

http://stackoverflow.com/a/22992297
answers question: http://stackoverflow.com/q/22903448
has comment: http://stackoverflow.com/comment/121569503
type: Answer
score: 3
upvote count: 3
has body: There are a list of possible types in protobuf. BigDecimal/BigInteger are not. You can write your own conversion step tho. https://developers.google.com/protocol-buffers/docs/proto Yes, you need to travel and write mapping from/to java class and proto. It is a necessary step and everyone has to do unfortunately. I don't think there is an automated tool for that. Maybe you can write one and open-source it? :) I think, what you ask is complete one-to-one mapping from java class to protobuf message. Generally, such mapping is very hard to be done in automated fashion. Also, Google purposely limits protobuf as one serialization protocol, not ORM like hibernate and spring.
accepted answer of: http://stackoverflow.com/q/22903448
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34795144
score: 0
has text: Besides just writing package declaration won't make class available if it's not on the classpath.
comment on: http://stackoverflow.com/q/22815199
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34811924
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22820026
has text: I'm designing this in eclipse.
type: Comment

http://stackoverflow.com/comment/34888026
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22866925
has text: @MightyPork Do you mean you don't know what subset of your objects you want to log? Obviously not all classes need `toString` implementation, but not all of them need to be logged in console either.

http://stackoverflow.com/comment/34951130
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22899306
has text: You are correct. When calling a method inside a method, the innermost method will always be called first. And, in the case of recursion, that is also correct.

http://stackoverflow.com/comment/34957837
type: AnswerComment
score: 0
type: Comment
has text: yeah, thx. Don't want to change db structure, but it seems I'll have to.
comment on: http://stackoverflow.com/a/22880991

http://stackoverflow.com/comment/34975898
has text: I suppose you can, but I never tried to. You should have a try.
comment on: http://stackoverflow.com/a/22911513
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22817953
tagged with: android-alertdialog
downvote count: 0
tagged with: dialog
score: 1
linked to: http://stackoverflow.com/q/19489643
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/2115758
has body: I'm making my first android game, and I have the general things I wanted implemented with knowledge on making simple games in java and C#. For this I have the main class which extends Activity, then I have that create an object of a GameView class which extends SurfaceView, and setContentView to that class. Here's some of that code: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); gameView = new GameView(this); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(gameView); In my GameView class I have all the usual parts of a simple game, with a loop, and Sprite objects etc. This is all working great, until it comes to opening an AlertDialog to take text input from a user for saving the game. This is the part where i'm worried I've 'missed the point' of programming in android, because I've tried implementing solutions to this shown here: Android AlertDialog inside AsyncTask and here: How do I display an alert dialog on Android? and here: http://www.androidsnippets.com/prompt-user-input-with-an-alertdialog I get the error 'Can't create handler inside thread that has not called Looper.prepare()' the few times I've attempted these. I've gotten almost close to finishing this project and now I think I've missed fundamental android programming structure. The problem is I don't really know where I should be creating and showing the AlertDialog, should it be inside the main Activity, or the GameView SurfaceView. And if it is in the main activity, how do I exit out of the GameView back into the activity, and return some data for the next (view?) to use in an AlertDialog. I'm sorry if this seems too vague, its just since I've tried to create an AlertDialog, its thrown off my understanding and I feel like I'm missing something. So my question is, whats wrong with my structure, and more specifically, where do I put the AlertDialog; can I run it in some method or class that is called from my GameView class, or do I need to exit/end o…
upvote count: 1
has title: Can't create an AlertDialog in my programs structure
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22818051

http://stackoverflow.com/q/22914326
answer count: 1
tagged with: jsp
tagged with: tomcat
has title: Different resource files root for different environments in struts 2 & sitemesh
linked to: http://stackoverflow.com/q/3195871
accepted answer: http://stackoverflow.com/a/22914530
has body: I am quite new to Struts 2 and Sitemesh. I am a frontend developer and need to change a lot CSS and JS files. What I want is a method in which I don't have to redeploy the entire project for every char I change in JS and CSS files. What I thought would be useful is to create a vhost in apache whith the root forwarding to struts resources folders (Tomcat is working on 8080 and apache on 80). In decorator file I defined a variable which I will change when I need to deploy. In work mode will be something like: &lt;s:set var="resourceRoot"&gt;http://resource-folder.localhost&lt;/s:set&gt; For a CSS link I thought will be nice to have something like: &lt;link rel="stylesheet" href="&lt;s:url value='${resourceRoot}/resources/css/styles.css' /&gt;" rel="stylesheet" /&gt; But, when I try to deploy tomcat will deliver the following message: org.apache.jasper.JasperException: /WEB-INF/decorators/default.jsp (line: 20, column: 20) According to TLD or attribute directive in tag file, attribute value does not accept any expressions What would be a best practice for what I intend here? Thanks in advance!
tagged with: css
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22914530
tagged with: struts2
score: 0

http://stackoverflow.com/comment/34901107
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22873521
has text: I updated my question and added some code.

http://stackoverflow.com/comment/34815208
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22826360
type: Comment
has text: In the code you have shown, nothing ever sets `userGuessArray` or `secretNumber` - thus they default to null.

security
tags question: http://stackoverflow.com/q/22895941
tags question: http://stackoverflow.com/q/22919265
tags question: http://stackoverflow.com/q/22816422
tags question: http://stackoverflow.com/q/22900570
tags question: http://stackoverflow.com/q/22858497
tags question: http://stackoverflow.com/q/22870278
tags question: http://stackoverflow.com/q/22879367
tags question: http://stackoverflow.com/q/22893607
tags question: http://stackoverflow.com/q/22888436
tags question: http://stackoverflow.com/q/22905541
tags question: http://stackoverflow.com/q/22901862
type: Tag
tags question: http://stackoverflow.com/q/22831587
tags question: http://stackoverflow.com/q/22945406
tag name: security

http://stackoverflow.com/q/22876120
has body: I'm creating a utility function that returns a Method object given all its pieces. Its parameters: return type (Class&lt;?&gt;) containing class (Class&lt;?&gt;[]) function name (String) parameter-class array (Class&lt;?&gt;[]) Notice the containing-class parameter is an array. Exactly one of those classes must contain the method, but you can't know which one. It's a way for default classes to be specified, in addition to the one that may be explicitly specified. My goal is to search each class in this array, in order, and if it contains that method, return its Method object. I would like to do this without having to try-catch for NoSuchMethodException (as described in this question). Since the method may be private, using Class.getMethods() is not possible. (It also allows for private static, but I'm not sure that if that affects this question.) How do you search for a private method in this way? How do you make a "does function exist in class" test, without having to use a NoSuchMethodException as the "false" logic? More information: https://www.google.com/search?q=class+contains+method+java
answer count: 2
has comment: http://stackoverflow.com/comment/34921789
has title: How to test if a private static function exists in a class, without having to catch a NoSuchMethodException?
accepted answer: http://stackoverflow.com/a/22876271
has comment: http://stackoverflow.com/comment/34918703
possible better answer: http://stackoverflow.com/a/22876613
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7058621
tagged with: reflection
has answer: http://stackoverflow.com/a/22876613
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34905810
linked to: http://stackoverflow.com/q/22764175
has comment: http://stackoverflow.com/comment/34914708
has comment: http://stackoverflow.com/comment/34921813
has answer: http://stackoverflow.com/a/22876271

http://stackoverflow.com/q/22870898
tagged with: batch-file
has answer: http://stackoverflow.com/a/22871305
has comment: http://stackoverflow.com/comment/34897102
upvote count: 1
type: AnsweredQuestion
tagged with: c#
accepted answer: http://stackoverflow.com/a/22871305
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34895526
type: Question
has comment: http://stackoverflow.com/comment/34895477
answer count: 1
has body: I have a Java .jar application that is ran from a .bat file to have arguments passed to the Java application. The application opens a console (cmd.exe to be exact), writes things to it regularly and accepts some commands. I'm trying to create a kind-of wrapper around it in C# Winforms to ease it's use. How can I run the .jar with the same arguments as are in the .bat file, capture realtime output and write execute commands?
downvote count: 0
linked to: http://stackoverflow.com/q/3774432
has title: How can I open an external Java console application with arguments, capture output and execute commands on it?
favorite count: 0
tagged with: winforms

http://stackoverflow.com/comment/34932667
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22891163
type: AnswerComment
has text: My Mistake. the InputNode output() method needs to be used to display the value in it if there is no toString().. Also please check if there are values in InputNode when you are trying to print them.

http://stackoverflow.com/comment/34831035
has text: Good explanation, thanks. And exactly the way I intuitively expected it to work, just I couldn't really find confirmation of it. :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22831440
type: Comment

http://stackoverflow.com/comment/38453617
score: 0
has text: i am goint to create new user using above code but its giving error in createAccount. And one more thing when i m going to create account then before it how can i connection.login?
type: Comment
comment on: http://stackoverflow.com/a/22864321
type: AnswerComment

http://stackoverflow.com/q/22884116
has answer: http://stackoverflow.com/a/22884149
accepted answer: http://stackoverflow.com/a/22884149
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has body: Can someone tell me how to properly define an array of hashtables in java? The purpose that I need this for is I have 6 nodes, and each node can have a number of links where a link consists of a linkid(int) and value(int). If anyone has any suggestions, I would appreciate it. Each node can have multiple links. I have been using an arraylist of hashtables before but when compiled it, a warning appears that my java file uses unchecked or unsafe operations, to recompile with -Xlint. When I recompiled the program, it appears that Java does not like an arraylist of hashtables... My code was like this: ArrayList&lt;Hashtable&lt;Integer,Integer&gt;&gt; DB_entry; DB_entry = new ArrayList&lt;Hashtable&lt;Integer,Integer&gt;&gt;(); for (int i = 0; i &lt; 6; i++) { Hashtable temp = new Hashtable(); DB_entry.add(temp); }
has answer: http://stackoverflow.com/a/22884141
favorite count: 0
has answer: http://stackoverflow.com/a/22884152
has title: Setting up an array of hashtables in Java
linked to: http://stackoverflow.com/q/40471
possible better answer: http://stackoverflow.com/a/22884141
tagged with: hashtable
has answer: http://stackoverflow.com/a/22884793
answer count: 4

http://stackoverflow.com/comment/40304106
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22850550
has text: @Boann To something like [this](http://types.cs.washington.edu/checker-framework/current/checker-framework-manual.html#units-checker).

http://stackoverflow.com/q/22829125
has title: how to restrict the 2 same jars are loaded with diffrent versions
favorite count: 0
has body: I am using Apache Maven to building the project.. Problem is some jars are added two times with the different versions. httpclient-4.0.3 httpclient-4.3.3 httpcore-4.0.1 httpcore-4.3.2 jackson-core-asl-1.6.7 jackson-core-asl-1.9.13 i want the higher version of jars
has answer: http://stackoverflow.com/a/22830753
tagged with: maven-plugin
tagged with: maven
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22830753
tagged with: java
tagged with: maven-assembly-plugin
score: -1
type: Question
upvote count: 0
tagged with: apache
answer count: 1

http://stackoverflow.com/q/22959226
type: Question
has comment: http://stackoverflow.com/comment/35054094
tagged with: java
has comment: http://stackoverflow.com/comment/35060405
has body: I have a list of categories like Sports,Game,Religion,Finance,Market Rates,I.T,Health,Adult,Business,B2B, government, politics, education etc.. now I want to categorise a text paragraph into these categories, actually I extract whole text from a particular URL and want to categorize text into my categories, at this time I'm using dbpedia,also I have used many technologies, but unfortunately I'm still not reaching to my aim, can someone help me please...I shall be grateful.
answer count: 1
has comment: http://stackoverflow.com/comment/35056492
favorite count: 0
tagged with: dbpedia
has comment: http://stackoverflow.com/comment/35055291
downvote count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/22959835
tagged with: linked-list
has comment: http://stackoverflow.com/comment/35055651
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35057435
has title: How to categorize a text paragraph into predefined categories?
score: -4
tagged with: gate

http://stackoverflow.com/comment/34883116
type: Comment
has text: Well, now you'll need to debug your code. A basic way is to print out the variables every once in a while. You can then see where you're not getting the values you're expecting.
comment on: http://stackoverflow.com/a/22863741
score: 0
type: AnswerComment

http://stackoverflow.com/a/22960967
score: 3
accepted answer of: http://stackoverflow.com/q/22960806
answers question: http://stackoverflow.com/q/22960806
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Ok to start extend your own view like this one: I do have a Button made with an ImageView and a TextView in a LinearLayout designed in xml: XML &lt;merge xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ImageView android:id="@+id/ivImage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="3dp" android:adjustViewBounds="true" android:padding="3dp" android:scaleType="fitStart" /&gt; &lt;TextView android:id="@+id/tvText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="2dp" android:layout_marginLeft="10dp" android:ellipsize="end" android:singleLine="true" android:textColor="@android:color/white" /&gt; &lt;/merge&gt; ViewObject called ViewMenuButton public class ViewMenuButton extends View{ private TextView tvText; private ImageView ivImage; public ViewMenuButton(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } public ViewMenuButton(Context context, AttributeSet attrs) { super(context, attrs); init(); } public ViewMenuButton(Context context) { super(context); init(); } private void init() { LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); //here you can inflate a own XML for that View inflater.inflate(R.layout.view_menubutton, this, true); this.tvText= (TextView)this.findViewById(R.id.tvText); this.ivImage = (ImageView)this.findViewById(R.id.ivImage); } public void setText(String text){ if(this.tvText != null){ tvText.setText(text); } } //... and so on } Whenever you want to use it in your xml make sure to give the View the complete package like this: Usage XML &lt;com.your.package.views.ViewMenuButton android:id="@+id/menu_bt_local" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_marginTop="15dp" android:layout_weight="1" android:background="@drawable/acti…
upvote count: 3

http://stackoverflow.com/a/22885536
has comment: http://stackoverflow.com/comment/34922345
has comment: http://stackoverflow.com/comment/34922274
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22885387
answers question: http://stackoverflow.com/q/22885387
type: Answer
has comment: http://stackoverflow.com/comment/34922324
has body: If your code has to tackle data with different sizes, then using a fixed-size array is not the right answer. However, you can ask Java to figure out the number of columns for you. List&lt;int[]&gt; dataSet = new ArrayList&lt;int[]&gt;(); while (inFile.hasNextLine()){ String line = inFile.nextLine(); String[] cols = line.split(","); int[] row = new int[cols.length]; for (int i = 0; i &lt; cols.length; i++) if (!cols[i].equals("?")) row[i] = Integer.parseInt(cols[i]); else row[i] = 0; dataSet.add(row); }
score: 2
downvote count: 0

http://stackoverflow.com/comment/34879772
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22860812
has text: @gstackoverflow I've added an answer below. I've assumed you are using the built-in Maven support in Eclipse, is that the case?
score: 0

http://stackoverflow.com/a/22875132
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34904046
score: 1
has comment: http://stackoverflow.com/comment/34903941
type: Answer
upvote count: 1
has body: Just create a singleton public class Main extends Activity{ public static Main instance; public static String thestring; public class MyAsyncTask extends AsyncTask&lt;Void,String,String&gt;{ static final String result = "text"; Context context; public MyAsyncTask(Context m) { this.context = m; } @Override protected String doInBackground(Void... noArgs) { return result; } protected void onPostExecute(String result) { super.onPostExecute(result); } public String getStr() { return result; } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText et = (EditText)findViewById(R.id.editText1); Button btn = (Button)findViewById(R.id.button1); MyAsyncTask task = new MyAsyncTask(this); task.execute(); thestring = task.getStr(); instance = this; final Test t = new Test(); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { et.append(t.modifiedString()); } }); } public String pulledFromAsyncTask() { return thestring; } public static Main getInstance(){ return instance; } } and then in the another class public class Test{ public String modifiedString() { Main main = Main.getInstance(); //so with main.something.. you can call the methods you want //a good solution is to make a singleton class only for MyAsyncTask setting the //functions get/set so you can take the values from other classes return "modified " + main.pulledFromAsyncTask() + "\n"; } }
answers question: http://stackoverflow.com/q/22874977
accepted answer of: http://stackoverflow.com/q/22874977
has comment: http://stackoverflow.com/comment/34934632

http://stackoverflow.com/q/22898822
has answer: http://stackoverflow.com/a/22899140
type: AnsweredQuestion
score: 2
has body: I am trying to write a regex that do the following: Removing punctuation, non-Arabic words and digits except dots and commas. I would like to have two separated regex to do the following in java: Removing punctuation and digits except dots and commas. Removing non-Arabic words except dots and commas. Note that I know the following, but I couldn't exclude dots and commas from the regx to not be matched: "[\\p{P}\\p{Digit}]" --> for removing digits and punctuation regex "[^\\p{InArabic}]+" --> for removing non Arabic letters regex Example: العمر (age): هو الشيء الوحيد الذي كلما زاد نقص. After performing the two regex, we should get the following: العمر هو الشيء الوحيد الذي كلما زاد نقص. Any help will be appreciated because I tried many possibilities, but all of them didn't work.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34946178
has answer: http://stackoverflow.com/a/22898867
answer count: 2
downvote count: 0
has title: Removing punctuation, non-Arabic words and digits except dots and commas
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/22898867
has comment: http://stackoverflow.com/comment/34946955
possible better answer: http://stackoverflow.com/a/22899140
tagged with: regex
has comment: http://stackoverflow.com/comment/34947150

http://stackoverflow.com/comment/34870788
comment on: http://stackoverflow.com/a/22857062
type: AnswerComment
has text: The OP is interested in storing the data to a database - that doesn't require a text conversion at all. The question is unclear, basically - it's not obvious whether the OP doesn't want to *store* milliseconds or doesn't want to *render* them.
type: Comment
score: 3

http://stackoverflow.com/comment/35044943
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22953760
type: QuestionComment
has text: Please check http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html?page=2. Article is old, but captures essentials of waitFor and stream munching.

http://stackoverflow.com/comment/35028176
has text: `Population` (the class) has the protected variable `population` (see the edit above). And if it is not erasure, is there something else that I can look for?
score: 0
comment on: http://stackoverflow.com/q/22944057
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22934621
score: 4
favorite count: 0
tagged with: smartcard
has answer: http://stackoverflow.com/a/22940517
has title: Mark Javacard applet as implicit selectable (default applet) after install
has comment: http://stackoverflow.com/comment/35020525
has comment: http://stackoverflow.com/comment/35017615
type: AnsweredQuestion
tagged with: javacard
tagged with: jcop
tagged with: globalplatform
tagged with: java
accepted answer: http://stackoverflow.com/a/22940517
has body: I'm looking for a way to mark an applet as the implicit selectable/"selected by default" applet after it already has been uploaded and installed on a Global Platform/JCOP 2.4.2 R1 system (for starters in the NXP JCOP Tools Java Card Simulation). The applet has been installed without the -d parameter in the JCOP shell: cm&gt; install -i a000100201100001 -q C9#() a000100201100000 a000100201100001 =&gt; 80 E6 [...] 90 00 after that the state is Card Manager AID : A000000003000000 Card Manager state : OP_READY Application: SELECTABLE (--------) A000100201100001 Load File : LOADED (--------) A0000000035350 (Security Domain) Module : A000000003535041 Load File : LOADED (--------) A000100201100000 Module : A000100201100001 The desired result is Card Manager AID : A000000003000000 Card Manager state : OP_READY Application: SELECTABLE (-----D--) A000100201100001 Load File : LOADED (--------) A0000000035350 [...] That's the output when the applet is installed with the -d|--default parameter. I suspect changing this attribute is somehow done via the STORE-DATA command in the card manager applet but haven't been able to find the exact, detailed command (structure) - not even the tag that needs to be modified.
type: Question
upvote count: 4
answer count: 1
downvote count: 0

http://stackoverflow.com/a/22950777
has comment: http://stackoverflow.com/comment/35039855
score: 8
has body: You are confusing the term "property" with "instance variable". A property is that which you can set and/or get from outside the class. In Java, a property is created by having a private instance variable used through accessor methods (setter and/or getter). In JavaBeans, you can have private instance variables without a getter or a setter, but that makes it just an instance variable, not a property.
upvote count: 8
answers question: http://stackoverflow.com/q/22950725
type: Answer
has comment: http://stackoverflow.com/comment/35039894
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22950725

http://stackoverflow.com/q/22901666
type: Question
has comment: http://stackoverflow.com/comment/34951316
tagged with: java
has body: Below code will print the length of byte store to below String which contain double byte Japanese character. Per my understanding, output of this program should be 2, however it is coming as 3. Why it this the case? String j = "大"; System.out.println(j.getBytes().length); If this will be always the case, then should I assume below: 1, for single byte character, output of program will be always 1 2, for double byte character, output of program will be always 3
has comment: http://stackoverflow.com/comment/34951290
has answer: http://stackoverflow.com/a/22901707
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22901707
answer count: 3
has comment: http://stackoverflow.com/comment/34951222
score: 2
type: AnsweredQuestion
upvote count: 2
possible better answer: http://stackoverflow.com/a/22901769
has answer: http://stackoverflow.com/a/22901819
has answer: http://stackoverflow.com/a/22901769
tagged with: unicode-string
has title: Double byte character in Java

http://stackoverflow.com/q/22890086
score: 0
has answer: http://stackoverflow.com/a/22895259
accepted answer: http://stackoverflow.com/a/22895259
has comment: http://stackoverflow.com/comment/34931625
answer count: 1
tagged with: jms
has comment: http://stackoverflow.com/comment/34931880
has comment: http://stackoverflow.com/comment/34930639
has body: My JMS consumer produces any number of messages on a JMS queue during the day. As soon as a message arrives it goes to message listener. If in between I need some other message comes, it goes to another message listener does not wait for first one? As per my understanding here I need to create two consumer(assume i want to process 2 message concurrently) each having its own session. Both consumer can use the same message listener. Right? I am not sure if I can achieve it with single consumer but can I with multiple listeners? something like this Single queue: concurrent message processing with multiple consumers
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34930965
linked to: http://stackoverflow.com/q/17078801
has title: How to concurrently process the asynchronous jms queue message?

http://stackoverflow.com/q/22941822
score: 0
linked to: http://stackoverflow.com/q/9521729
has comment: http://stackoverflow.com/comment/35024173
has comment: http://stackoverflow.com/comment/35024085
has comment: http://stackoverflow.com/comment/35024228
has comment: http://stackoverflow.com/comment/35024038
tagged with: key-value
has comment: http://stackoverflow.com/comment/35024268
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35025459
has body: I have to two lists, one named keys for example {a,b,c,d} and the other one named values for example {e,f,g,h}, for simplicity I've written just elements [a-d] and [e-h] but in practice the lists can be of any length altough always the two lists will have the same amount of items.(for example keys {a...z} values {0...25}) List&lt;Character&gt; keys = new ArrayList&lt;Character&gt;(); keys.add('a'); keys.add('b'); keys.add('c'); keys.add('d'); List&lt;Character&gt; values = new ArrayList&lt;Character&gt;(); values.add('e'); values.add('f'); values.add('g'); values.add('h'); I need to create hashMaps objects one by one containig exactly one combination of all the keys and all the values, so for example: one hashMap would be HashMap&lt;Character,Character&gt; keys_values = new HashMap&lt;Character,Character&gt;(); keys_values.put(keys.get('a'), values.get('e')); keys_values.put(keys.get('b'), values.get('f')); keys_values.put(keys.get('c'), values.get('g')); keys_values.put(keys.get('d'), values.get('h')); Then in a different hashMap I need to store a different combination for example: keys_values.put(keys.get('a'), values.get('h')); keys_values.put(keys.get('b'), values.get('e')); keys_values.put(keys.get('c'), values.get('f')); keys_values.put(keys.get('d'), values.get('g')); And so on.. so for this example of 4 items there should be 4! different hashMaps (I think!) , and each of them with one combination of the elements. I've thought about doing two nested for loops, but this doesnt give me the results that I'm looking for, because I get several objects with the same key inside the same hashmap.
has comment: http://stackoverflow.com/comment/35024147
has comment: http://stackoverflow.com/comment/35024470
answer count: 0
tagged with: java
tagged with: set
has title: Java - Combinations of two different sets
has comment: http://stackoverflow.com/comment/35024017
type: Question
tagged with: combinations
has comment: http://stackoverflow.com/comment/35023848

http://stackoverflow.com/comment/34818893
type: Comment
type: QuestionComment
has text: are you really getting data ?? i mean values into the string data ?
comment on: http://stackoverflow.com/q/22828373
score: 0

http://stackoverflow.com/a/22944882
type: Answer
answers question: http://stackoverflow.com/q/22944020
has body: You can get rid of the multiple replace using a map if this is what you meant by optimizing the code: void doStuff(String template) { Map&lt;String,String&gt; vars = new HashMap&lt;String, String&gt;(); vars.put("###menu1Link###",tbMenu1Link.getText()); vars.put("###menu1Title###",tbMenu1Title.getText()); vars.put("###content###",epContent.getText()); //... String templateWithData = insertData(template, vars); } String insertData (String template, Map&lt;String, String&gt; vars){ for (String key : vars.keySet()) { template = template.replace(key, vars.get(key)); } return template ; } Is this what you are looking for or you want to optimize the memory usage?
score: 0

http://stackoverflow.com/q/22909964
has answer: http://stackoverflow.com/a/22910710
tagged with: replace
score: 0
has comment: http://stackoverflow.com/comment/34966462
answer count: 1
tagged with: string
has title: avoid using a word for a second time in a search string
accepted answer: http://stackoverflow.com/a/22910710
has comment: http://stackoverflow.com/comment/34966615
has body: I am trying to check java string, against a glossary list and if it finds a term which exist in the glossary list then, wrap the term with a html tag. I have already sorted the glossary from Longer to shorter to avoid the problem if finding the shorter term first then it can't find the longer term.here. However, the problem is that now that if find all the terms, it cant avoid the second tag wrapping for the similar terms. for example if I have two terms : "Sprint" and "Sprint0" the result will be something like this: Sprint 0 is typically a one or two week period at the end of the Define phase. In summary, Sprint 0 provides an opportunity for the team to: Here is the code: private String findGlossaryTerms(String response, List<Glossary> glossary) { for (Glossary item : glossary) { // check if response contains the term if (StringUtils.contains(response, item.getTerm())) { System.out.println(item.getTerm()); response = StringUtils.replace(response, item.getTerm(), "" + item.getTerm() + ""); } } System.out.println(response); System.out.println("_____________________________"); return response; } How can I avoid this???
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34965676
linked to: http://stackoverflow.com/q/22866011
type: Question

http://stackoverflow.com/q/22831382
score: 0
has comment: http://stackoverflow.com/comment/34824208
answer count: 1
has comment: http://stackoverflow.com/comment/34864956
has body: I have a problem with my problem. I am currently playing around with KeyListener in a Java applet, the problem is nothing happens when I type a key(No display). Here's the code : package appl; import java.applet.Applet; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class Appl extends Applet implements KeyListener { @Override public void keyTyped(KeyEvent ke) { System.out.println("Pressed: " + ke.getKeyCode()); } @Override public void keyPressed(KeyEvent ke) { System.out.println("Pressed: " + ke.getKeyChar()); } @Override public void keyReleased(KeyEvent ke) { System.out.println("Pressed: " + ke.getKeyChar()); } /* public static void main(String[] args) { } */ }
has comment: http://stackoverflow.com/comment/34824099
linked to: http://stackoverflow.com/q/6255106
type: AnsweredQuestion
tagged with: java
has title: Java Applet with Keylistener not working
tagged with: keylistener
has answer: http://stackoverflow.com/a/22831472
accepted answer: http://stackoverflow.com/a/22831472
type: Question
tagged with: applet
has comment: http://stackoverflow.com/comment/34824129

http://stackoverflow.com/comment/34981364
has text: "And don't forget that the above operations will have to be done only once for any String, once it is intern()ed the result is returned from first comparison." I might have missed something, let's assume that we have str1.intern() and then str1.intern() again. I thought that the first line would put the string to the pool (making all the steps) and then the second line would do the same steps (finding a bucket, comparing the String with others in the bucket) to find this String in the pool and to return it. As far as I remmember this is what I saw in C++ code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22917444
type: AnswerComment

http://stackoverflow.com/q/22900354
score: 6
has comment: http://stackoverflow.com/comment/35463581
has comment: http://stackoverflow.com/comment/61095730
upvote count: 7
downvote count: 1
has body: I am working on an android app with an email feature. I want my users to be able to compose and send emails while in airplane mode. For that I need some sort of queue that can check if there is network and send, etc. I image this must have been done 100s of times. But I am not really sure why my searches aren't turning up much. Does anyone know of a library or git project that I can use to accomplish this? If not, does anyone know how to accomplish this? I believe it is called the Queue and send pattern. Update I am starting a bounty on this question. What I hope for is a working example that does not use SMS. For my particular case I am working on an Appengine Connected Android Project. The client needs to send data (String, Bitmap, etc under a particular POJO say Dog) to the server. I want to be able to queue up these data somehow. I can use Gson to save data to file, etc. The bottom line is that I need to be able to check for network. When there is network I dequeue my queue into the server. If there is no network, I keep saving into the queue. My queue can be Queue&lt;Dog&gt;, where Dog is my class with fields such as Bitmap (or path to image), String, long, etc. I am looking for a working example. It can be very simple, but the example must work. A git zip would be great. I am giving up close to half of my points for this question. class Dog{ String dogname; String pathToImage; int dogAge; //etc. } //Design pattern for sending Dog to server 0) Unmarshall queue from file using Gson 1) Add dog to queue 2) If there is network, loop through queue and send data to server 3) if there is no network save queue to file //Ideally, as soon as there is network, the method should be able to detect so and run to send data to server
type: Question
has answer: http://stackoverflow.com/a/23075399
tagged with: network-programming
has comment: http://stackoverflow.com/comment/35218608
tagged with: java
has comment: http://stackoverflow.com/comment/35217584
has comment: http://stackoverflow.com/comment/35537143
tagged with: client-server
has comment: http://stackoverflow.com/comment/35223614
answer count: 1
accepted answer: http://stackoverflow.com/a/23075399
favorite count: 0
has comment: http://stackoverflow.com/comment/35251251
has title: How to queue up data for server dispatch on android
tagged with: android
has comment: http://stackoverflow.com/comment/35393751
type: AnsweredQuestion

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/22866426
tags question: http://stackoverflow.com/q/22897968
tags question: http://stackoverflow.com/q/22815091
type: Tag
tags question: http://stackoverflow.com/q/22896401
tags question: http://stackoverflow.com/q/22850087

http://stackoverflow.com/comment/35068725
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22967051
has text: Have you checked which of those is the `null` value? It could be `selectedMenu`,`menuName`,`selectedMenu.getMenuName()`, Maybe try printing the three of them out to give you a pointer in the right direction (instead of a null pointer hardy har)
score: 0

http://stackoverflow.com/q/22919844
score: -1
has answer: http://stackoverflow.com/a/22919858
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22919864
accepted answer: http://stackoverflow.com/a/22919858
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22920048
has answer: http://stackoverflow.com/a/22920048
has title: Array exercise with loop
tagged with: java
has body: I have to store even numbers using array until 20, but when I run, just show me the number 0 I would appreciate some help. int num[] = new int[20]; for(int i = 0; i &lt;=10; i++){ System.out.println(i); if(i%2 == 0){ System.out.println("even number " +num[i]); } }
has comment: http://stackoverflow.com/comment/34983862
tagged with: loops
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34983791
upvote count: 0
tagged with: arrays

http://stackoverflow.com/q/22954567
tagged with: junit
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22954648
score: 2
type: AnsweredQuestion
upvote count: 2
has body: I'm writing tests for some data fetcher, which gets information from some URL and parses it with JSOUP. One of the methods: public Map&lt;String, String&gt; getDepartments() { Map&lt;String, String&gt; result = new HashMap&lt;&gt;(); Document doc = null; try { doc = Jsoup.connect(globalScheduleURL).get(); } catch (IOException e) { e.printStackTrace(); } Elements links = doc.select("a[href]"); ... } where globalScheduleURL is a String, usually formatted as http://universitysite.edu/.... For testing purposes I made a mock copy of needed pages and saved it under ./src/test/resources. How can I access to local files, so the address starts with file:/? When I tried to do something like this: @Before public void initializeDataFetcher() throws MalformedURLException { df = new SSUDataFetcher(); File file = new File("./src/test/resources/departments.html"); URL fileURL = file.toURI().toURL(); System.out.println(fileURL); df.setGlobalURL(fileURL.toString()); } I get: file:.../src/test/resources/departments.html java.net.MalformedURLException: Only http &amp; https protocols supported Is there any workaround to avoid this exception in JSoup or some URL formatting in Java? `
possible better answer: http://stackoverflow.com/a/26330703
tagged with: java
has answer: http://stackoverflow.com/a/26330703
has title: URL unit testing in Java
tagged with: unit-testing
type: Question
tagged with: jsoup
has answer: http://stackoverflow.com/a/22954648
has answer: http://stackoverflow.com/a/22954637
answer count: 3

nexus
type: Tag
tags question: http://stackoverflow.com/q/22934383
tag name: nexus

http://stackoverflow.com/q/22888271
has title: Java String Explanation needed
type: Question
has comment: http://stackoverflow.com/comment/34927223
answer count: 2
score: -2
has comment: http://stackoverflow.com/comment/34926998
has comment: http://stackoverflow.com/comment/34926973
has answer: http://stackoverflow.com/a/22888297
has answer: http://stackoverflow.com/a/22888299
possible better answer: http://stackoverflow.com/a/22888297
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/34926974
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22888299
tagged with: java
has body: Hey can someone please explain this coding line by line? public boolean twoE(String str) { int count = 0; for (int i=0; i&lt;str.length(); i++) { if (str.charAt(i) == 'e') count++; } if (count == 2){ return true; } return false; // this last if/else can be written simply as "return (count == 2);" }
downvote count: 3

http://stackoverflow.com/comment/34826264
type: QuestionComment
comment on: http://stackoverflow.com/q/22832042
has text: @user3492773 Log.d the value of getCurrentFocus();
type: Comment
score: 0

http://stackoverflow.com/q/22844108
has answer: http://stackoverflow.com/a/22844485
upvote count: 0
has comment: http://stackoverflow.com/comment/34847176
tagged with: states
has comment: http://stackoverflow.com/comment/34847002
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22844485
score: -1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34847245
accepted answer: http://stackoverflow.com/a/22844468
downvote count: 1
tagged with: arrays
has body: here are my requirements: Create (hard coded) the 50 states and their capital cities, using a 2 dimension array. In the dialog box: ask the user either to enter the State or a City. If the state is entered, find its capital city. If a city is entered, find its State. If not, found, issue an error message. This should be in a Loop, until the user does not want to play anymore. I really don't know where to start, all I have done so far is create the array, I don't really get how to search the array, and spit out the corresponding state/capital. Any help would be greatly appreciated. Here is the code I have written so far. import java.util.Scanner; public class GuessStates { public static void main(String[] args){ java.util.Scanner input = new java.util.Scanner(System.in); String[][] statesAndCapitols = { {"Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"}, {"Montgomery","Juneau","Phoenix","Little Rock","Sacramento","Denver","Hartford","Dover","Tallahassee","Atlanta","Honolulu","Boise","Springfield","Indianapolis","Des Moines","Topeka","Frankfort","Baton Rouge","Augusta","Annapolis","Boston","Lansing","St. Paul","Jackson","Jefferson City","Helena","Lincoln","Carson City","Concord","Trenton","Santa Fe","Albany","Raleigh","Bismarck","Columbus","Oklahoma City","Salem","Harrisburg","Providence","Columbia","Pierre","Nashville","Austin","Salt Lake City","Montpelier","Richmond","Olympia","Charleston","Madison","Cheyenne"}}; System.out.println("Please enter a State…
has comment: http://stackoverflow.com/comment/34846762
has title: states and capitals 2d array, java
favorite count: 0
has comment: http://stackoverflow.com/comment/34847288
has comment: http://stackoverflow.com/comment/34847493
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/22844468

http://stackoverflow.com/q/22879842
tagged with: sql-server-2008
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22881052
accepted answer: http://stackoverflow.com/a/22881052
type: Question
tagged with: jar
has body: I have developed a Java project that uses an SQL Server 2008 Database. Now if I want to deliver this Java application to any person such as client that will practically implement my Java application into his/her use, how will I deliver the database that is used to store the data used by the application? i-e I need to deliver the database with jar file.
score: 0
answer count: 1
has title: Delivering a Java application with SQL Server 2008 database

http://stackoverflow.com/comment/34937709
type: Comment
type: QuestionComment
score: 0
has text: Spring, by default, sets the `hibernate.current_session_context_class` to the Spring class. If you have a persistence.xml file please post it. Basically your configuration should work. Also be aware that `session.load` doesn't do much it only constructs a proxy, whereas `session.get` actually retrieves the element from the database!.
comment on: http://stackoverflow.com/q/22892744

http://stackoverflow.com/q/22824051
tagged with: java
tagged with: stream
answer count: 0
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7113007
has body: I'm trying to write a little application that would automate the use of an external application which is cisco any connect mobility client. It provides a command line tools that you can use to connect to your VPN. I want to run this command line tools from my java application using apache commons-exec library and be able to read his output to send needed information. I already searched on the net to find "how to communicate" with an external application but the only post I found was this article : Trouble providing multiple input to a Command using Apache Commons Exec and extracting output where it just says "hey I found the solutions", but I don't understand how he did it. When I start the process, I run a function that read the input like this : Thread T = new Thread() { public void run() { String line; try { line = processOutput.readLine(); while (line != null) { System.out.println(line); if(line.contains("VPN-Password")){ sendMessage(processInput, "1"); } if(line.contains("Please enter your username and password")){ sendMessage(processInput, "username"); } line = processOutput.readLine(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; T.start(); the function send message just run a thread to write in the process inputstream then flush it. Thread T = new Thread() { public void run() { try { os.write((message+"\n").getBytes()); os.flush(); System.out.println("SENT : "+message); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; T.start(); As you can see I check the output to send a message to the process depending on it (basicly to answer questions). However, when it comes to the "Please enter...", I got this exception java.io.IOException: Read end dead My issue is that I can't find how to "communicate" with the process by reading his output and sending it messages depending on what it tells me. Can you help me ? Thanks for reading.
score: 1
favorite count: 0
tagged with: command-line
type: Question
tagged with: apache-commons-exec
tagged with: process
has title: Trouble sending multiple values to an external process with apache commons-exec
upvote count: 1

http://stackoverflow.com/comment/34954977
type: AnswerComment
comment on: http://stackoverflow.com/a/22903345
type: Comment
has text: @user3079252 That would be my guess
score: 0

http://stackoverflow.com/comment/34989702
comment on: http://stackoverflow.com/q/22922751
type: Comment
type: QuestionComment
score: 0
has text: Are those initial variables fields?

http://stackoverflow.com/comment/35358800
type: Comment
comment on: http://stackoverflow.com/a/23013020
score: 0
type: AnswerComment
has text: @Mishax I've just cited the specifications. I agree that there is no direct references from one to another in the context of this question. But to my mind the meaning of the description of `RetentionPolicy` values and annotation attributes in `ClassFile` structure is clear, and relationship between them are quite obvious. If you need evidences that specific JVM implementation complies with the specifications I'm afraid there is no way other than analysing of the source code of that implementation or writing tests.

http://stackoverflow.com/a/22875212
has comment: http://stackoverflow.com/comment/47332711
score: 6
has comment: http://stackoverflow.com/comment/34959906
upvote count: 6
answers question: http://stackoverflow.com/q/22874910
has comment: http://stackoverflow.com/comment/34908267
has comment: http://stackoverflow.com/comment/34908094
accepted answer of: http://stackoverflow.com/q/22874910
has comment: http://stackoverflow.com/comment/34910392
has body: I would try running the following dependency as separate bundle: javax.enterprise cdi-api 1.1-20130918 (Maven Central link) Be careful, you need version 1.1-20130918. Version 1.1 does not have OSGi headers in the MANIFEST.MF. You can unzip the jar and check the META-INF/MANIFEST.MF file for OSGi headers like Bundle-ManifestVersion and Bundle-SymbolicName. You can also check here the required packages of that bundle, it's in the Import-Packages header. How to figure out Check the dependencies of weld-osgi-bundle on Maven Central (or in its pom.xml). It contains the following: org.jboss.weld weld-api This weld-api refers to the cdi-api above which contains the missing annotation: javax.enterprise cdi-api Another way is pressing F3 (Open Declaration) in Eclipse while the cursor in the ApplicationScoped annotation then in the Project Explorer View enable the Link with Editor and it will show that ApplicationScoped.class is inside the cdi-api-1.1.jar. Finding OSGi version of another jars You probably need more bundles than this one (transitive dependencies or it was only the first one which stopped the installation). Not all well-known jar has OSGi headers, like the following one: javax.inject javax.inject 1 In that case search for the group id on Maven Central. Two results which contain the javax.inject package and have OSGi headers: org.glassfish.hk2.external org.apache.servicemix.bundles If you can't find anything you can convert any jar to OSGi bundle by hand. Actually, you can do this with the weld-se.jar but installing dependencies separately looks cleaner.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/47333064
has comment: http://stackoverflow.com/comment/34933026
type: Answer

http://stackoverflow.com/comment/34892254
has text: how many threads are created at that time ?
score: 0
comment on: http://stackoverflow.com/q/22869300
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22960361
answer count: 2
possible better answer: http://stackoverflow.com/a/22962826
has comment: http://stackoverflow.com/comment/35057327
accepted answer: http://stackoverflow.com/a/22962776
has comment: http://stackoverflow.com/comment/35057117
score: 0
has comment: http://stackoverflow.com/comment/35059797
has comment: http://stackoverflow.com/comment/35056050
type: AnsweredQuestion
has title: Execute a query using Hibernate-Java
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22962826
tagged with: mysql
has body: I have a query select userid from userinfo where DATEDIFF(ExpiryDate,curdate())&lt;100; how can this query be executed using hibernate?? I have tried this List&lt;String&gt; usernames = (List&lt;String&gt;)(getSession().createQuery("select userid from userinfo where DATEDIFF(ExpiryDate,CURRENT_DATE)&lt;100;").list()); for (Iterator iterator = usernames.iterator(); iterator.hasNext();){ String username= (String) iterator.next(); System.out.println(username); } But this does'nt return any result is there any other way to do this??
has answer: http://stackoverflow.com/a/22962776
type: Question

http://stackoverflow.com/comment/35039501
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22950587
has text: If you're seeing compilation errors and need help, you should ***post*** those compilation errors here so that we can read them, don't you think?

http://stackoverflow.com/q/22823438
answer count: 1
has answer: http://stackoverflow.com/a/22824029
favorite count: 0
tagged with: coldfusion
linked to: http://stackoverflow.com/q/12794382
upvote count: 3
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/22824029
has title: Railo Java Printing
type: Question
tagged with: railo
downvote count: 0
has body: I'm trying to get a program to print labels to a print attached (USB) to the server. I've been able to print to it from a batch file but for some reason the print command fails inside of coldfusion execute command. My current solution is to access the printer through Java. My problem with this solution is that I can't call any of them java methods. The solution is based off of this answer How to print strings with line breaks in java The following section of code appears to work fine. var printService = createObject("java","javax.print.PrintService"); var printServiceLookup = createObject("java","javax.print.PrintServiceLookup"); var docFlavor = createObject("java","javax.print.DocFlavor"); writeDump( printService.init() ); writeOutput('&lt;hr&gt;'); writeDump( printServiceLookup ); writeOutput('&lt;hr&gt;'); writeDump( docFlavor ); The problem comes when I try to do a execute any of the methods that exist in the objects that were just created. When I try to execute writeDump( DocFlavor.STRING.TEXT_PLAIN ); I get: Application Execution Exception Error Type: java.lang.NoSuchMethodException : 0 Error Messages: No matching Constructor for javax.print.DocFlavor() found Remember I'm trying to send a set of ZPL print commands to a printer attached to the computer. If been able to successfully do this through sockets but also need to be able to do it through a locally connected printer. So alternate solutions are acceptable provided they work with Railo &amp; Windows. Updated: 4/3/2013 var printer = javacast("null",""); var printers = printServiceLookup.lookupPrintServices( javacast("null",""), javacast("null","") ); for( var i=1; i le ArrayLen( printers ); i++ ) { if( printers[i].getName() eq printername ) { printer = printers[i]; break; } } if( i gt ArrayLen( printer ) ) { throw('Printer #printername# was not found'); } var Job = printer.createPrintJob(); var LabelCmdbytes = javaCast( "byte[]", javaCast( "String", LabelCmd ).getBytes() ); var Labeldoc = Doc.init( LabelCm…
tagged with: printing

http://stackoverflow.com/comment/34939643
has text: Java will ask to you to catch all checked exception... what is the problem?
type: Comment
comment on: http://stackoverflow.com/a/22893648
score: 0
type: AnswerComment

http://stackoverflow.com/q/22830983
answer count: 2
has comment: http://stackoverflow.com/comment/34823758
has answer: http://stackoverflow.com/a/22849903
accepted answer: http://stackoverflow.com/a/22849903
possible better answer: http://stackoverflow.com/a/22831508
upvote count: 1
favorite count: 0
tagged with: doubly-linked-list
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22831508
downvote count: 0
score: 1
tagged with: java
has title: JAVA doubly LinkedList - Unit Testing failed
tagged with: unit-testing
has body: I am trying to unit test my DSALinkedList, but is it coming up as my removeFirst() method failed. I couldn't figure it out why. Could any one please help me with it? Or did I go wrong anywhere else other than removeFirst() ? PLEASE HELP!! THANK YOU IN advance! Here is my DSALinkedList public class DSALinkedList { public DSAListNode head; public DSAListNode tail; Object[] newValue; public DSALinkedList(){ head = null; tail = null; } public void insertFirst(Object newValue){ DSAListNode newNd; newNd = new DSAListNode(newValue); if (head == null) { head = newNd; tail = newNd; } else{ newNd.setNext(head); head = newNd; } } public void insertLast(Object newValue){ DSAListNode newNd; newNd = new DSAListNode(newValue); if(head == null){ head = newNd; } else { tail.next = newNd; tail = newNd; } } public boolean isEmpty() { return (head == null); } public Object peekFirst(){ Object nodeValue; if (head == null) throw new IllegalArgumentException("head is empty"); else nodeValue = head.getValue(); return nodeValue; } public Object peekLast(){ Object nodeValue; if (head == null) throw new IllegalArgumentException("head is empty"); else nodeValue = tail.getValue(); return nodeValue; } public Object removeFirst(){ Object nodeValue; if (head == null) throw new IllegalArgumentException("head is empty"); else nodeValue = head.getValue(); head = head.getNext(); return nodeValue; } }
type: Question

http://stackoverflow.com/a/22854407
has comment: http://stackoverflow.com/comment/34865911
has comment: http://stackoverflow.com/comment/34865869
has comment: http://stackoverflow.com/comment/34865802
has comment: http://stackoverflow.com/comment/34865748
type: Answer
has comment: http://stackoverflow.com/comment/34866255
has comment: http://stackoverflow.com/comment/34866195
has comment: http://stackoverflow.com/comment/34866134
has comment: http://stackoverflow.com/comment/34865972
has comment: http://stackoverflow.com/comment/34865588
score: 5
has comment: http://stackoverflow.com/comment/34865722
upvote count: 5
has comment: http://stackoverflow.com/comment/34865853
has comment: http://stackoverflow.com/comment/34866070
has comment: http://stackoverflow.com/comment/34866006
has comment: http://stackoverflow.com/comment/34865649
downvote count: 0
answers question: http://stackoverflow.com/q/22854384
has body: You need to add your second Activity to your Androidmanifest.xml file. &lt;activity android:name="com.example.passstrings.abc" /&gt;

http://stackoverflow.com/comment/34946802
comment on: http://stackoverflow.com/q/22898371
has text: Should I add an answer?
score: 0
type: Comment
type: QuestionComment

excel
tags question: http://stackoverflow.com/q/22965246
tags question: http://stackoverflow.com/q/22854032
tags question: http://stackoverflow.com/q/22946769
tag name: excel
tags question: http://stackoverflow.com/q/22833711
tags question: http://stackoverflow.com/q/22877469
tags question: http://stackoverflow.com/q/22960368
tags question: http://stackoverflow.com/q/22842910
tags question: http://stackoverflow.com/q/22958391
tags question: http://stackoverflow.com/q/22886641
tags question: http://stackoverflow.com/q/22913687
tags question: http://stackoverflow.com/q/22850680
tags question: http://stackoverflow.com/q/22919337
type: Tag
tags question: http://stackoverflow.com/q/22879841
tags question: http://stackoverflow.com/q/22932395
tags question: http://stackoverflow.com/q/22928812
tags question: http://stackoverflow.com/q/22879486
tags question: http://stackoverflow.com/q/22859890
tags question: http://stackoverflow.com/q/22909534
tags question: http://stackoverflow.com/q/22944524
tags question: http://stackoverflow.com/q/22854803
tags question: http://stackoverflow.com/q/22940879
tags question: http://stackoverflow.com/q/22918763

http://stackoverflow.com/comment/34845192
comment on: http://stackoverflow.com/a/22843188
type: Comment
has text: @user3191018 Then you will want to use `"\n"` as Kon suggests; since a tab is not a newline.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22916968
answers question: http://stackoverflow.com/q/22910257
accepted answer of: http://stackoverflow.com/q/22910257
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You should clean tomccat's directory, probably some dependencies floating aroung,please check this answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/35012142
has text: @VarunKumar You basically need to construct DBObject entries that you pass to the aggregate method. There is [this example](http://docs.mongodb.org/ecosystem/tutorial/use-aggregation-framework-with-java-driver/) in the documentation resources. So it should not be hard to translate. And considering that it is an actual answer to show how it can be done that should not be too hard.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22931481

http://stackoverflow.com/comment/34882508
comment on: http://stackoverflow.com/a/22863741
type: AnswerComment
has text: Did you remove the try/catch block? Do it now. If you get an exception and a stacktrace, you'll see where the problem is. Then you fix the problem in your code logic and everything will work like a charm (hint: indexOf() returns -1 if the element isn't found, and arrays don't have a -1 index). Lastly, don't **ever** put an empty catch block, unless you know what you're doing (which you don't). It's a guaranteed way to waste your time debugging. At the least, put an `e.printStackTrace()` in there.
score: 0
type: Comment

http://stackoverflow.com/q/22964358
has title: android navigation drawer doesn't want to get clicked
has body: I have this weird bug that my navigation drawer doesn't seem to realise that it is being clicked. I have searched through a lot of things and I can't seem to find an answer. package com.BlackSheepApps.Eventpost.activities; import android.app.ActionBar; import android.app.Activity; import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import com.BlackSheepApps.Eventpost.R; import com.BlackSheepApps.Eventpost.adapters.AdapterNavigationDrawer; public class ActivityBasic extends Activity{ private ActionBar actionbar; private Resources resources; private String[] drawerStrings; private DrawerLayout drawerLayout; private ActionBarDrawerToggle drawerToggle; private ListView drawerList; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.drawer_layout); //sets the customized action bar actionbar = getActionBar(); resources = getResources(); actionbar.setBackgroundDrawable(new ColorDrawable(resources.getColor(R.color.opaque_blue))); //make the drawer drawerStrings = resources.getStringArray(R.array.drawer_categories); drawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout); drawerList = (ListView)findViewById(R.id.left_drawer); drawerList.setAdapter(new AdapterNavigationDrawer(this, -1, drawerStrings)); drawerList.setOnItemClickListener(new DrawerItemClickListener()); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.app_name, R.string.app_name) { /** Called when a drawer has settled in a completely closed state. */ public v…
accepted answer: http://stackoverflow.com/a/22964846
score: 0
has comment: http://stackoverflow.com/comment/35063760
answer count: 1
has comment: http://stackoverflow.com/comment/35068602
linked to: http://stackoverflow.com/q/18475098
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22964846
type: Question
tagged with: android

http://stackoverflow.com/comment/35004373
has text: The change actually did not effect the output. The original problem still remains.
type: Comment
comment on: http://stackoverflow.com/a/22931044
score: 0
type: AnswerComment

http://stackoverflow.com/a/22949921
has comment: http://stackoverflow.com/comment/35039176
has comment: http://stackoverflow.com/comment/35038660
answers question: http://stackoverflow.com/q/22949888
has comment: http://stackoverflow.com/comment/35038743
has comment: http://stackoverflow.com/comment/35038836
score: 0
has comment: http://stackoverflow.com/comment/35038927
has comment: http://stackoverflow.com/comment/35038612
type: Answer
has body: Here's a link for changing JButton color on every state. How to change a JButton color on mouse pressed? For the JFrame, you can set the Layout of the JFrame to BorderLayout and add the JPanel in the center of the JFrame, so it will fill all the JFrame even when resized. Example: frame.setLayout(new BorderLayout()); frame.add(panel,BorderLayout.CENTER);

http://stackoverflow.com/comment/34971567
type: Comment
has text: Can you quote some statistics that native method calls are slow? The JVM makes native calls all of the time so I don't think that's true.
comment on: http://stackoverflow.com/a/22906011
type: AnswerComment
score: 0

http://stackoverflow.com/comment/35017590
score: 0
comment on: http://stackoverflow.com/q/22938321
type: QuestionComment
type: Comment
has text: If that doesn't help much, you could lighten the weight of the task by splitting up the array in half (or more) and assign both halfs to separate threads which will process them individually.

http://stackoverflow.com/q/22961569
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/35059093
tagged with: key-bindings
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35058451
type: Question
has title: Key bindings up arrow is not recognized for the first time
tagged with: jtextcomponent
downvote count: 0
tagged with: action
has body: I have used keybindings for up arrow action, However it doesn't seem to work for the first time and it works from second press as i implemented, Below is my code, txtLog = new JTextArea(); Action upArrowAction = new UpArrowAction(); txtLog.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_UP,0), "upArrow"); txtLog.getActionMap().put("upArrow", upArrowAction); in uparrow call, class UpArrowAction extends AbstractAction{ @Override public void actionPerformed(ActionEvent ae) { ..... } The UpArrowAction is called for the second time and not for the first time .. Please help..
favorite count: 0

http://stackoverflow.com/a/65730139
answers question: http://stackoverflow.com/q/22853321
score: 10
upvote count: 10
has comment: http://stackoverflow.com/comment/139449630
type: Answer
has comment: http://stackoverflow.com/comment/136368487
downvote count: 0
has body: It can be achieved automatically like what browsers do with the below code. Reference: 1. https://hc.apache.org/httpclient-3.x/cookies.html https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/statemgmt.html @Bean public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) { RequestConfig requestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD_STRICT).build(); HttpClient httpClient = HttpClientBuilder.create() .setDefaultRequestConfig(requestConfig) .build(); RestTemplate restTemplate = restTemplateBuilder .requestFactory( () -> { HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); requestFactory.setHttpClient(httpClient); return new BufferingClientHttpRequestFactory(requestFactory); }) .basicAuthentication("username", "password") .build(); return restTemplate; }

http://stackoverflow.com/q/22832324
has title: Output from Process.getInputStream() buffered too long
has answer: http://stackoverflow.com/a/62507470
accepted answer: http://stackoverflow.com/a/22832527
possible better answer: http://stackoverflow.com/a/62507470
type: Question
has body: I have a Java program that uses Process Builder to start an external program. I have a Process Builder with the command, and I use the code below to get the program going. What I want to do is to print out the output just as the external program would have done, and I try to do this with the following code: pb.redirectErrorStream(true); p = pb.start(); InputStream is = p.getInputStream(); InputStreamReader isr = new inputStreamReader(is); BufferedReader br = new BufferedReader(isr, 32); while((line = br.readLine()) != null){ System.out.println(line); } The problem is that my program is all silent until the external program ends, when suddenly all output comes at once. Or it might not have benn silent if there had been more output, but I want it to produce the output as it comes, ie unbuffered. The (to me) obvious problem is the BufferedReader and the size of its buffer, but the thing is that I've tried to have a really small buffer, to no avail. I've also tried to avoid the BufferedReader, and work with the InputStreamReader directly instead, but thet bahaves the same way. Anyone here that can understand my problem, and perhaps have a solution?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3711040
tagged with: java
tagged with: inputstream
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22832527
tagged with: bufferedreader

http://stackoverflow.com/q/22889468
type: Question
has title: jconsole can not connect ssl1?
accepted answer: http://stackoverflow.com/a/22889858
has comment: http://stackoverflow.com/comment/34929778
tagged with: jconsole
tagged with: ssl
tagged with: openssl
answer count: 3
downvote count: 0
score: 1
has body: This is my very first time to use jconsole. The final goal of using this is measuring using memory redis uses. However, since this is my first time I want to just begin with small java project which just prints a phrase. Here is my source code. public class Main { public static void main(String[] args) throws Exception { int cnt = 0; while(true){ if(cnt == 100) break; System.out.println("Save me from the nap!"); Thread.sleep(1000*30); cnt++; } } }; After I wrote this code, I tried to run jconsole. So I ran this program in eclipse, at the same time, I execute 'jconsole' command in terminal. like below. &gt;jconsole A UI interface poped up and I can see process ID of my program: So I choose 'local' and my process ID and press connect button. But it shows an error message like this. ConnectionFailedSSL1 ConnectionFailedSSL2 &lt;Cancel&gt; &lt;Insecure&gt; Do I had to extra job to execute jconsole? Give me some specific instruction to use this. I really do not have any concept of 'SSL'.(All I know about this is SSL is abbreviation of Secure Socket Layer) My OS is OSX Mavericks.
has comment: http://stackoverflow.com/comment/34929795
favorite count: 0
has answer: http://stackoverflow.com/a/22889858
has comment: http://stackoverflow.com/comment/34929559
has comment: http://stackoverflow.com/comment/34932713
possible better answer: http://stackoverflow.com/a/28797629
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28797629
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/28903886

http://stackoverflow.com/comment/34834522
type: Comment
has text: And `List<Integer> linkedList = (List<Integer> & RandomAccess)new LinkedList<Integer>()` also makes no sense, I suppose?
comment on: http://stackoverflow.com/a/22836410
score: 0
type: AnswerComment

http://stackoverflow.com/a/22914756
answers question: http://stackoverflow.com/q/22914548
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You have one lock for each Thread, each Thread gets it's own lock. You want to give one single lock per all Threads to get the proper synchronisation.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22914548

http://stackoverflow.com/q/22919016
type: UnansweredQuestion
has title: Weird bug in median of medians as pivot to find Kth max element
has comment: http://stackoverflow.com/comment/34983182
has comment: http://stackoverflow.com/comment/34983545
has body: Finally I found the bug, please look at the second EDIT But there is still that question, you see, the last fourth row of "getMedian()" method, I sort the medians[] array to find the median of medians. Personally I think this breaks the worst case time complexity = O(n), is it correct? I try to use median of medians as the pivot to partition the array to find the Kth max element. But the bug is so weird: For example {8, 5, 2, 0, 9, 1}, the output is : k = 1, output >> 9. k = 2, output >> 9. k = 3, output >> 5. k = 4, output >> 2. k = 5, output >> 1. k = 6, output >> 0. The second max element's output is wrong, others well. public class FindKthMax_MOM { // Find Kth max by median of medians pivot method. // Time complexity, worst case = O(n). // n is the num of the elem in the given array. private static LNode &lt;Integer&gt; mergeSortLLForIntDataFromMinToMax (LNode &lt;Integer&gt; head) { if (head == null || head.next == null) return head; // Get the mid point of this linked list. LNode &lt;Integer&gt; preSlower = head; LNode &lt;Integer&gt; slower = head; LNode &lt;Integer&gt; faster = head; while (faster != null &amp;&amp; faster.next != null) { preSlower = slower; slower = slower.next; faster = faster.next.next; } // Cut off this main linked list. preSlower.next = null; // Do recursion on the left part and the right part. LNode &lt;Integer&gt; left = mergeSortLLForIntDataFromMinToMax(head); LNode &lt;Integer&gt; right = mergeSortLLForIntDataFromMinToMax(slower); // Merge left part and the right part from min to max. LNode &lt;Integer&gt; currHead = new LNode &lt;Integer&gt; (); LNode &lt;Integer&gt; tempCurrHead = currHead; while (left != null &amp;&amp; right != null) { if (left.data &lt;= right.data) { // Add the elem of left part into the linked list. tempCurrHead.next = left; left = left.next; } else { // Add the elem of right part into the linked list. tempCurrHead.next = right; right = right.next; } tempCurrHead = tempCurrHead.next; } if (left != null) { // …
type: Question
tagged with: big-o
tagged with: quickselect
score: 0
answer count: 1
tagged with: median-of-medians
tagged with: algorithm
has answer: http://stackoverflow.com/a/22922457
tagged with: java

http://stackoverflow.com/a/22851819
type: Answer
has body: When you declare an array of objects all elements inside it will be by default null. You need to create Instance instances and insert into it on the array before use the array elements
score: 1
answers question: http://stackoverflow.com/q/22851768
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/34853647
has text: Not sure what you mean ("xanted"?). In any case, individual compilation errors are usually not efficiently fixed via this forum. I suggest asking someone locally who is familiar with Java.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22847112
type: AnswerComment

http://stackoverflow.com/q/22860409
type: AnsweredQuestion
has body: I have a string data which has some unwanted text. I want to delete that data from string using a regular expression. The example data is given below from which I want to eliminate the key meth and its corresponding data. The regular expression I created for this purpose is "meth(S+)([\\},])" but its not working. I used the following code to use this regular expression: json = json.replaceAll("meth(S+)([\\},])",""); Below is the string data that is present in json : { data: [ { "city": "barcelona", "Date": "4 Apr 2014", "Name": "A-B", "meth": function(){ return_LANG=="en-us"?"A-T": "A-T " }, "fo": "null", }, { "city": "Newyork", "Date": "4 Apr 2014", "Name": "B-C", "meth": function(){ return_LANG=="en-us"?"S-E": "&amp;#2358;&amp;#2325;&amp;#2381;&amp;#2340;&amp;#2367;&amp;#2346;&amp;#2369;&amp;#2306;&amp;#2332;&amp;#2319;&amp;#2325;&amp;#2381;&amp;#2360;." }, "fo": "null", } ] } The result I am getting is the same string as my regular expression is unable to find the matching data in String. Please help me correcting my regex.
accepted answer: http://stackoverflow.com/a/22860734
tagged with: java
possible better answer: http://stackoverflow.com/a/22860736
type: Question
has answer: http://stackoverflow.com/a/22860736
has comment: http://stackoverflow.com/comment/34875910
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34876634
has title: Regular expression to eliminate some data from string in java?
has answer: http://stackoverflow.com/a/22860734
tagged with: android
tagged with: regex

http://stackoverflow.com/comment/35073350
comment on: http://stackoverflow.com/a/22968525
score: 0
type: AnswerComment
has text: I actually tested aswell and mine is neither working, should've verified it myself first.
type: Comment

http://stackoverflow.com/a/22888538
answers question: http://stackoverflow.com/q/22887424
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: The blocking behavior will be exactly the same as if you call that method without reflection. Basically JVM below will execute same logic. You can try it yourself with below code snippet: import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class SynchronizedReflectionTest { public static void main(String[] args) { SynchronizedReflectionTest test = new SynchronizedReflectionTest(); for(int i=0; i&lt;5; i++) { final int finalI = i; new Thread(new Runnable() { @Override public void run() { try { Method someThing = SynchronizedReflectionTest.class.getDeclaredMethod("someThing", new Class[]{int.class}); someThing.invoke(test, finalI); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } }).start(); } } public synchronized void someThing(int nr) { System.out.println("Executing someThing from "+nr); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Finished executing from nr "+nr); } } From the print results you can see that method calls are synchronized. Print results: Executing someThing from 0 Finished executing from nr 0 Executing someThing from 4 Finished executing from nr 4 Executing someThing from 3 Finished executing from nr 3 Executing someThing from 2 Finished executing from nr 2 Executing someThing from 1 Finished executing from nr 1 JVM guarantee that code guarded by lock will execute in synchronized blocks and if it will depend from type of method invocation reflection mechanism will be completely not safe and useless.
accepted answer of: http://stackoverflow.com/q/22887424

http://stackoverflow.com/comment/34807902
score: 1
comment on: http://stackoverflow.com/q/22822204
type: Comment
type: QuestionComment
has text: Can you point us to which line 40 is?

http://stackoverflow.com/comment/34849226
has text: It worked! It seems like others did not understand my question quite. I work for a company that has their own SDK with a documentation. The documentation which is generated using some javadoc generator is located in a filestructure just like a standalone website. I needed to render this separate website which worked file using GET /docs/*file controllers.ExternalAssets.at(path="documentation/", file)
type: AnswerComment
comment on: http://stackoverflow.com/a/22842076
score: 0
type: Comment

http://stackoverflow.com/a/22815728
has body: Use the Component.dispatchEvent(...) method to redispatch the event to the parent component. You will need to create a new MouseEvent. See the GlassPane example from How to Use Root Panes. It re-dispatches events from the glass pane to the component under the glass pane.
answers question: http://stackoverflow.com/q/22813488
has comment: http://stackoverflow.com/comment/34808255
has comment: http://stackoverflow.com/comment/34845625
has comment: http://stackoverflow.com/comment/34796982
upvote count: 2
has comment: http://stackoverflow.com/comment/34851168
has comment: http://stackoverflow.com/comment/34818580
type: Answer
has comment: http://stackoverflow.com/comment/34842791
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34819009
accepted answer of: http://stackoverflow.com/q/22813488
type: AcceptedAnswer

http://stackoverflow.com/q/22933049
type: UnansweredQuestion
has title: java finding height of binary tree recursively using 'for'
has answer: http://stackoverflow.com/a/22935528
tagged with: tree
tagged with: java
has answer: http://stackoverflow.com/a/22933437
downvote count: 1
type: Question
has body: I am trying to find a height of binary tree using for plz help me out. I have done it by using depth, but not this one What should I add in questionmark? public static int height2(Tree T, Node v) { if(T.isLeaf(v)) return 0; int h = 0; for(?????) { //need help!!! h = Math.max(height2(T,v.get_childLeft()),height2(T,v.get_childRight())); } return 1+h; }
has comment: http://stackoverflow.com/comment/35007751
score: -1
has comment: http://stackoverflow.com/comment/35016128
answer count: 2
upvote count: 0
favorite count: 0

http://stackoverflow.com/a/22926103
answers question: http://stackoverflow.com/q/22925757
has comment: http://stackoverflow.com/comment/35041798
has comment: http://stackoverflow.com/comment/35194054
has comment: http://stackoverflow.com/comment/35220823
type: Answer
has comment: http://stackoverflow.com/comment/35331745
has comment: http://stackoverflow.com/comment/35041867
has body: Disclaimer: Do not use regular expressions to parse HTML. If the HTML is as strictly formatted as in your posted code, you can follow these steps: Using the Pattern.DOTALL flag, search the entire string with &lt;tr&gt;(.*?)&lt;td&gt; Current Assignments Report &lt;/td&gt;.*?&lt;/tr&gt; Iterating each match with Matcher.find(), puts each assignment's data into capture group one. Example match: &lt;td&gt; &lt;div class="ed-tdSpacer"&gt;&lt;/div&gt;&lt;/td&gt; &lt;td valign="center"&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt; 04/02/14 &lt;/td&gt; &lt;td&gt; &lt;a href="javascript:rlViewItm('2049145027229871460');"&gt;View&lt;/a&gt; &lt;/td&gt; &lt;td&gt; &lt;a class="lochomepage" href="/pages/Local_High_School/Classes/3538_0001"&gt; Item 6 &lt;/a&gt; &lt;/td&gt; In this text, search for each instance of &lt;td&gt; (.*?) &lt;/td&gt;. The contents of each data item is placed in its capture group one. Searching the above text results in these matches: 04/02/14 &lt;a href="javascript:rlViewItm('2049145027229871460');"&gt;View&lt;/a&gt; &lt;a class="lochomepage" href="/pages/Local_High_School/Classes/3538_0001"&gt; Item 6 &lt;/a&gt; The date can be pretty much taken as is, and the other two items will need to be parsed based on what you want to get out of them. But again, if your input is really as strict as you imply, it shouldn't be that bad. Updated: With your most recent input (the long file you posted), this regex captures each item, as best I understand your needs: &lt;td&gt;\s*?Current Assignments Report.*?&lt;td&gt;\s*?([0-9]{2}/[0-9]{2}/[0-9]{2}).*?&lt;a href="javascript:rlViewItm\('([0-9]+)'\);"&gt;View&lt;/a&gt;.*?&lt;a class="lochomepage" href="([^"]+)"&gt;\s*([\w ]+)\s*&lt;/a&gt; Debuggex Demo Note this takes a while to load, because the input is so long. Capture groups: Date Item number The lochomepage url The link display I know it's been a while since you asked this. Maybe it still helps...
score: 0
has comment: http://stackoverflow.com/comment/35038028
has comment: http://stackoverflow.com/comment/35373739
has comment: http://stackoverflow.com/comment/35340110
has comment: http://stackoverflow.com/comment/35037586
has comment: http://stackoverflow.com/comment/35373701
has comment: http://stackoverflow.com/comment/35331562

http://stackoverflow.com/comment/34803259
comment on: http://stackoverflow.com/q/22819680
type: Comment
type: QuestionComment
score: 1
has text: `context` is obviously null. replace by `LevelOne.this`. And fix your logcat, there is an exception here.

http://stackoverflow.com/comment/34954599
score: 0
has text: Are you running an application or from a server? If it's from a server, you may need to add the jar file/s to `WebContent/WEB-INF/lib`.
type: Comment
comment on: http://stackoverflow.com/q/22903589
type: QuestionComment

http://stackoverflow.com/comment/35032954
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22920231
has text: Using `StrLookup` is a good idea. Keep in mind that you will need a Map with lowercase keys for this to work.

http://stackoverflow.com/comment/35100304
type: Comment
type: QuestionComment
score: 1
has text: I did an experiment: `new String(name.getBytes("ISO-8859-1"), "GBK")` yielded `用户名:翕然12`
comment on: http://stackoverflow.com/q/22898022

http://stackoverflow.com/comment/34976454
comment on: http://stackoverflow.com/q/22915883
type: Comment
type: QuestionComment
has text: Looks like this appender is created before Spring loads its classes, thus getting your exception.
score: 1

http://stackoverflow.com/comment/35061717
has text: can you show your effort?
score: 3
comment on: http://stackoverflow.com/q/22963339
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22926200
tagged with: javafx-8
upvote count: 1
favorite count: 0
has title: JavaFX 8 ColorPicker NullPointerException
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/35004668
tagged with: input
has body: This code: package colorpickertest; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.ColorPicker; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.stage.Stage; public class ColorPickerTest extends Application { @Override public void start(Stage stage) throws Exception { Pane root = new Pane(); Scene scene = new Scene(root, 640, 480, Color.BLACK); root.getChildren().add(new ColorPicker()); stage.setTitle("ColorPickerTest"); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } } sometimes gives this error repeatedly when certain lighter colors are picked: Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at com.sun.glass.ui.TouchInputSupport.notifyBeginTouchEvent(TouchInputSupport.java:82) at com.sun.glass.ui.mac.MacTouchInputSupport.notifyNextTouchEvent(MacTouchInputSupport.java:128) at com.sun.glass.ui.mac.MacGestureSupport.notifyNextTouchEvent(MacGestureSupport.java:77) What am I doing wrong? Thanks. StackOverflow is making me add more details but this is all I have to offer.
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: color-picker
type: Question
has comment: http://stackoverflow.com/comment/35029376
has comment: http://stackoverflow.com/comment/35004598
has comment: http://stackoverflow.com/comment/35034405

http://stackoverflow.com/comment/34813590
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22825369
has text: I don't think that's the *actual* code. Did you mean `SubConfiguration` by chance?

http://stackoverflow.com/q/22832641
has body: I am trying to send SIP notify to a SIP Endpoint but Getting error if SIP Endpoint is at the same machine. If i use two different machines it works. sipCoreComponentService.sendCheckSyncNotify(to, destination,destPort, false); the this function has : ClientTransaction trans= sipLayer.sipProvider.getNewClientTransaction(notifyRequest); trans.sendRequest(); // Send it out-of-dialog trans.setApplicationData(this); What could be the problem? I am getting this error: Exception javax.sip.SipException: Cannot assign requested address: Datagram send failed gov.nist.javax.sip.stack.SIPClientTransaction.sendRequest(SIPClientTransaction.java:972)
score: 2
tagged with: jain-sip
downvote count: 0
type: UnansweredQuestion
type: Question
has title: jain sip API not able to send notify to endpoints at same machine
tagged with: java
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/22847056
tagged with: sip
favorite count: 0
tagged with: spring

http://stackoverflow.com/q/22947781
has answer: http://stackoverflow.com/a/22948111
type: AnsweredQuestion
has title: Enforcing instance variable implementation from an abstract class in Java
has comment: http://stackoverflow.com/comment/35035077
tagged with: java
possible better answer: http://stackoverflow.com/a/22948111
has answer: http://stackoverflow.com/a/22948229
has comment: http://stackoverflow.com/comment/35034583
type: Question
has comment: http://stackoverflow.com/comment/35034737
has answer: http://stackoverflow.com/a/22948237
tagged with: inheritance
score: 0
tagged with: abstract-class
has comment: http://stackoverflow.com/comment/35035547
answer count: 3
accepted answer: http://stackoverflow.com/a/22948229
has body: I am trying to design an abstract class which will enforce implementation of an instance variable even though the type if this instance variable is unknown at the abstract level. For example: public abstract class AbstractDiet{ abstract void computeMeat() abstract void computeVeggies() … } public abstract class AbstractAnimal{ protected AbstractDiet diet; … } Then I'd like users to implement something like: public class Cat extends AbstractAnimal{ protected CatFoodDiet diet; // CatFoodDiet extends AbstractDiet … } Is this the best way to implement the diet variable? I want to ENFORCE that a subclass of AbstractDiet is always implemented in a subclass of AbstractAnimal.
has comment: http://stackoverflow.com/comment/35034743

http://stackoverflow.com/q/22873829
has comment: http://stackoverflow.com/comment/34901783
tagged with: regex
type: AnsweredQuestion
tagged with: java.util.scanner
tagged with: java
has answer: http://stackoverflow.com/a/22874249
has comment: http://stackoverflow.com/comment/34902003
type: Question
has comment: http://stackoverflow.com/comment/34901641
has title: Scanning in only words with scanner and a text file
has comment: http://stackoverflow.com/comment/34901658
has comment: http://stackoverflow.com/comment/34902027
has comment: http://stackoverflow.com/comment/34901117
score: 0
accepted answer: http://stackoverflow.com/a/22874249
answer count: 1
has body: I have to read in words from a file. For example a sentence might be Bill's favorite animal is a dog. He is buying one at 1:30. I need to only have the words, while not eliminating apostrophes, but eliminating the 1:30. The desired out put for this would start: Bill's favorite animal, ...etc. Code: Scanner scanner = null; Pattern pattern=Pattern.compile("[^\\w+]"); String word; try{ scanner=new Scanner(file); }catch(FileNotFoundException e){ System.out.println("Can't Find the File in Dictionary class!"); } time=System.nanoTime(); while(scanner.hasNext()){ scanner.useDelimiter(pattern); word=scanner.next(); System.out.println(word); if(!word.equals("")){ dictionary.add(word); } } I have tried using delimiter, but that results in Bill and s on separate lines with no '. I was hoping simply to be able to use scanner.next(Pattern.compile("[^\\w+])); but when I try that I get an InputMismatchException. Hopefully someone can help with this! Thanks!

http://stackoverflow.com/a/22864417
has body: Doesn't UserRepo needs to be annotated with : @Repository
has comment: http://stackoverflow.com/comment/34883393
downvote count: 1
answers question: http://stackoverflow.com/q/22864261
has comment: http://stackoverflow.com/comment/34883985
has comment: http://stackoverflow.com/comment/34883377
type: Answer
has comment: http://stackoverflow.com/comment/34883484
has comment: http://stackoverflow.com/comment/34883859
score: 1
upvote count: 2

http://stackoverflow.com/q/22880287
has body: so I need to figure out this problem for a class. How would you do it? Given three ints, a b c, one of them is small, one is medium and one is large. Print true if the three values are evenly spaced, so the difference between small and medium is the same as the difference between medium and large. (2, 4, 6) -&gt; true (4, 6, 2) -&gt; true (4, 6, 3) -&gt; false
has answer: http://stackoverflow.com/a/22880318
type: Question
has answer: http://stackoverflow.com/a/22880682
has answer: http://stackoverflow.com/a/28438816
has comment: http://stackoverflow.com/comment/34912384
favorite count: 0
has answer: http://stackoverflow.com/a/33727443
downvote count: 6
answer count: 12
has answer: http://stackoverflow.com/a/53921906
has title: Finding if integers are evenly spaced
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/59548431
score: -4
has answer: http://stackoverflow.com/a/22880370
has answer: http://stackoverflow.com/a/48739751
has answer: http://stackoverflow.com/a/64427509
has answer: http://stackoverflow.com/a/55448333
has answer: http://stackoverflow.com/a/40600484
has answer: http://stackoverflow.com/a/54181900
tagged with: java

http://stackoverflow.com/comment/35067417
comment on: http://stackoverflow.com/a/22966444
score: 1
has text: `static` only if the lock has to be the same for all instances of the class, which is not the most common case
type: AnswerComment
type: Comment

series
tag name: series
type: Tag
tags question: http://stackoverflow.com/q/22931938
tags question: http://stackoverflow.com/q/22914238

http://stackoverflow.com/comment/35041936
type: Comment
comment on: http://stackoverflow.com/q/22951889
has text: So do I use another port?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34831196
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22835434
has text: There is not sufficient information there to determine the answer in all cases; e.g. if the file is being accessed as well.
score: 0

http://stackoverflow.com/comment/34790604
has text: What code do you have that attempts this? When you parse through the result set you can just do your calculation and add all the data to your JTable
comment on: http://stackoverflow.com/q/22812922
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22884526
has answer: http://stackoverflow.com/a/22884551
upvote count: 1
type: AnsweredQuestion
tagged with: enums
score: 1
accepted answer: http://stackoverflow.com/a/22885064
tagged with: java
type: Question
answer count: 2
downvote count: 0
has title: different generic type-erasure behaviour for Hashmap and EnumMap
favorite count: 0
has body: I noticed surprising(for me) difference between HashMap and EnumMap in 'generics behaviour'. What does it mean? Consider the following two code snippets: snippet 1 enum Types { A, B, C } enum Wrong { A } public class Test { public static void main(String... args) { EnumMap&lt;Types, Integer&gt; m = new EnumMap&lt;Types, Integer&gt;(Types.class); EnumMap m1 = m; m1.put(Wrong.A, 1); } } out: Exception in thread "main" java.lang.ClassCastException: class Wrong != class Types snippet 2 enum Types { A, B, C } enum Wrong { A } public class Test { public static void main(String... args) { HashMap&lt;Types, Integer&gt; m = new HashMap&lt;Types, Integer&gt;(); HashMap m1 = m; m1.put(Wrong.A, 1); } } out: successful compilation! Conclusion: Therefore for HashMap erasure fullfils but for same code with EnumMap - not. Why?
tagged with: type-erasure
has answer: http://stackoverflow.com/a/22885064
tagged with: dictionary
possible better answer: http://stackoverflow.com/a/22884551
has comment: http://stackoverflow.com/comment/34920274
tagged with: generics

http://stackoverflow.com/a/22844510
has comment: http://stackoverflow.com/comment/34849796
type: Answer
has comment: http://stackoverflow.com/comment/34848690
upvote count: 4
has body: button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { label.setText("new text"); } }); Will change the text of label to new text when button is clicked. button.addActionListener(new ActionListener() { int clicks = 0; @Override public void actionPerformed(ActionEvent e) { switch (++clicks) { case 1: label.setText("hello"); break; case 2: label.setText("sharma"); break; //continue doing it like this } } });
downvote count: 0
has comment: http://stackoverflow.com/comment/34849614
accepted answer of: http://stackoverflow.com/q/22844466
has comment: http://stackoverflow.com/comment/34849855
has comment: http://stackoverflow.com/comment/34849704
answers question: http://stackoverflow.com/q/22844466
has comment: http://stackoverflow.com/comment/34849434
has comment: http://stackoverflow.com/comment/34849473
has comment: http://stackoverflow.com/comment/34850260
has comment: http://stackoverflow.com/comment/34849924
has comment: http://stackoverflow.com/comment/34849505
has comment: http://stackoverflow.com/comment/34848432
has comment: http://stackoverflow.com/comment/34848571
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34848524
score: 4
has comment: http://stackoverflow.com/comment/34849072
has comment: http://stackoverflow.com/comment/34848930
has comment: http://stackoverflow.com/comment/34848091
has comment: http://stackoverflow.com/comment/34848234
has comment: http://stackoverflow.com/comment/34850379

http://stackoverflow.com/comment/34971490
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22913010
has text: Java scriptlets are executed server-side. By the time your page reaches the user they are gone.
score: 2

http://stackoverflow.com/comment/35075844
comment on: http://stackoverflow.com/q/22953136
has text: i think you should be aware just to remind you JAVA != JAVASCRIPT
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22879561
tagged with: ms-access
favorite count: 0
upvote count: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22880007
has comment: http://stackoverflow.com/comment/34911710
type: Question
has body: I am using jackess 2 for reading a Access file in Java. Below is the code. In the table that I read, I have only 1 row. There is a column called "Active" of type "Yes/No" in MS-Access. When I print all values in the table, the value of Active column is shown as "true". But when I try to query the row using findRow(), there is no match. How can I query the table for the column "Active"? try { Database db = DatabaseBuilder.open(new File(strDataPath + "DB.mdb")); Table table = db.getTable("03_Test_Cases"); for(Row row : table) { System.out.println("Column 'a' has value: " + row.get("Active")); // RETURNS "true" } Row row = CursorBuilder.findRow(table, Collections.singletonMap("Active", "true")); if(row != null) { System.out.println("Found row : " + row); } else { System.out.println("Could not find row"); // Always hits here only. } } catch (IOException e) { e.printStackTrace(); }
tagged with: jackcess
accepted answer: http://stackoverflow.com/a/22880007
score: 2
answer count: 1
downvote count: 0
has title: Finding Row with the column of Yes/No Type in jackcess

http://stackoverflow.com/comment/35030524
comment on: http://stackoverflow.com/q/22945131
score: 0
type: Comment
type: QuestionComment
has text: @donfuxx,yes, I want these lines into a text file. I am stuck in extracting couple lines and specific columns

http://stackoverflow.com/a/22950080
has body: Try this one Steps to follow: Its listening for key event as well as mouse event. A new thread is started that will check. If the time difference is more than specified time (10 sec in below sample code) then dispose the window. That's all. Here is the sample code: private long time; ... long eventMask = AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK; Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { public void eventDispatched(AWTEvent e) { time = System.currentTimeMillis(); } }, eventMask); time = System.currentTimeMillis(); new Thread(new Runnable() { @Override public void run() { while (true) { if (System.currentTimeMillis() - time &gt; 10000) { widnow.dispose(); break; } } } }).start();
has comment: http://stackoverflow.com/comment/35046571
has comment: http://stackoverflow.com/comment/35038940
has comment: http://stackoverflow.com/comment/35039003
downvote count: 0
has comment: http://stackoverflow.com/comment/35038887
has comment: http://stackoverflow.com/comment/35038881
has comment: http://stackoverflow.com/comment/35039109
type: Answer
has comment: http://stackoverflow.com/comment/35038770
has comment: http://stackoverflow.com/comment/35038899
score: 3
has comment: http://stackoverflow.com/comment/35039145
upvote count: 3
answers question: http://stackoverflow.com/q/22949979
has comment: http://stackoverflow.com/comment/35048200

http://stackoverflow.com/comment/34900990
has text: Try this related [example](http://stackoverflow.com/a/7203419/230513).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22873405
type: Comment

http://stackoverflow.com/a/22907275
has body: These "arbitrary addresses" refer to the memory of the local system. When you have a native application (compiled as an EXE file) that is downloaded and exectued on one PC, then this executable can do anything - particularly, it can read (and at least theoretically write) the whole memory of the system it is running on. In contrast to that, a Java application is restricted to the Java Virtual Machine (JVM). It can not access memory on the system it is running on, except for the memory that is explicitly provided for by the JVM. This is a security layer that is imposed by Java and the JVM itself, and not by other mechanisms like SecurityManager.
downvote count: 0
has comment: http://stackoverflow.com/comment/34985247
score: 1
has comment: http://stackoverflow.com/comment/34985767
upvote count: 1
answers question: http://stackoverflow.com/q/22904483
type: Answer

http://stackoverflow.com/a/22844442
has body: Look at com.github.rfqu.df4j.CompletableFuture in (my) df4j-core project. If you find a bug, or need an enhancement, submit an issue to the project and I'll fix it.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/34973296
has comment: http://stackoverflow.com/comment/34944026
answers question: http://stackoverflow.com/q/22843984

http://stackoverflow.com/a/23005387
answers question: http://stackoverflow.com/q/22897856
downvote count: 0
has body: You can use RiTa (http://www.rednoise.org/rita/wordnet/documentation/) for this. They have a getRandomWords(pos, count) method: http://www.rednoise.org/rita/wordnet/documentation/riwordnet_method_getrandomwords.htm Just use it like String[] randomNouns = wordnet.getRandomWords("n", 5000);
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/34829190
type: Comment
has text: yeah it helped. but before that I Should change the directory to just"imagename.jpg". thanks.
comment on: http://stackoverflow.com/a/22832379
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34894875
comment on: http://stackoverflow.com/q/22870346
score: 0
type: Comment
type: QuestionComment
has text: I recall some discussion on the lambda-dev mailing list about allowing protected methods in interfaces now that they have default methods. They may be preparing for adding that in Java 9.

http://stackoverflow.com/comment/34947117
score: 0
type: AnswerComment
type: Comment
has text: +1 This is the only answer that doesn't involve generating unnecessary random numbers for an unknown amount of time, losing efficiency.
comment on: http://stackoverflow.com/a/22899313

http://stackoverflow.com/comment/35108247
comment on: http://stackoverflow.com/a/22941051
score: 0
type: Comment
has text: I register the GUI as a PropertyChangeListener in the method startWorker.
type: AnswerComment

http://stackoverflow.com/q/22954592
type: Question
accepted answer: http://stackoverflow.com/a/22954668
score: 0
answer count: 2
has body: I am writing a code for an assignment, and I want to know what this means. The int's in the array should be initialized so that all int's at indexes of the form 0 mod 4 are - 1 What is this saying? How do I initialize a certain value at an index?
has comment: http://stackoverflow.com/comment/35046219
tagged with: arrays
has answer: http://stackoverflow.com/a/22955057
tagged with: initialization
has comment: http://stackoverflow.com/comment/35046200
possible better answer: http://stackoverflow.com/a/22955057
tagged with: module
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22954668
has title: Initializing int in an array
tagged with: java
has comment: http://stackoverflow.com/comment/35046220

http://stackoverflow.com/comment/93277898
has text: @edwin Thanks, link is fixed.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22874175

http://stackoverflow.com/comment/34826142
type: AnswerComment
comment on: http://stackoverflow.com/a/22832487
has text: This is good, just fix the string array constructor syntax `new String[] { productName }`
type: Comment
score: 1

http://stackoverflow.com/q/22889619
has title: How to use variable outside of try-catch block
type: Question
score: 0
answer count: 2
tagged with: encryption
has comment: http://stackoverflow.com/comment/34929390
tagged with: java
tagged with: try-catch
has answer: http://stackoverflow.com/a/22889639
tagged with: variables
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22890189
has body: I am making a decryption program and I'm not quite sure how to use the variable "cip" out side of my try catch block. I tried moving the 3 lines of where is asks user to input pattern but i ran into other problems. my code is: import java.util.*; public class unscrambler //This class will encrpyt the program { public static void main (String [] args){ int cip= 0; String user =""; System.out.println("Please enter the code to unscramble"); Scanner inputScanner = new Scanner(System.in); //imports scanner reader String userinput = inputScanner.next(); char[] charArray = userinput.toCharArray(); //sends userinput to charArray int j=charArray.length; Character [] array = new Character[j]; for(int w=0; w&lt;j; w++){ array[w] = charArray[w]; } int a=1; System.out.println("Please enter the number cipher pattern (an integer)"); do{ try{ user = inputScanner.next(); cip = Integer.parseInt(user); a=2; System.out.println("your code is "); for(int w =0; w&lt;j;){ System.out.println(charArray[j]); w+=cip; } if(cip&lt;=0){ System.out.println("please enter number greater than zero"); a=1; } }catch(NumberFormatException f){ System.out.println("please enter a proper number"); } }while(a==1); } }

http://stackoverflow.com/a/22928201
has comment: http://stackoverflow.com/comment/34999465
has comment: http://stackoverflow.com/comment/34999503
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/34999497
answers question: http://stackoverflow.com/q/22927818
has body: Hmm.. maybe you need something like this: public class BallArea extends JComponent { static final int MAX_SIZE = 63; static final BasicStroke stroke = new BasicStroke(5); final Queue&lt;Point&gt; points = new LinkedList(); public BallArea() { setSize(400, 400); setBackground(Color.BLACK); addMouseMotionListener(new MouseAdapter() { @Override public void mouseMoved(MouseEvent e) { if (points.size() &gt;= MAX_SIZE) { points.poll(); } points.add(e.getPoint()); repaint(); } }); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setStroke(stroke); int i = 1; Point prev = null; for (Point p : points) { if (prev == null) { prev = p; continue; } g2.setColor(new Color(255, 0, 0, i*4)); g.drawLine(prev.x, prev.y, p.x, p.y); i++; prev = p; } } }
score: -1
has comment: http://stackoverflow.com/comment/34999571
upvote count: 0
has comment: http://stackoverflow.com/comment/34999417

http://stackoverflow.com/comment/34938638
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22894857
type: Comment
has text: I think he already have it, his problem is `catch(invalidEmploteeId)`.

http://stackoverflow.com/q/22960758
tagged with: properties
type: AnsweredQuestion
has title: Message format choice in properties file
type: Question
has answer: http://stackoverflow.com/a/22961248
has body: I have looked at this link, and can't see what I am doing wrong. I am using MessageFormat to get a property from a file, and want to make the property dynamic depending on whether the integer passed in is 1 or higher. The property in the file looks like this: Prop1=Invalid password entered. You have {0,number,integer} {0,choice,1#attempt|1&lt;attempts} remaining. In the code, I read this property in, and then pass an array of arguments to MessageFormat.format() (I pass an array for consistency across all properties. In this case, the only object present is the string representation of an integer value) Whilst debugging the code, I can see that this string gets read, but MessageFormat.format() doesn't seem to format the string as expected. The result looks like this: "Invalid password entered. You have {0,number,integer} {0,choice, 1#attempt|1&lt;attempts} remaining." Can anybody tell me what I'm doing wrong? As I stated earlier, I am passing in the string representation of the integer value, but I assumed that the code above would be able to handle it. Am I mistaken in my understanding?
tagged with: java
tagged with: messageformat
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/12138279
accepted answer: http://stackoverflow.com/a/22961248

http://stackoverflow.com/q/22834231
answer count: 2
has answer: http://stackoverflow.com/a/22834644
favorite count: 0
has answer: http://stackoverflow.com/a/22838885
tagged with: rest
tagged with: spring
score: 2
has title: Good Design for calling BRMS/Drools Logic over REST
downvote count: 0
tagged with: java
tagged with: web-services
type: Question
type: AnsweredQuestion
tagged with: drools
possible better answer: http://stackoverflow.com/a/22834644
has body: I am working on an application which is built in .NET and Java. The Java component contains the complete Rule base using Redhat BRMS suite. The .NET client (UI and desktop based applications) will be consulting the Java Rule engine and sending/receiving the JSON data. The decision which has been taken is to expose the Rules engine (Redhat BRMS 6.0.0 using Drools) as a REST based API. I have come-up with the following design approaches: Write a REST controller in Spring framework and service classes for calling BRMS. Write a simple REST controller using JBOSS proprietary RESTSY or JAXRS. Write a Camel adapter and wrap the REST calls behind the Camel and let the Camel talk to Drools. Wrap REST behind SOAP based webservices. I want to ask which one would be the better approach for designing such as System. Any other thoughts are welcome.
upvote count: 2
accepted answer: http://stackoverflow.com/a/22838885

http://stackoverflow.com/comment/35050138
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22912895
has text: @Amar546 Other than that, there's nothing special about sending objects from client to server and vice versa; BlazeDS just automates all the serialisation etc. You can use JSON/XML/your own custom format, you'll just need to write the converters on both ends. All you need to be able to do is to know what class to create on either end, and fill in the properties passed. Your not passing "objects", you're passing Byte/String representations of objects, which are then recreated on either end

http://stackoverflow.com/comment/34826716
type: QuestionComment
comment on: http://stackoverflow.com/q/22832747
type: Comment
has text: so u are looking for a way to decrease the 5 minutes to the 90 seconds or for a way to higher the timeout time?
score: 0

http://stackoverflow.com/comment/35034708
type: Comment
has text: I'v just changed the xmlFromUrl and now that works. And your right abut the toString() too, iv just logged event.getName and it comes out as expected. I'm a little confused why toString() is not working though?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22947730

http://stackoverflow.com/comment/34831082
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22835347
has text: But that doesn't tell you which link was used to *modify* the file; e.g. if one link was used to modify, and *then* the second one was used to access it.
type: Comment

http://stackoverflow.com/a/22811723
type: AcceptedAnswer
downvote count: 0
has body: Given your very specific input, this regex works. ([\w\[\]' $]+)\.([\w\[\]' $]+) Capture group one is before the period, capture group 2, after. To escape this for a Java string: Pattern pattern = Pattern.compile("([\\w\\[\\]' $]+(\\.*[\\w\\[\\]' $]+)"); However, it would be much easier to split the string on the literal dot, if this is what you are trying to achieve: String[] pieces = between.split("\\."); System.out.println(pieces[0]); System.out.println(pieces[1]); Output: ['Sheet 1$'] [DEPTNO] AS [DEPTNO]
type: Answer
accepted answer of: http://stackoverflow.com/q/22811601
upvote count: 2
answers question: http://stackoverflow.com/q/22811601
score: 2

http://stackoverflow.com/comment/35022316
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22940551
has text: @MikeKoch I am that person who have posted in openfire forum.what is your username in openfire forum

http://stackoverflow.com/q/22898539
has answer: http://stackoverflow.com/a/22898618
has body: I am trying to write a simple data output file. When I execute the code I get a "No file exist" as the output and no data.txt file is created in the dir. What am I missing? The odd thing is that it was working fine the other night, but when I loaded it up today to test it out again, this happened. Here is the code: import java.io.*; import java.util.*; public class DataStreams { public static void main(String[] args) throws IOException { try { DataOutputStream out = new DataOutputStream(new FileOutputStream("C:\\data.txt")); for (int i = 0; i &lt; 10; i++) { out.write(i); } } catch (IOException ioe) { System.out.println("No file exist"); } } } The data file should be a simple display of numbers 1 through 9. Thanks for your input.
possible better answer: http://stackoverflow.com/a/22898585
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34945662
tagged with: dataoutputstream
type: Question
has answer: http://stackoverflow.com/a/22898685
has title: Creating a simple data output file in Java
has answer: http://stackoverflow.com/a/22898585
has answer: http://stackoverflow.com/a/22898607
accepted answer: http://stackoverflow.com/a/22898607
score: 0
has comment: http://stackoverflow.com/comment/34945651
answer count: 4

adt
tags question: http://stackoverflow.com/q/22936565
tags question: http://stackoverflow.com/q/22917626
tags question: http://stackoverflow.com/q/22925268
tags question: http://stackoverflow.com/q/22888173
tags question: http://stackoverflow.com/q/22900917
tag name: adt
tags question: http://stackoverflow.com/q/22899711
tags question: http://stackoverflow.com/q/22951868
type: Tag

http://stackoverflow.com/a/22932988
has body: Modified version is below. This will fetch the text content of value node of input tag node. import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * @author JayaPrasad * */ public class ParseXml { private String paramReader(String tag) { String value = ""; try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse("parse.xml"); doc.getDocumentElement().normalize(); NodeList nList = doc.getElementsByTagName("parameter"); for (int i = 0; i &lt; nList.getLength(); i++) { Node nNode = nList.item(i); // NodeList childNodes = nNode.getChildNodes(); // for (int j = 0, length = childNodes.getLength(); j &lt; length; j++) { // System.out.println(childNodes.item(j).getNodeName() + ":" // + childNodes.item(j).getTextContent()); // if (childNodes.item(j).getNodeName().equals(tag)) { // value = childNodes.item(j).getTextContent(); // System.out.println("Tag Node Value ::: " + value); // } // } if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = null; if (nNode instanceof Element) { // Safest way before casting eElement = (Element) nNode; } if (eElement.getElementsByTagName("tag").item(0) .getTextContent().trim().equals(tag)) { value = eElement.getElementsByTagName("value").item(0) .getTextContent(); System.out.println("Result value :: " + value); } } } } catch (Exception e) { e.printStackTrace(); } return value; } public static void main(String[] args) { ParseXml xmlObj = new ParseXml(); xmlObj.paramReader("Call_time"); } }
score: 0
has comment: http://stackoverflow.com/comment/35008374
has comment: http://stackoverflow.com/comment/35008681
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35010280
type: Answer
has comment: http://stackoverflow.com/comment/35011478
accepted answer of: http://stackoverflow.com/q/22932075
answers question: http://stackoverflow.com/q/22932075

http://stackoverflow.com/q/22905972
tagged with: chess
has title: How to check empty diagonals for bishop?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22906077
score: 1
tagged with: java
type: Question
upvote count: 2
answer count: 2
has body: i am writing chess in java, this code for checking weather there are obstacles for bishop sometimes works and in some cases doesn't. can you please explain me my mistakes thanks! public boolean checkifEmpty(int fromRow, int fromColumn, int toRow, int toColumn, Figure[][] ChessBoard) { int differenceInRows = Math.abs(fromRow - toRow); if (differenceInRows == 1 ) { return true; } for (int j = 1; j &lt; differenceInRows; j++) { if ((toRow &lt; fromRow) &amp;&amp; (toColumn &gt; fromColumn) &amp;&amp; ChessBoard[fromRow - j][fromColumn + j] == null) { return true; } else if ((toRow &gt; fromRow) &amp;&amp; (toColumn &gt; fromColumn) &amp;&amp; ChessBoard[fromRow + j][fromColumn + j] == null) { return true; } else if ((toRow &gt; fromRow) &amp;&amp; (toColumn &lt; fromColumn) &amp;&amp; ChessBoard[fromRow + j][fromColumn - j] == null) { return true; } else if ((toRow &lt; fromRow) &amp;&amp; (toColumn &lt; fromColumn) &amp;&amp; ChessBoard[fromRow - j][fromColumn - j] == null) { return true; } } return false; }
downvote count: 1
has answer: http://stackoverflow.com/a/22906576
accepted answer: http://stackoverflow.com/a/22906576
favorite count: 0
possible better answer: http://stackoverflow.com/a/22906077

http://stackoverflow.com/comment/35031677
type: QuestionComment
type: Comment
score: 0
has text: `List<Cita> list = new ArrayList<>();` Have you tried changing this to `List<Cita> list = new ArrayList<Cita>();`?
comment on: http://stackoverflow.com/q/22946232

http://stackoverflow.com/comment/35768204
has text: do we need to have admin_signin and customer_signin mappings in controller?
type: Comment
comment on: http://stackoverflow.com/a/23017200
score: 0
type: AnswerComment

http://stackoverflow.com/a/22846724
type: Answer
answers question: http://stackoverflow.com/q/22846619
upvote count: 1
has body: What are you trying to do in the line if (String.compareTo(phrase("test")) = phrase.toUpperCase()) ? String.compareTo is a function, so the compiler is telling you that String.compareTo is not a variable; and phrase is a String (it's the parameter passed in) so I am not sure what you mean? Perhaps you mean new Phrase(phrase).getPhrase().equals(phrase.toUpperCase()) instead?
downvote count: 0
score: 1

http://stackoverflow.com/comment/34825811
comment on: http://stackoverflow.com/a/22831943
has text: i disagree with you, i have just give an example, but almost all my select queries are tend to catch emptyresult exception and return null or do some other action, more over emptyresultdata exception will be swallowed by dataaccessexception, so you never know there is empty row or row exists.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22966666
has title: How to exit the program with a letter
has comment: http://stackoverflow.com/comment/35068090
tagged with: swing
possible better answer: http://stackoverflow.com/a/22966749
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22966749
tagged with: java
type: Question
has body: I am attempting to create a program thtat does some processing and exits when a given letter is typed. //1.00usd = .727751euro int reset = 0; while(reset == 0) { double euro; double ems; String input = JOptionPane.showInputDialog(null,"Enter Amount of US Dollar: "); ems = Double.parseDouble(input); if (ems &lt; 0) { JOptionPane.showMessageDialog(null, "Please enter a real amount of money"); reset = 0; } if (ems &gt;= 0) { euro = .727751; ems = ems*euro; ems = ems*100; ems = Math.round(ems); ems = ems/100; JOptionPane.showMessageDialog(null,"Amount in euros: € " + ems); } } This program is to convert usd to euro and I wanted to know how I can make the program exit when entering the letter "Q". This is for a an object class so I'm still learning.
has answer: http://stackoverflow.com/a/22966863
has answer: http://stackoverflow.com/a/22966874
has comment: http://stackoverflow.com/comment/35067930
has comment: http://stackoverflow.com/comment/35068045
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/35067837
tagged with: converters
tagged with: currency
accepted answer: http://stackoverflow.com/a/22966863

spring-batch-admin
tags question: http://stackoverflow.com/q/22933613
type: Tag
tags question: http://stackoverflow.com/q/22945299
tag name: spring-batch-admin

http://stackoverflow.com/q/22927920
accepted answer: http://stackoverflow.com/a/22928031
possible better answer: http://stackoverflow.com/a/22928033
has answer: http://stackoverflow.com/a/22928033
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22928031
has comment: http://stackoverflow.com/comment/34999010
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/34999025
has answer: http://stackoverflow.com/a/22928041
has comment: http://stackoverflow.com/comment/34999036
has title: Java printing symbol for positive number
score: 5
answer count: 3
has comment: http://stackoverflow.com/comment/34999077
downvote count: 0
linked to: http://stackoverflow.com/q/5243316
has body: I have a Java program that does a bunch of calculations from some user inputs and at the end it has to print the equation of the plane. Format of the equation of the plane is 6x-2y+3z-4=0. To get the values 6, -2, 3, &amp; -4 is from a bunch of calculations. So i was thinking to print out the equation is to System.out.println("Equation is: " + aa + "x" + bb + "y" + cc + "z" + gg + "=0"); Where aa, bb, cc , gg corresponds to the 4 integers above. But the output is Equation is: 6x-2y3z-4=0 It seems to print the minus signs in there for the negative numbers but how can i have it print out a plus sign if the number is positive? Like in between -2y3z should be 6x-2y+3z-4=0
favorite count: 0

http://stackoverflow.com/a/23034551
downvote count: 0
answers question: http://stackoverflow.com/q/22896109
type: Answer
has body: I found a solution: I had to manually set the probesize property on IContainer to 2048 and it works.
score: 1
upvote count: 1

http://stackoverflow.com/a/22952035
has comment: http://stackoverflow.com/comment/35120732
has body: I've reformatted your build.xml here. There are some issues with it: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <property environment="env"/> <property name="debuglevel" value="source,lines,vars"/> <property name="target" value="1.7"/> <property name="source" value="1.7"/> <pathelement location="bin"/> <mkdir dir="bin"/> <exclude name="**/*.launch"/> <exclude name="**/*.java"/> <delete dir="bin"/> <echo message="${ant.project.name}: ${ant.file}"/> <src path="src"/> <classpath refid="AutoFill.classpath"/> <!-- includeantruntime="false" source="${source}" target="${target}"> --> <patternset includes="jdtCompilerAdapter.jar"/> <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> <antcall target="build"/> <classpath refid="AutoFill.classpath"/> <classpath refid="AutoFill.classpath"/> I don't know if you miscopied it, but it's simply not a valid Ant build file as it stands now. You may want to check your post and see if you missed anything. Your error is pretty straight forward. You don't have a target named run. I have no idea why you would be executing it. (Maybe it's in the section of your build.xml that was messed up. The valid targets are: init clean cleanall build build-project build-subprojects init-??? (Target name is not complete) build-eclipse compiler (Invalid target name. Can't contain a space) MaxHeap (Java Executable) Driver (Java Executable) If you're attempting to compile this project, you want to run the build-project or build target and not run. (Both build-project and build do the same thing). If you're attempting to run some program, MaxHeap and Driver are the only two Java executable targets in the build.xml. So, you probably want to execute the targets build and then Driver or MaxHeap.
has comment: http://stackoverflow.com/comment/35042127
has comment: http://stackoverflow.com/comment/35042862
answers question: http://stackoverflow.com/q/22951201
has comment: http://stackoverflow.com/comment/35047837
score: 0
has comment: http://stackoverflow.com/comment/35042748
type: Answer
has comment: http://stackoverflow.com/comment/35043771

http://stackoverflow.com/q/22891916
has answer: http://stackoverflow.com/a/22892004
has body: For example, I have the number 137.99999999999. How do you format that to one decimal place like 137.9? Another example would be 4.7777777777 to 4.7 Note: I don't want to round the number at all. I just want to truncate it to one decimal place.
upvote count: 2
has title: How do you shorten a long decimal number in Java?
tagged with: double
has comment: http://stackoverflow.com/comment/34933476
has comment: http://stackoverflow.com/comment/34933387
has comment: http://stackoverflow.com/comment/34933404
linked to: http://stackoverflow.com/q/2808535
has comment: http://stackoverflow.com/comment/34933591
has comment: http://stackoverflow.com/comment/34950033
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22891977
tagged with: java
accepted answer: http://stackoverflow.com/a/22891977
type: Question
tagged with: decimal
possible better answer: http://stackoverflow.com/a/22892004
downvote count: 0
has comment: http://stackoverflow.com/comment/34933455
answer count: 2
has comment: http://stackoverflow.com/comment/34933424
favorite count: 0
has comment: http://stackoverflow.com/comment/34933394

http://stackoverflow.com/q/22877129
tagged with: delay
has body: Note: I am fairly new to Java so if the answer is incredibly simple, please keep that in mind :) All I'm trying to do is make a nice looking spiral animation like the one it would show in Windows Media Player while music was playing or like an animation similar to one of the screen savers from Windows XP. I'm stuck trying to figure out how to create delay between the creation of one line and then the creation of another line. I want the program to start out with a black screen and every half-second or so, add one line at a slightly different location from the one before making for a cool spiral animation I'm sure there's a way to do what I want using Thread.Sleep() I just don't know how to do it. Any help or advice would be greatly appreciated! :D A picture of my code currently: https://i.sstatic.net/fnD32.jpg
has title: Creating a Spiral Animation (Delay Help)
score: 0
has answer: http://stackoverflow.com/a/22877971
type: UnansweredQuestion
tagged with: animation
has answer: http://stackoverflow.com/a/22877595
has comment: http://stackoverflow.com/comment/34908530
linked to: http://stackoverflow.com/q/21800466
tagged with: java
has comment: http://stackoverflow.com/comment/34907195
tagged with: spiral
tagged with: sleep
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34907111

http://stackoverflow.com/a/22952649
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22952618
score: 3
has body: try java.sql.Timestamp Timestamp ts = Timestamp.valueOf("2013-01-09 09:15:03.500000"); Date date = new Date(ts.getTime()) it's also thread-safe and fast as opposed to SimpleDateFormat
has comment: http://stackoverflow.com/comment/35043672
has comment: http://stackoverflow.com/comment/35043596
upvote count: 3

http://stackoverflow.com/a/26642035
answers question: http://stackoverflow.com/q/22896923
score: 0
has body: A (paid) web service called GlobalNLP can do it in multiple languages: https://nlp.linguasys.com/docs/services/54131f001c78d802f0f2b28f/operations/5429f9591c78d80a3cd66926
type: Answer

http://stackoverflow.com/q/22861828
tagged with: utf-8
favorite count: 0
tagged with: utf-16
has body: I have this string in java: "test.message" byte[] bytes = plaintext.getBytes("UTF-8"); //result: [116, 101, 115, 116, 46, 109, 101, 115, 115, 97, 103, 101] If I do the same thing in javascript: stringToByteArray: function (str) { str = unescape(encodeURIComponent(str)); var bytes = new Array(str.length); for (var i = 0; i &lt; str.length; ++i) bytes[i] = str.charCodeAt(i); return bytes; }, I get: [7,163,140,72,178,72,244,241,149,43,67,124] I was under the impression that the unescape(encodeURIComponent()) would correctly translate the string to UTF-8. Is this not the case? Reference: http://ecmanaut.blogspot.be/2006/07/encoding-decoding-utf8-in-javascript.html
accepted answer: http://stackoverflow.com/a/22861911
score: 14
type: AnsweredQuestion
upvote count: 14
possible better answer: http://stackoverflow.com/a/25598591
tagged with: java
has answer: http://stackoverflow.com/a/22861911
type: Question
tagged with: javascript
has title: java string.getBytes("UTF-8") javascript equivalent
answer count: 2
tagged with: byte
has answer: http://stackoverflow.com/a/25598591
downvote count: 0

http://stackoverflow.com/comment/35015873
type: Comment
type: QuestionComment
score: 1
has text: That is very good question! Nobody ever did something like that! I wish there wwere some example on the interwebs...
comment on: http://stackoverflow.com/q/22937720

http://stackoverflow.com/q/22864183
tagged with: format
answer count: 2
has body: I have a table which gives me values in Nos. and Decimal (weight-kg) E.g.10.455 Kg ( that is 10 Kg and 455 gms) and nos. as in 10 Nos. Now all these values come from a column (Decimal (10,3)-mysql) in table and based on the unittype column I have to decide whether to have 3 decimal or zero decimal in the BIRT report. I know that through scripting the values can be modified.. but I am unable to utilise the scripting. I am writing this on onFetch if(row["unittype"]=="Nos") var df = new Packages.java.text.DecimalFormat("#,###.##"); else var df = new Packages.java.text.DecimalFormat("#,###"); df.format(row["invoicedquantity"]); this.setDisplayValue(df); I am unable to get the values
upvote count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/34888941
accepted answer: http://stackoverflow.com/a/22865741
has title: Number format a decimal in Birt reports
has comment: http://stackoverflow.com/comment/34883068
possible better answer: http://stackoverflow.com/a/65229950
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22865741
tagged with: report
downvote count: 0
has answer: http://stackoverflow.com/a/65229950
tagged with: birt
score: 7
tagged with: java
tagged with: mysql
type: Question

http://stackoverflow.com/comment/34809195
type: Comment
score: 0
has text: No, the fire method should create a projectile and do other things like make a noise, take ammo or whatever but it returns nothing
type: QuestionComment
comment on: http://stackoverflow.com/q/22822481

http://stackoverflow.com/a/22926995
score: 1
has body: Your POJO JavaBean won't magically get populated with the data. It has no connection to the database and no way to get or save data. You need a controller that fetches data from the DB, creates model objects, and populates them with the data. The controller is also responsible for saving beans You could write this yourself but it's generally better to use existing ORM frameworks like JPA2, a custom persistence provider API like Hibernate, or something like MyBatis. If you really want, you can hand-roll your controller with direct JDBC calls, injecting the connection from the environment, but that tends to produce a lot of boilerplate code for little benefit even with things like Spring JDBC to help smooth things over. Some IDEs, like NetBeans and Eclipse, can even auto-generate models and controllers for you, though I've never been very happy with the results (particularly the failure to use a parent-class and generic methods and the lack of any sort of useful error handling).
downvote count: 0
answers question: http://stackoverflow.com/q/22925572
type: Answer
upvote count: 1